@qingwu-ui/select 0.9.0-beta → 0.9.0-beta.1
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.
- package/README.md +1 -0
- package/dist/browser/demo-entry.js +540 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ React / Vue 集成时在 `useEffect` / `onMounted` 中实例化,卸载时调
|
|
|
63
63
|
| `stagger` | `number` | `28` | 选项错峰间隔 ms |
|
|
64
64
|
| `animate` | `boolean` | `true` | 手风琴错峰动画开关 |
|
|
65
65
|
| `maxStagger` | `number` | `12` | 超过该选项数降级为整体淡入,`0` 不降级 |
|
|
66
|
+
| `frosted` | `boolean` | `true` | 面板半透明磨砂质感(半透明底 + backdrop-filter 毛玻璃);`false` 回退不透明实体面板 |
|
|
66
67
|
| `ariaLabel` | `string` | `placeholder` | 触发器无障碍标签 |
|
|
67
68
|
| `onOpenChange` | `(open) => void` | `-` | 展开状态变化回调 |
|
|
68
69
|
| `onChange` | `(value, option) => void` | `-` | 选中值变化回调(取消为 `null`) |
|
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
// ../../icon/icons.ts
|
|
3
|
+
var S = (d) => `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
4
|
+
var S16 = (d) => `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
5
|
+
var S18 = (d) => `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
6
|
+
var S36 = (d) => `<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
7
|
+
var ICON_CALENDAR = S('<rect x="3" y="4" width="18" height="18" rx="2"/><path d="M8 2v4M16 2v4M3 10h18"/>');
|
|
8
|
+
var ICON_CALENDAR_DOT = S('<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/><line x1="8" y1="14" x2="8.01" y2="14"/>');
|
|
9
|
+
var ICON_SEARCH = S('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>');
|
|
10
|
+
var ICON_UPLOAD = S('<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/>');
|
|
11
|
+
var ICON_UPLOAD_ARROW = S('<path d="M12 16V4"/><path d="m6 9 6-5 6 5"/><path d="M4 20h16"/>');
|
|
12
|
+
var ICON_MENU = S('<path d="M3 7h18M3 12h18M3 17h18"/>');
|
|
13
|
+
var ICON_BELL = S('<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>');
|
|
14
|
+
var ICON_CLOSE = S('<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>');
|
|
15
|
+
var ICON_CHECK = S('<polyline points="20 6 9 17 4 12"/>');
|
|
16
|
+
var ICON_PLUS = S('<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>');
|
|
17
|
+
var ICON_MINUS = S('<line x1="5" y1="12" x2="19" y2="12"/>');
|
|
18
|
+
var ICON_BOX = S('<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>');
|
|
19
|
+
var ICON_EDIT = S('<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>');
|
|
20
|
+
var ICON_FILE = S('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>');
|
|
21
|
+
var ICON_FOLDER = S('<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>');
|
|
22
|
+
var ICON_INFO = S('<circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/>');
|
|
23
|
+
var ICON_WARNING = S('<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/>');
|
|
24
|
+
var ICON_TRASH = S('<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>');
|
|
25
|
+
var ICON_DOWNLOAD = S('<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>');
|
|
26
|
+
var ICON_COPY = S('<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>');
|
|
27
|
+
var ICON_EYE = S('<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>');
|
|
28
|
+
var ICON_STAR = S('<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>');
|
|
29
|
+
var ICON_BOOKMARK = S('<path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/>');
|
|
30
|
+
var ICON_EXTERNAL_LINK = S('<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>');
|
|
31
|
+
var ICON_GITHUB = S('<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/>');
|
|
32
|
+
var ICON_CHEVRON_LEFT = S16('<path d="m15 18-6-6 6-6"/>');
|
|
33
|
+
var ICON_CHEVRON_RIGHT = S16('<path d="m9 18 6-6-6-6"/>');
|
|
34
|
+
var ICON_CHEVRON_UP = S('<polyline points="18 15 12 9 6 15"/>');
|
|
35
|
+
var ICON_CHEVRON_DOWN = S('<polyline points="6 9 12 15 18 9"/>');
|
|
36
|
+
var ICON_CODE = S('<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>');
|
|
37
|
+
var ICON_FULLSCREEN = S('<polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/>');
|
|
38
|
+
var ICON_FULLSCREEN_EXIT = S('<polyline points="4 8 4 3 9 3"/><polyline points="20 16 20 21 15 21"/><line x1="4" y1="3" x2="11" y2="10"/><line x1="20" y1="21" x2="13" y2="14"/>');
|
|
39
|
+
var ICON_CLOCK = S('<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>');
|
|
40
|
+
var ICON_TYPE = S('<polyline points="4 7 4 4 20 4 20 7"/><line x1="9" y1="20" x2="15" y2="20"/><line x1="12" y1="4" x2="12" y2="20"/>');
|
|
41
|
+
var ICON_USERS = S('<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>');
|
|
42
|
+
var ICON_MICROPHONE = S('<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/>');
|
|
43
|
+
var ICON_MUSIC = S('<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>');
|
|
44
|
+
var ICON_VIDEO = S('<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/>');
|
|
45
|
+
var ICON_IMAGE = S('<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/>');
|
|
46
|
+
var ICON_SUN = S('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>');
|
|
47
|
+
var ICON_MOON = S('<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>');
|
|
48
|
+
var ICON_SIDEBAR_TOGGLE = S('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9-3 3 3 3"/>');
|
|
49
|
+
var ICON_LIST = S('<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>');
|
|
50
|
+
var ICON_AI = S('<path d="M12 2l2.4 7.2h7.6l-6 4.8 2.4 7.2-6.4-4.8-6.4 4.8 2.4-7.2-6-4.8h7.6z"/>');
|
|
51
|
+
var ICON_BOLT = S('<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>');
|
|
52
|
+
var ICON_REFRESH = S('<polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>');
|
|
53
|
+
var ICON_RETRY = S('<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>');
|
|
54
|
+
var ICON_SETTINGS = S('<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>');
|
|
55
|
+
var ICON_HISTORY = S('<path d="M3 3v5h5"/><path d="M3.05 13A9 9 0 1 0 6.11 6.11L3 8"/><path d="M12 7v5l4 2"/>');
|
|
56
|
+
var ICON_PUSH = S('<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>');
|
|
57
|
+
var ICON_TRANSLATE = S('<path d="M5 8l6 6"/><path d="M4 14l6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="M22 22l-5-10-5 10"/><path d="M14 18h6"/>');
|
|
58
|
+
var ICON_SUMMARY = S('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/>');
|
|
59
|
+
var ICON_RENAME = S('<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"/>');
|
|
60
|
+
var ICON_SELECTION = S('<circle cx="12" cy="12" r="1"/><path d="M20 12a8 8 0 1 1-8-8"/><path d="m16 2 4 4-4 4"/>');
|
|
61
|
+
var ICON_TAG = S('<path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"/><line x1="7" y1="7" x2="7.01" y2="7"/>');
|
|
62
|
+
var ICON_GRIP = S('<circle cx="9" cy="12" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="9" cy="6" r="1"/><circle cx="15" cy="6" r="1"/><circle cx="9" cy="18" r="1"/><circle cx="15" cy="18" r="1"/>');
|
|
63
|
+
var ICON_DIAGRAM = S('<rect x="2" y="2" width="8" height="8" rx="1"/><rect x="14" y="2" width="8" height="8" rx="1"/><rect x="2" y="14" width="8" height="8" rx="1"/><rect x="14" y="14" width="8" height="8" rx="1"/>');
|
|
64
|
+
var ICON_LANGUAGE = S('<circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>');
|
|
65
|
+
var ICON_PAPERCLIP = S('<path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/>');
|
|
66
|
+
var ICO_UPLOAD = S36('<path d="M12 16V4"/><path d="m6 9 6-5 6 5"/><path d="M4 20h16"/>');
|
|
67
|
+
var S18c = (d) => `<svg class="qs-ico" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
68
|
+
var S20c = (d) => `<svg class="qw-cal-svg" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
69
|
+
var ICO_SEARCH = S18c('<circle cx="11" cy="11" r="7"/><path d="m20 20-3.2-3.2"/>');
|
|
70
|
+
var ICO_MENU = S18('<path d="M4 7h16M4 12h16M4 17h16"/>');
|
|
71
|
+
var ICO_CALENDAR = S20c('<rect x="3" y="4" width="18" height="18" rx="2"/><path d="M8 2v4M16 2v4M3 10h18"/>');
|
|
72
|
+
var ICO_ARROW_LEFT = S16('<path d="m15 18-6-6 6-6"/>');
|
|
73
|
+
var ICO_ARROW_RIGHT = S16('<path d="m9 18 6-6-6-6"/>');
|
|
74
|
+
var SEARCH_ART = '<svg viewBox="0 0 160 140" role="img" aria-label="Search illustration">' + '<ellipse class="qs-art-shadow" cx="80" cy="124" rx="46" ry="6"/>' + '<g class="qs-art-float">' + '<rect class="qs-art-paper" x="40" y="20" width="80" height="82" rx="13"/>' + '<line class="qs-art-row-accent" x1="54" y1="42" x2="92" y2="42"/>' + '<line class="qs-art-row" x1="54" y1="56" x2="106" y2="56"/>' + '<line class="qs-art-row" x1="54" y1="70" x2="84" y2="70"/>' + '<circle class="qs-art-glass" cx="96" cy="86" r="23"/>' + '<line class="qs-art-handle" x1="113" y1="103" x2="129" y2="119"/>' + '<text class="qs-art-seal" x="96" y="94" text-anchor="middle" font-size="24">寻</text>' + "</g>" + '<circle class="qs-art-dot-a qs-art-twinkle" cx="34" cy="32" r="3"/>' + '<circle class="qs-art-dot-b qs-art-twinkle" cx="126" cy="40" r="2.6" style="animation-delay:.8s"/>' + '<circle class="qs-art-dot-c qs-art-twinkle" cx="30" cy="98" r="2.4" style="animation-delay:1.5s"/>' + "</svg>";
|
|
75
|
+
|
|
76
|
+
// src/select.ts
|
|
77
|
+
var PREFERS_REDUCED = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : false;
|
|
78
|
+
var HTML_ESCAPES = {
|
|
79
|
+
"&": "&",
|
|
80
|
+
"<": "<",
|
|
81
|
+
">": ">",
|
|
82
|
+
'"': """
|
|
83
|
+
};
|
|
84
|
+
function escapeHTML(s) {
|
|
85
|
+
return s.replace(/[&<>"]/g, (c) => HTML_ESCAPES[c] ?? c);
|
|
86
|
+
}
|
|
87
|
+
function el(tag, cls, html) {
|
|
88
|
+
const n = document.createElement(tag);
|
|
89
|
+
if (cls)
|
|
90
|
+
n.className = cls;
|
|
91
|
+
if (html != null)
|
|
92
|
+
n.innerHTML = html;
|
|
93
|
+
return n;
|
|
94
|
+
}
|
|
95
|
+
var UID = 0;
|
|
96
|
+
|
|
97
|
+
class Select {
|
|
98
|
+
root;
|
|
99
|
+
options;
|
|
100
|
+
placeholder;
|
|
101
|
+
customClass;
|
|
102
|
+
width;
|
|
103
|
+
duration;
|
|
104
|
+
stagger;
|
|
105
|
+
animate;
|
|
106
|
+
maxStagger;
|
|
107
|
+
frosted;
|
|
108
|
+
onOpenChangeCb;
|
|
109
|
+
onChangeCb;
|
|
110
|
+
controlledValue;
|
|
111
|
+
displayValue;
|
|
112
|
+
isOpen = false;
|
|
113
|
+
isDisabled = false;
|
|
114
|
+
active = -1;
|
|
115
|
+
dir = "down";
|
|
116
|
+
closeTimer = null;
|
|
117
|
+
trigger;
|
|
118
|
+
valueEl;
|
|
119
|
+
list;
|
|
120
|
+
panel;
|
|
121
|
+
onDocPointerDown = null;
|
|
122
|
+
onWinScroll = null;
|
|
123
|
+
constructor(root, opts = {}) {
|
|
124
|
+
this.root = root;
|
|
125
|
+
this.options = opts.options ?? [];
|
|
126
|
+
this.placeholder = opts.placeholder ?? "";
|
|
127
|
+
this.customClass = opts.className ?? "";
|
|
128
|
+
this.width = opts.width ?? "trigger";
|
|
129
|
+
this.duration = opts.duration ?? 380;
|
|
130
|
+
this.stagger = opts.stagger ?? 28;
|
|
131
|
+
this.animate = opts.animate !== false;
|
|
132
|
+
this.maxStagger = opts.maxStagger ?? 12;
|
|
133
|
+
this.frosted = opts.frosted !== false;
|
|
134
|
+
this.onOpenChangeCb = opts.onOpenChange;
|
|
135
|
+
this.onChangeCb = opts.onChange;
|
|
136
|
+
this.controlledValue = "value" in opts;
|
|
137
|
+
this.displayValue = opts.value ?? opts.defaultValue ?? null;
|
|
138
|
+
this.isDisabled = opts.disabled === true;
|
|
139
|
+
this.build(opts);
|
|
140
|
+
if (opts.open === true || opts.defaultOpen === true && opts.open == null) {
|
|
141
|
+
this.open();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
build(opts) {
|
|
145
|
+
const ariaLabel = opts.ariaLabel ?? (this.placeholder || "请选择");
|
|
146
|
+
this.root.classList.add("qsel");
|
|
147
|
+
if (this.customClass)
|
|
148
|
+
this.root.classList.add(this.customClass);
|
|
149
|
+
this.root.classList.toggle("is-disabled", this.isDisabled);
|
|
150
|
+
this.trigger = el("button", "qsel-trigger");
|
|
151
|
+
this.trigger.type = "button";
|
|
152
|
+
this.trigger.setAttribute("role", "combobox");
|
|
153
|
+
this.trigger.setAttribute("aria-haspopup", "listbox");
|
|
154
|
+
this.trigger.setAttribute("aria-expanded", "false");
|
|
155
|
+
this.trigger.setAttribute("aria-label", ariaLabel);
|
|
156
|
+
this.trigger.disabled = this.isDisabled;
|
|
157
|
+
this.valueEl = el("span", "qsel-value");
|
|
158
|
+
const chev = el("span", "qsel-chevron", ICON_CHEVRON_DOWN);
|
|
159
|
+
chev.setAttribute("aria-hidden", "true");
|
|
160
|
+
this.trigger.append(this.valueEl, chev);
|
|
161
|
+
this.root.append(this.trigger);
|
|
162
|
+
this.panel = el("div", "qsel-panel");
|
|
163
|
+
this.panel.classList.toggle("is-frosted", this.frosted);
|
|
164
|
+
this.panel.hidden = true;
|
|
165
|
+
this.panel.id = `qsel-panel-${++UID}`;
|
|
166
|
+
this.panel.setAttribute("role", "listbox");
|
|
167
|
+
this.panel.setAttribute("aria-label", ariaLabel);
|
|
168
|
+
this.list = el("ul", "qsel-list");
|
|
169
|
+
this.panel.append(this.list);
|
|
170
|
+
document.body.append(this.panel);
|
|
171
|
+
this.syncValue();
|
|
172
|
+
this.renderOptions();
|
|
173
|
+
this.trigger.addEventListener("click", () => {
|
|
174
|
+
if (this.isDisabled)
|
|
175
|
+
return;
|
|
176
|
+
this.isOpen ? this.close() : this.open();
|
|
177
|
+
});
|
|
178
|
+
this.trigger.addEventListener("keydown", (e) => this.onTriggerKey(e));
|
|
179
|
+
this.list.addEventListener("pointerdown", (e) => e.preventDefault());
|
|
180
|
+
this.list.addEventListener("click", (e) => {
|
|
181
|
+
const opt = e.target.closest(".qsel-opt");
|
|
182
|
+
if (opt)
|
|
183
|
+
this.select(Number(opt.dataset.index));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
renderOptions() {
|
|
187
|
+
this.list.textContent = "";
|
|
188
|
+
const frag = document.createDocumentFragment();
|
|
189
|
+
const shouldStagger = this.shouldStagger();
|
|
190
|
+
this.options.forEach((opt, i) => {
|
|
191
|
+
const li = el("li", "qsel-opt");
|
|
192
|
+
li.dataset.index = String(i);
|
|
193
|
+
li.id = `qsel-opt-${i}`;
|
|
194
|
+
li.setAttribute("role", "option");
|
|
195
|
+
li.setAttribute("aria-selected", String(opt.value === this.displayValue));
|
|
196
|
+
if (opt.disabled) {
|
|
197
|
+
li.classList.add("is-disabled");
|
|
198
|
+
li.setAttribute("aria-disabled", "true");
|
|
199
|
+
}
|
|
200
|
+
if (shouldStagger)
|
|
201
|
+
li.classList.add("is-enter");
|
|
202
|
+
const glyph = opt.glyph ?? opt.label.slice(0, 1);
|
|
203
|
+
li.innerHTML = `<span class="qsel-opt-ico">${escapeHTML(glyph)}</span>` + `<span class="qsel-opt-main"><span class="qsel-opt-label">${escapeHTML(opt.label)}</span>` + (opt.hint ? `<span class="qsel-opt-hint">${escapeHTML(opt.hint)}</span>` : "") + `</span>` + `<span class="qsel-check" aria-hidden="true">${ICON_CHECK}</span>`;
|
|
204
|
+
frag.append(li);
|
|
205
|
+
});
|
|
206
|
+
this.list.append(frag);
|
|
207
|
+
}
|
|
208
|
+
shouldStagger() {
|
|
209
|
+
return this.animate && !PREFERS_REDUCED && this.options.length <= this.maxStagger;
|
|
210
|
+
}
|
|
211
|
+
syncValue() {
|
|
212
|
+
const opt = this.currentOption;
|
|
213
|
+
this.valueEl.textContent = opt ? opt.label : this.placeholder;
|
|
214
|
+
this.valueEl.classList.toggle("is-placeholder", !opt);
|
|
215
|
+
}
|
|
216
|
+
get currentOption() {
|
|
217
|
+
return this.options.find((o) => o.value === this.displayValue) ?? null;
|
|
218
|
+
}
|
|
219
|
+
open() {
|
|
220
|
+
if (this.isOpen || this.isDisabled)
|
|
221
|
+
return;
|
|
222
|
+
this.isOpen = true;
|
|
223
|
+
this.renderOptions();
|
|
224
|
+
this.panel.hidden = false;
|
|
225
|
+
this.root.classList.add("is-open");
|
|
226
|
+
this.trigger.setAttribute("aria-expanded", "true");
|
|
227
|
+
this.position();
|
|
228
|
+
this.setActive(this.startIndex(), false);
|
|
229
|
+
this.applyStagger();
|
|
230
|
+
requestAnimationFrame(() => this.panel.classList.add("is-open"));
|
|
231
|
+
this.onDocPointerDown = (e) => {
|
|
232
|
+
if (this.isOpen && !this.root.contains(e.target))
|
|
233
|
+
this.close();
|
|
234
|
+
};
|
|
235
|
+
document.addEventListener("pointerdown", this.onDocPointerDown);
|
|
236
|
+
this.onWinScroll = () => this.position();
|
|
237
|
+
window.addEventListener("scroll", this.onWinScroll, true);
|
|
238
|
+
window.addEventListener("resize", this.onWinScroll);
|
|
239
|
+
this.onOpenChangeCb?.(true);
|
|
240
|
+
}
|
|
241
|
+
close() {
|
|
242
|
+
if (!this.isOpen)
|
|
243
|
+
return;
|
|
244
|
+
this.isOpen = false;
|
|
245
|
+
this.root.classList.remove("is-open");
|
|
246
|
+
this.panel.classList.remove("is-open");
|
|
247
|
+
this.trigger.setAttribute("aria-expanded", "false");
|
|
248
|
+
this.trigger.removeAttribute("aria-activedescendant");
|
|
249
|
+
this.active = -1;
|
|
250
|
+
if (this.onDocPointerDown) {
|
|
251
|
+
document.removeEventListener("pointerdown", this.onDocPointerDown);
|
|
252
|
+
this.onDocPointerDown = null;
|
|
253
|
+
}
|
|
254
|
+
if (this.onWinScroll) {
|
|
255
|
+
window.removeEventListener("scroll", this.onWinScroll, true);
|
|
256
|
+
window.removeEventListener("resize", this.onWinScroll);
|
|
257
|
+
this.onWinScroll = null;
|
|
258
|
+
}
|
|
259
|
+
if (this.closeTimer !== null)
|
|
260
|
+
clearTimeout(this.closeTimer);
|
|
261
|
+
this.closeTimer = setTimeout(() => {
|
|
262
|
+
if (!this.isOpen)
|
|
263
|
+
this.panel.hidden = true;
|
|
264
|
+
}, PREFERS_REDUCED ? 0 : this.duration);
|
|
265
|
+
this.onOpenChangeCb?.(false);
|
|
266
|
+
}
|
|
267
|
+
toggle() {
|
|
268
|
+
this.isOpen ? this.close() : this.open();
|
|
269
|
+
}
|
|
270
|
+
position() {
|
|
271
|
+
const tr = this.trigger.getBoundingClientRect();
|
|
272
|
+
const gap = 8;
|
|
273
|
+
this.panel.style.width = this.width === "auto" ? "max-content" : `${tr.width}px`;
|
|
274
|
+
if (this.width === "auto") {
|
|
275
|
+
this.panel.style.minWidth = `${tr.width}px`;
|
|
276
|
+
}
|
|
277
|
+
this.panel.style.visibility = "hidden";
|
|
278
|
+
const panelH = this.panel.offsetHeight;
|
|
279
|
+
const panelW = this.panel.offsetWidth;
|
|
280
|
+
const spaceBelow = window.innerHeight - tr.bottom;
|
|
281
|
+
const spaceAbove = tr.top;
|
|
282
|
+
const flipUp = spaceBelow - gap < panelH && spaceAbove > spaceBelow;
|
|
283
|
+
this.dir = flipUp ? "up" : "down";
|
|
284
|
+
this.panel.classList.toggle("is-up", flipUp);
|
|
285
|
+
let left = tr.left;
|
|
286
|
+
if (this.width === "auto" && panelW > window.innerWidth - 16) {
|
|
287
|
+
left = Math.max(8, window.innerWidth - panelW - 8);
|
|
288
|
+
}
|
|
289
|
+
this.panel.style.left = `${Math.max(8, left)}px`;
|
|
290
|
+
if (flipUp) {
|
|
291
|
+
this.panel.style.top = "auto";
|
|
292
|
+
this.panel.style.bottom = `${Math.max(8, window.innerHeight - tr.top + gap)}px`;
|
|
293
|
+
} else {
|
|
294
|
+
this.panel.style.top = `${tr.bottom + gap}px`;
|
|
295
|
+
this.panel.style.bottom = "auto";
|
|
296
|
+
}
|
|
297
|
+
this.panel.style.visibility = "";
|
|
298
|
+
}
|
|
299
|
+
applyStagger() {
|
|
300
|
+
if (!this.shouldStagger())
|
|
301
|
+
return;
|
|
302
|
+
const opts = this.list.querySelectorAll(".qsel-opt.is-enter");
|
|
303
|
+
const n = opts.length;
|
|
304
|
+
opts.forEach((o, i) => {
|
|
305
|
+
const delay = this.dir === "up" ? (n - 1 - i) * this.stagger : i * this.stagger;
|
|
306
|
+
o.style.animationDelay = `${delay}ms`;
|
|
307
|
+
o.style.animationDuration = `${this.duration}ms`;
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
select(index) {
|
|
311
|
+
const opt = this.options[index];
|
|
312
|
+
if (!opt || opt.disabled)
|
|
313
|
+
return;
|
|
314
|
+
if (!this.controlledValue) {
|
|
315
|
+
this.displayValue = opt.value;
|
|
316
|
+
this.syncValue();
|
|
317
|
+
}
|
|
318
|
+
this.onChangeCb?.(opt.value, opt);
|
|
319
|
+
this.close();
|
|
320
|
+
}
|
|
321
|
+
setActive(idx, scroll = true) {
|
|
322
|
+
const opts = this.list.querySelectorAll(".qsel-opt");
|
|
323
|
+
if (!opts.length)
|
|
324
|
+
return;
|
|
325
|
+
this.active = Math.max(0, Math.min(idx, opts.length - 1));
|
|
326
|
+
opts.forEach((o, i) => {
|
|
327
|
+
const on = i === this.active;
|
|
328
|
+
o.classList.toggle("is-active", on);
|
|
329
|
+
if (on) {
|
|
330
|
+
this.trigger.setAttribute("aria-activedescendant", o.id);
|
|
331
|
+
if (scroll)
|
|
332
|
+
o.scrollIntoView({ block: "nearest" });
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
onTriggerKey(e) {
|
|
337
|
+
if (this.isDisabled)
|
|
338
|
+
return;
|
|
339
|
+
switch (e.key) {
|
|
340
|
+
case "ArrowDown":
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
if (!this.isOpen)
|
|
343
|
+
this.open();
|
|
344
|
+
else
|
|
345
|
+
this.moveActive(1);
|
|
346
|
+
break;
|
|
347
|
+
case "ArrowUp":
|
|
348
|
+
e.preventDefault();
|
|
349
|
+
if (!this.isOpen)
|
|
350
|
+
this.open();
|
|
351
|
+
else
|
|
352
|
+
this.moveActive(-1);
|
|
353
|
+
break;
|
|
354
|
+
case "Home":
|
|
355
|
+
if (this.isOpen) {
|
|
356
|
+
e.preventDefault();
|
|
357
|
+
this.moveActive(Number.MIN_SAFE_INTEGER);
|
|
358
|
+
}
|
|
359
|
+
break;
|
|
360
|
+
case "End":
|
|
361
|
+
if (this.isOpen) {
|
|
362
|
+
e.preventDefault();
|
|
363
|
+
this.moveActive(Number.MAX_SAFE_INTEGER);
|
|
364
|
+
}
|
|
365
|
+
break;
|
|
366
|
+
case "Enter":
|
|
367
|
+
case " ":
|
|
368
|
+
e.preventDefault();
|
|
369
|
+
if (this.isOpen) {
|
|
370
|
+
if (this.active >= 0)
|
|
371
|
+
this.select(this.active);
|
|
372
|
+
} else {
|
|
373
|
+
this.open();
|
|
374
|
+
}
|
|
375
|
+
break;
|
|
376
|
+
case "Escape":
|
|
377
|
+
if (this.isOpen) {
|
|
378
|
+
e.preventDefault();
|
|
379
|
+
this.close();
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
case "Tab":
|
|
383
|
+
if (this.isOpen)
|
|
384
|
+
this.close();
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
nextEnabled(from, dir) {
|
|
389
|
+
const n = this.options.length;
|
|
390
|
+
if (!n)
|
|
391
|
+
return -1;
|
|
392
|
+
for (let step = 1;step <= n; step++) {
|
|
393
|
+
const i = (from + dir * step + n) % n;
|
|
394
|
+
const o = this.options[i];
|
|
395
|
+
if (o && !o.disabled)
|
|
396
|
+
return i;
|
|
397
|
+
}
|
|
398
|
+
return -1;
|
|
399
|
+
}
|
|
400
|
+
firstEnabled() {
|
|
401
|
+
return this.options.findIndex((o) => !o.disabled);
|
|
402
|
+
}
|
|
403
|
+
lastEnabled() {
|
|
404
|
+
for (let i = this.options.length - 1;i >= 0; i--) {
|
|
405
|
+
const o = this.options[i];
|
|
406
|
+
if (o && !o.disabled)
|
|
407
|
+
return i;
|
|
408
|
+
}
|
|
409
|
+
return -1;
|
|
410
|
+
}
|
|
411
|
+
startIndex() {
|
|
412
|
+
const idx = this.options.findIndex((o) => o.value === this.displayValue && !o.disabled);
|
|
413
|
+
return idx >= 0 ? idx : this.firstEnabled();
|
|
414
|
+
}
|
|
415
|
+
moveActive(delta) {
|
|
416
|
+
if (delta === Number.MIN_SAFE_INTEGER) {
|
|
417
|
+
const i = this.firstEnabled();
|
|
418
|
+
if (i >= 0)
|
|
419
|
+
this.setActive(i);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (delta === Number.MAX_SAFE_INTEGER) {
|
|
423
|
+
const i = this.lastEnabled();
|
|
424
|
+
if (i >= 0)
|
|
425
|
+
this.setActive(i);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const from = this.active < 0 ? this.startIndex() : this.active;
|
|
429
|
+
const next = this.nextEnabled(from, delta > 0 ? 1 : -1);
|
|
430
|
+
if (next >= 0)
|
|
431
|
+
this.setActive(next);
|
|
432
|
+
}
|
|
433
|
+
get value() {
|
|
434
|
+
return this.displayValue;
|
|
435
|
+
}
|
|
436
|
+
get expanded() {
|
|
437
|
+
return this.isOpen;
|
|
438
|
+
}
|
|
439
|
+
update(patch) {
|
|
440
|
+
if ("options" in patch && patch.options) {
|
|
441
|
+
this.options = patch.options;
|
|
442
|
+
this.renderOptions();
|
|
443
|
+
this.syncValue();
|
|
444
|
+
}
|
|
445
|
+
if ("value" in patch) {
|
|
446
|
+
this.displayValue = patch.value ?? null;
|
|
447
|
+
this.syncValue();
|
|
448
|
+
if (this.isOpen)
|
|
449
|
+
this.renderOptions();
|
|
450
|
+
}
|
|
451
|
+
if ("disabled" in patch && patch.disabled !== undefined) {
|
|
452
|
+
this.setDisabled(patch.disabled);
|
|
453
|
+
}
|
|
454
|
+
if ("open" in patch && patch.open !== undefined) {
|
|
455
|
+
patch.open ? this.open() : this.close();
|
|
456
|
+
}
|
|
457
|
+
if ("placeholder" in patch && patch.placeholder !== undefined) {
|
|
458
|
+
this.placeholder = patch.placeholder;
|
|
459
|
+
this.syncValue();
|
|
460
|
+
}
|
|
461
|
+
if ("ariaLabel" in patch && patch.ariaLabel !== undefined) {
|
|
462
|
+
this.trigger.setAttribute("aria-label", patch.ariaLabel);
|
|
463
|
+
}
|
|
464
|
+
if ("frosted" in patch && patch.frosted !== undefined) {
|
|
465
|
+
this.frosted = patch.frosted;
|
|
466
|
+
this.panel.classList.toggle("is-frosted", this.frosted);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
setValue(value) {
|
|
470
|
+
this.update({ value });
|
|
471
|
+
}
|
|
472
|
+
setDisabled(v) {
|
|
473
|
+
this.isDisabled = v;
|
|
474
|
+
this.root.classList.toggle("is-disabled", v);
|
|
475
|
+
this.trigger.disabled = v;
|
|
476
|
+
if (v)
|
|
477
|
+
this.close();
|
|
478
|
+
}
|
|
479
|
+
destroy() {
|
|
480
|
+
if (this.closeTimer !== null)
|
|
481
|
+
clearTimeout(this.closeTimer);
|
|
482
|
+
this.close();
|
|
483
|
+
this.panel.remove();
|
|
484
|
+
this.root.classList.remove("qsel", "is-open", "is-disabled");
|
|
485
|
+
if (this.customClass)
|
|
486
|
+
this.root.classList.remove(this.customClass);
|
|
487
|
+
this.root.textContent = "";
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// src/demo-entry.ts
|
|
492
|
+
window.Select = Select;
|
|
493
|
+
function mountDemo() {
|
|
494
|
+
const host = document.querySelector("#qsel-demo");
|
|
495
|
+
if (!host)
|
|
496
|
+
return;
|
|
497
|
+
host.insertAdjacentHTML("beforeend", `<style>
|
|
498
|
+
#qsel-demo { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
|
|
499
|
+
#qsel-demo .col { width: 240px; }
|
|
500
|
+
#qsel-demo h2 { margin: 0 0 4px; font-size: 15px; color: var(--qsel-ink, #1d2b2c); }
|
|
501
|
+
#qsel-demo .hint { margin: 0 0 10px; font-size: 12px; color: var(--qsel-ink-3, #84928f); }
|
|
502
|
+
#qsel-demo .toggle { margin-top: 18px; padding: 9px 16px; font-size: 13px; cursor: pointer;
|
|
503
|
+
border: 1.5px solid var(--qsel-line, #dcdfd6); border-radius: 12px;
|
|
504
|
+
background: var(--qsel-card, #fff); color: var(--qsel-ink, #1d2b2c); }
|
|
505
|
+
#qsel-demo .toggle:hover { border-color: var(--qsel-teal, #1e605a); }
|
|
506
|
+
</style>
|
|
507
|
+
<div class="col">
|
|
508
|
+
<h2>磨砂面板</h2>
|
|
509
|
+
<p class="hint">frosted 默认开启 · 半透明底 + backdrop-filter 毛玻璃</p>
|
|
510
|
+
<div id="qsel-frosted"></div>
|
|
511
|
+
<button type="button" class="toggle" id="qsel-toggle">切换为不透明 →</button>
|
|
512
|
+
</div>
|
|
513
|
+
<div class="col">
|
|
514
|
+
<h2>不透明面板</h2>
|
|
515
|
+
<p class="hint">frosted: false · 实体面板</p>
|
|
516
|
+
<div id="qsel-opaque"></div>
|
|
517
|
+
</div>`);
|
|
518
|
+
const options = [
|
|
519
|
+
{ value: "react", label: "React", hint: "框架无关 · 原生 DOM" },
|
|
520
|
+
{ value: "vue", label: "Vue", hint: "new Select(el) 即用" },
|
|
521
|
+
{ value: "svelte", label: "Svelte" },
|
|
522
|
+
{ value: "ember", label: "Ember", disabled: true }
|
|
523
|
+
];
|
|
524
|
+
const frosted = new Select(host.querySelector("#qsel-frosted"), { placeholder: "磨砂面板(默认)", options, width: "trigger" });
|
|
525
|
+
new Select(host.querySelector("#qsel-opaque"), {
|
|
526
|
+
placeholder: "不透明面板",
|
|
527
|
+
options,
|
|
528
|
+
width: "trigger",
|
|
529
|
+
frosted: false
|
|
530
|
+
});
|
|
531
|
+
let isFrosted = true;
|
|
532
|
+
host.querySelector("#qsel-toggle").addEventListener("click", () => {
|
|
533
|
+
isFrosted = !isFrosted;
|
|
534
|
+
frosted.update({ frosted: isFrosted });
|
|
535
|
+
const btn = host.querySelector("#qsel-toggle");
|
|
536
|
+
btn.textContent = isFrosted ? "切换为不透明 →" : "切换为磨砂 →";
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
mountDemo();
|
|
540
|
+
})();
|
package/dist/index.cjs
CHANGED
|
@@ -100,6 +100,7 @@ var Select = class {
|
|
|
100
100
|
stagger;
|
|
101
101
|
animate;
|
|
102
102
|
maxStagger;
|
|
103
|
+
frosted;
|
|
103
104
|
onOpenChangeCb;
|
|
104
105
|
onChangeCb;
|
|
105
106
|
controlledValue;
|
|
@@ -125,6 +126,7 @@ var Select = class {
|
|
|
125
126
|
this.stagger = opts.stagger ?? 28;
|
|
126
127
|
this.animate = opts.animate !== false;
|
|
127
128
|
this.maxStagger = opts.maxStagger ?? 12;
|
|
129
|
+
this.frosted = opts.frosted !== false;
|
|
128
130
|
this.onOpenChangeCb = opts.onOpenChange;
|
|
129
131
|
this.onChangeCb = opts.onChange;
|
|
130
132
|
this.controlledValue = "value" in opts;
|
|
@@ -151,6 +153,7 @@ var Select = class {
|
|
|
151
153
|
this.trigger.append(this.valueEl, chev);
|
|
152
154
|
this.root.append(this.trigger);
|
|
153
155
|
this.panel = el("div", "qsel-panel");
|
|
156
|
+
this.panel.classList.toggle("is-frosted", this.frosted);
|
|
154
157
|
this.panel.hidden = true;
|
|
155
158
|
this.panel.id = `qsel-panel-${++UID}`;
|
|
156
159
|
this.panel.setAttribute("role", "listbox");
|
|
@@ -422,6 +425,10 @@ var Select = class {
|
|
|
422
425
|
this.syncValue();
|
|
423
426
|
}
|
|
424
427
|
if ("ariaLabel" in patch && patch.ariaLabel !== void 0) this.trigger.setAttribute("aria-label", patch.ariaLabel);
|
|
428
|
+
if ("frosted" in patch && patch.frosted !== void 0) {
|
|
429
|
+
this.frosted = patch.frosted;
|
|
430
|
+
this.panel.classList.toggle("is-frosted", this.frosted);
|
|
431
|
+
}
|
|
425
432
|
}
|
|
426
433
|
/** 程序化选中(等价 update({ value })) */
|
|
427
434
|
setValue(value) {
|
package/dist/index.d.cts
CHANGED
|
@@ -40,6 +40,8 @@ interface SelectOptions {
|
|
|
40
40
|
animate?: boolean;
|
|
41
41
|
/** 错峰动画最大选项数:超过即降级为面板整体淡入(性能/体验保护),0 表示不降级,默认 12 */
|
|
42
42
|
maxStagger?: number;
|
|
43
|
+
/** 面板半透明磨砂质感:半透明底 + backdrop-filter 毛玻璃;false 为不透明实体面板,默认 true */
|
|
44
|
+
frosted?: boolean;
|
|
43
45
|
/** 无障碍标签(trigger aria-label),缺省取 placeholder */
|
|
44
46
|
ariaLabel?: string;
|
|
45
47
|
/** 展开状态变化回调 */
|
|
@@ -59,6 +61,7 @@ declare class Select {
|
|
|
59
61
|
private readonly stagger;
|
|
60
62
|
private readonly animate;
|
|
61
63
|
private readonly maxStagger;
|
|
64
|
+
private frosted;
|
|
62
65
|
private readonly onOpenChangeCb?;
|
|
63
66
|
private readonly onChangeCb?;
|
|
64
67
|
private readonly controlledValue;
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/select.ts"],"mappings":";;UAMiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB,YAAY,sBAAsB,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/select.ts"],"mappings":";;UAMiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB,YAAY,sBAAsB,QAAQ;;;;cClB/B;UAEH;UACA;UACA;UACA;mBACS;mBACA;mBACA;mBACA;mBACA;UACT;mBACS;mBACA;mBAGA;UACT;UAGA;UACA;UACA;UACA;UACA;UAGA;UACA;UACA;UACA;UAGA;UACA;EAER,YAAY,MAAM,aAAa,OAAM;UA4B7B;UAqDA;;UA8BA;UAIA;cAMI;;EAQZ;;EA2BA;;EA+BA;;UAKQ;;UAqCA;UAcA;UAYA;UAiBA;;UA+CA;UAWA;UAIA;UAQA;UAKA;;MAqBJ;;MAKA;;EAKJ,OAAO,OAAO,QAAQ;;EA+BtB,SAAS;;EAKT,YAAY;;EAQZ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -40,6 +40,8 @@ interface SelectOptions {
|
|
|
40
40
|
animate?: boolean;
|
|
41
41
|
/** 错峰动画最大选项数:超过即降级为面板整体淡入(性能/体验保护),0 表示不降级,默认 12 */
|
|
42
42
|
maxStagger?: number;
|
|
43
|
+
/** 面板半透明磨砂质感:半透明底 + backdrop-filter 毛玻璃;false 为不透明实体面板,默认 true */
|
|
44
|
+
frosted?: boolean;
|
|
43
45
|
/** 无障碍标签(trigger aria-label),缺省取 placeholder */
|
|
44
46
|
ariaLabel?: string;
|
|
45
47
|
/** 展开状态变化回调 */
|
|
@@ -59,6 +61,7 @@ declare class Select {
|
|
|
59
61
|
private readonly stagger;
|
|
60
62
|
private readonly animate;
|
|
61
63
|
private readonly maxStagger;
|
|
64
|
+
private frosted;
|
|
62
65
|
private readonly onOpenChangeCb?;
|
|
63
66
|
private readonly onChangeCb?;
|
|
64
67
|
private readonly controlledValue;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/select.ts"],"mappings":";;UAMiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB,YAAY,sBAAsB,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/select.ts"],"mappings":";;UAMiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB,YAAY,sBAAsB,QAAQ;;;;cClB/B;UAEH;UACA;UACA;UACA;mBACS;mBACA;mBACA;mBACA;mBACA;UACT;mBACS;mBACA;mBAGA;UACT;UAGA;UACA;UACA;UACA;UACA;UAGA;UACA;UACA;UACA;UAGA;UACA;EAER,YAAY,MAAM,aAAa,OAAM;UA4B7B;UAqDA;;UA8BA;UAIA;cAMI;;EAQZ;;EA2BA;;EA+BA;;UAKQ;;UAqCA;UAcA;UAYA;UAiBA;;UA+CA;UAWA;UAIA;UAQA;UAKA;;MAqBJ;;MAKA;;EAKJ,OAAO,OAAO,QAAQ;;EA+BtB,SAAS;;EAKT,YAAY;;EAQZ"}
|
package/dist/index.mjs
CHANGED
|
@@ -99,6 +99,7 @@ var Select = class {
|
|
|
99
99
|
stagger;
|
|
100
100
|
animate;
|
|
101
101
|
maxStagger;
|
|
102
|
+
frosted;
|
|
102
103
|
onOpenChangeCb;
|
|
103
104
|
onChangeCb;
|
|
104
105
|
controlledValue;
|
|
@@ -124,6 +125,7 @@ var Select = class {
|
|
|
124
125
|
this.stagger = opts.stagger ?? 28;
|
|
125
126
|
this.animate = opts.animate !== false;
|
|
126
127
|
this.maxStagger = opts.maxStagger ?? 12;
|
|
128
|
+
this.frosted = opts.frosted !== false;
|
|
127
129
|
this.onOpenChangeCb = opts.onOpenChange;
|
|
128
130
|
this.onChangeCb = opts.onChange;
|
|
129
131
|
this.controlledValue = "value" in opts;
|
|
@@ -150,6 +152,7 @@ var Select = class {
|
|
|
150
152
|
this.trigger.append(this.valueEl, chev);
|
|
151
153
|
this.root.append(this.trigger);
|
|
152
154
|
this.panel = el("div", "qsel-panel");
|
|
155
|
+
this.panel.classList.toggle("is-frosted", this.frosted);
|
|
153
156
|
this.panel.hidden = true;
|
|
154
157
|
this.panel.id = `qsel-panel-${++UID}`;
|
|
155
158
|
this.panel.setAttribute("role", "listbox");
|
|
@@ -421,6 +424,10 @@ var Select = class {
|
|
|
421
424
|
this.syncValue();
|
|
422
425
|
}
|
|
423
426
|
if ("ariaLabel" in patch && patch.ariaLabel !== void 0) this.trigger.setAttribute("aria-label", patch.ariaLabel);
|
|
427
|
+
if ("frosted" in patch && patch.frosted !== void 0) {
|
|
428
|
+
this.frosted = patch.frosted;
|
|
429
|
+
this.panel.classList.toggle("is-frosted", this.frosted);
|
|
430
|
+
}
|
|
424
431
|
}
|
|
425
432
|
/** 程序化选中(等价 update({ value })) */
|
|
426
433
|
setValue(value) {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../icon/icons.ts","../src/select.ts"],"sourcesContent":["/* ============================================================\n 青梧 UI · 图标库\n ============================================================\n 零依赖 · 纯字符串常量 · tree-shakeable named exports\n 所有图标统一使用:viewBox=\"0 0 24 24\", stroke=\"currentColor\",\n stroke-width=\"2\", stroke-linecap=\"round\", stroke-linejoin=\"round\".\n\n 使用方式:\n import { ICON_CALENDAR, ICON_SEARCH } from \"@/icon/icons\";\n element.innerHTML = ICON_CALENDAR;\n 或者通过 dangerouslySetInnerHTML 渲染。\n ============================================================ */\n\nconst S = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S16 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S18 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S20 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S36 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"36\" height=\"36\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\n/* ---- 通用 UI 图标 ---- */\n\nexport const ICON_CALENDAR = S(\n '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M8 2v4M16 2v4M3 10h18\"/>',\n);\n\nexport const ICON_CALENDAR_DOT = S(\n '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"/><line x1=\"8\" y1=\"14\" x2=\"8.01\" y2=\"14\"/>',\n);\n\nexport const ICON_SEARCH = S('<circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/>');\n\nexport const ICON_UPLOAD = S(\n '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"17 8 12 3 7 8\"/><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"15\"/>',\n);\n\nexport const ICON_UPLOAD_ARROW = S(\n '<path d=\"M12 16V4\"/><path d=\"m6 9 6-5 6 5\"/><path d=\"M4 20h16\"/>',\n);\n\nexport const ICON_MENU = S('<path d=\"M3 7h18M3 12h18M3 17h18\"/>');\n\nexport const ICON_BELL = S(\n '<path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\"/><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\"/>',\n);\n\nexport const ICON_CLOSE = S(\n '<line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/>',\n);\n\nexport const ICON_CHECK = S('<polyline points=\"20 6 9 17 4 12\"/>');\n\nexport const ICON_PLUS = S(\n '<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>',\n);\n\nexport const ICON_MINUS = S('<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>');\n\nexport const ICON_BOX = S(\n '<path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"/>',\n);\n\nexport const ICON_EDIT = S(\n '<path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/>',\n);\n\nexport const ICON_FILE = S(\n '<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/><polyline points=\"14 2 14 8 20 8\"/>',\n);\n\nexport const ICON_FOLDER = S(\n '<path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"/>',\n);\n\nexport const ICON_INFO = S(\n '<circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/>',\n);\n\nexport const ICON_WARNING = S(\n '<path d=\"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/>',\n);\n\nexport const ICON_TRASH = S(\n '<polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/><line x1=\"10\" y1=\"11\" x2=\"10\" y2=\"17\"/><line x1=\"14\" y1=\"11\" x2=\"14\" y2=\"17\"/>',\n);\n\nexport const ICON_DOWNLOAD = S(\n '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/>',\n);\n\nexport const ICON_COPY = S(\n '<rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/>',\n);\n\nexport const ICON_EYE = S(\n '<path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>',\n);\n\nexport const ICON_STAR = S(\n '<polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/>',\n);\n\nexport const ICON_STAR_FILLED = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" stroke=\"none\" aria-hidden=\"true\"><polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/></svg>`;\n\nexport const ICON_BOOKMARK = S('<path d=\"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z\"/>');\n\nexport const ICON_EXTERNAL_LINK = S(\n '<path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/><polyline points=\"15 3 21 3 21 9\"/><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"/>',\n);\nexport const ICON_GITHUB = S(\n '<path d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\"/><path d=\"M9 18c-4.51 2-5-2-7-2\"/>',\n);\n\n/* ---- 导航箭头 ---- */\n\nexport const ICON_CHEVRON_LEFT = S16('<path d=\"m15 18-6-6 6-6\"/>');\nexport const ICON_CHEVRON_RIGHT = S16('<path d=\"m9 18 6-6-6-6\"/>');\nexport const ICON_CHEVRON_UP = S('<polyline points=\"18 15 12 9 6 15\"/>');\nexport const ICON_CHEVRON_DOWN = S('<polyline points=\"6 9 12 15 18 9\"/>');\nexport const ICON_CODE = S(\n '<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>',\n);\n\n/* ---- 全屏 ---- */\n\nexport const ICON_FULLSCREEN = S(\n '<polyline points=\"15 3 21 3 21 9\"/><polyline points=\"9 21 3 21 3 15\"/><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/>',\n);\nexport const ICON_FULLSCREEN_EXIT = S(\n '<polyline points=\"4 8 4 3 9 3\"/><polyline points=\"20 16 20 21 15 21\"/><line x1=\"4\" y1=\"3\" x2=\"11\" y2=\"10\"/><line x1=\"20\" y1=\"21\" x2=\"13\" y2=\"14\"/>',\n);\n\n/* ---- 功能图标 ---- */\n\nexport const ICON_CLOCK = S('<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 6v6l4 2\"/>');\nexport const ICON_TYPE = S(\n '<polyline points=\"4 7 4 4 20 4 20 7\"/><line x1=\"9\" y1=\"20\" x2=\"15\" y2=\"20\"/><line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\"/>',\n);\nexport const ICON_USERS = S(\n '<path d=\"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M23 21v-2a4 4 0 0 0-3-3.87\"/><path d=\"M16 3.13a4 4 0 0 1 0 7.75\"/>',\n);\nexport const ICON_MICROPHONE = S(\n '<path d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"/><line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"/>',\n);\nexport const ICON_MUSIC = S(\n '<path d=\"M9 18V5l12-2v13\"/><circle cx=\"6\" cy=\"18\" r=\"3\"/><circle cx=\"18\" cy=\"16\" r=\"3\"/>',\n);\nexport const ICON_VIDEO = S(\n '<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\" ry=\"2\"/>',\n);\nexport const ICON_IMAGE = S(\n '<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/>',\n);\n\n/* ---- 主题 ---- */\n\nexport const ICON_SUN = S(\n '<circle cx=\"12\" cy=\"12\" r=\"5\"/><line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"3\"/><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"/><line x1=\"4.22\" y1=\"4.22\" x2=\"5.64\" y2=\"5.64\"/><line x1=\"18.36\" y1=\"18.36\" x2=\"19.78\" y2=\"19.78\"/><line x1=\"1\" y1=\"12\" x2=\"3\" y2=\"12\"/><line x1=\"21\" y1=\"12\" x2=\"23\" y2=\"12\"/><line x1=\"4.22\" y1=\"19.78\" x2=\"5.64\" y2=\"18.36\"/><line x1=\"18.36\" y1=\"5.64\" x2=\"19.78\" y2=\"4.22\"/>',\n);\nexport const ICON_MOON = S('<path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"/>');\n\n/* ---- 侧边栏 ---- */\n\nexport const ICON_SIDEBAR_TOGGLE = S(\n '<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"M9 3v18\"/><path d=\"m14 9-3 3 3 3\"/>',\n);\n\n/* ---- 编辑器图标 ---- */\n\nexport const ICON_LIST = S(\n '<line x1=\"8\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"8\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"8\" y1=\"18\" x2=\"21\" y2=\"18\"/><line x1=\"3\" y1=\"6\" x2=\"3.01\" y2=\"6\"/><line x1=\"3\" y1=\"12\" x2=\"3.01\" y2=\"12\"/><line x1=\"3\" y1=\"18\" x2=\"3.01\" y2=\"18\"/>',\n);\nexport const ICON_AI = S(\n '<path d=\"M12 2l2.4 7.2h7.6l-6 4.8 2.4 7.2-6.4-4.8-6.4 4.8 2.4-7.2-6-4.8h7.6z\"/>',\n);\nexport const ICON_BOLT = S('<polygon points=\"13 2 3 14 12 14 11 22 21 10 12 10 13 2\"/>');\nexport const ICON_REFRESH = S(\n '<polyline points=\"23 4 23 10 17 10\"/><polyline points=\"1 20 1 14 7 14\"/><path d=\"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15\"/>',\n);\nexport const ICON_RETRY = S(\n '<polyline points=\"1 4 1 10 7 10\"/><path d=\"M3.51 15a9 9 0 1 0 2.13-9.36L1 10\"/>',\n);\nexport const ICON_SETTINGS = S(\n '<circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z\"/>',\n);\nexport const ICON_HISTORY = S(\n '<path d=\"M3 3v5h5\"/><path d=\"M3.05 13A9 9 0 1 0 6.11 6.11L3 8\"/><path d=\"M12 7v5l4 2\"/>',\n);\nexport const ICON_PUSH = S(\n '<line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"13\"/><polygon points=\"22 2 15 22 11 13 2 9 22 2\"/>',\n);\nexport const ICON_TRANSLATE = S(\n '<path d=\"M5 8l6 6\"/><path d=\"M4 14l6-6 2-3\"/><path d=\"M2 5h12\"/><path d=\"M7 2h1\"/><path d=\"M22 22l-5-10-5 10\"/><path d=\"M14 18h6\"/>',\n);\nexport const ICON_SUMMARY = S(\n '<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/><polyline points=\"14 2 14 8 20 8\"/><line x1=\"16\" y1=\"13\" x2=\"8\" y2=\"13\"/><line x1=\"16\" y1=\"17\" x2=\"8\" y2=\"17\"/><polyline points=\"10 9 9 9 8 9\"/>',\n);\nexport const ICON_RENAME = S('<path d=\"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z\"/>');\nexport const ICON_SELECTION = S(\n '<circle cx=\"12\" cy=\"12\" r=\"1\"/><path d=\"M20 12a8 8 0 1 1-8-8\"/><path d=\"m16 2 4 4-4 4\"/>',\n);\nexport const ICON_TAG = S(\n '<path d=\"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z\"/><line x1=\"7\" y1=\"7\" x2=\"7.01\" y2=\"7\"/>',\n);\nexport const ICON_GRIP = S(\n '<circle cx=\"9\" cy=\"12\" r=\"1\"/><circle cx=\"15\" cy=\"12\" r=\"1\"/><circle cx=\"9\" cy=\"6\" r=\"1\"/><circle cx=\"15\" cy=\"6\" r=\"1\"/><circle cx=\"9\" cy=\"18\" r=\"1\"/><circle cx=\"15\" cy=\"18\" r=\"1\"/>',\n);\nexport const ICON_DIAGRAM = S(\n '<rect x=\"2\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"14\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"2\" y=\"14\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"8\" height=\"8\" rx=\"1\"/>',\n);\nexport const ICON_LANGUAGE = S(\n '<circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\"/>',\n);\nexport const ICON_PAPERCLIP = S(\n '<path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"/>',\n);\nexport const ICON_BROKEN_IMAGE =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"2\"/><path d=\"M2 14l4-4 4 4 4-4 4 4 4-4\"/><path d=\"M6 6h.01M18 6h.01\"/></svg>';\n\n/* ---- 包级别图标(用于 upload/search/calendar 包) ---- */\n\nexport const ICO_UPLOAD = S36('<path d=\"M12 16V4\"/><path d=\"m6 9 6-5 6 5\"/><path d=\"M4 20h16\"/>');\nconst S18c = (d: string) =>\n `<svg class=\"qs-ico\" xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S20c = (d: string) =>\n `<svg class=\"qw-cal-svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nexport const ICO_SEARCH = S18c('<circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.2-3.2\"/>');\nexport const ICO_MENU = S18('<path d=\"M4 7h16M4 12h16M4 17h16\"/>');\nexport const ICO_CALENDAR = S20c(\n '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M8 2v4M16 2v4M3 10h18\"/>',\n);\nexport const ICO_ARROW_LEFT = S16('<path d=\"m15 18-6-6 6-6\"/>');\nexport const ICO_ARROW_RIGHT = S16('<path d=\"m9 18 6-6-6-6\"/>');\n\n/* ---- 搜索插图(大尺寸 art) ---- */\n\nexport const SEARCH_ART =\n '<svg viewBox=\"0 0 160 140\" role=\"img\" aria-label=\"Search illustration\">' +\n '<ellipse class=\"qs-art-shadow\" cx=\"80\" cy=\"124\" rx=\"46\" ry=\"6\"/>' +\n '<g class=\"qs-art-float\">' +\n '<rect class=\"qs-art-paper\" x=\"40\" y=\"20\" width=\"80\" height=\"82\" rx=\"13\"/>' +\n '<line class=\"qs-art-row-accent\" x1=\"54\" y1=\"42\" x2=\"92\" y2=\"42\"/>' +\n '<line class=\"qs-art-row\" x1=\"54\" y1=\"56\" x2=\"106\" y2=\"56\"/>' +\n '<line class=\"qs-art-row\" x1=\"54\" y1=\"70\" x2=\"84\" y2=\"70\"/>' +\n '<circle class=\"qs-art-glass\" cx=\"96\" cy=\"86\" r=\"23\"/>' +\n '<line class=\"qs-art-handle\" x1=\"113\" y1=\"103\" x2=\"129\" y2=\"119\"/>' +\n '<text class=\"qs-art-seal\" x=\"96\" y=\"94\" text-anchor=\"middle\" font-size=\"24\">寻</text>' +\n \"</g>\" +\n '<circle class=\"qs-art-dot-a qs-art-twinkle\" cx=\"34\" cy=\"32\" r=\"3\"/>' +\n '<circle class=\"qs-art-dot-b qs-art-twinkle\" cx=\"126\" cy=\"40\" r=\"2.6\" style=\"animation-delay:.8s\"/>' +\n '<circle class=\"qs-art-dot-c qs-art-twinkle\" cx=\"30\" cy=\"98\" r=\"2.4\" style=\"animation-delay:1.5s\"/>' +\n \"</svg>\";\n","/* ============================================================\n 青梧UI · 下拉选择器组件(Select)\n - 单选 · 手风琴错峰展开动画 · 选项禁用 · 向上/向下自适应翻转\n - 零框架依赖,纯 DOM + CSS\n - ARIA: combobox / listbox / option + aria-activedescendant\n ============================================================ */\n\nimport { ICON_CHECK, ICON_CHEVRON_DOWN } from \"../../../icon/icons\";\nimport type { SelectOption, SelectOptions } from \"./types\";\n\nconst PREFERS_REDUCED =\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n : false;\n\nconst HTML_ESCAPES: Record<string, string> = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n};\n\nfunction escapeHTML(s: string): string {\n return s.replace(/[&<>\"]/g, (c) => HTML_ESCAPES[c] ?? c);\n}\n\nfunction el(tag: string, cls?: string, html?: string): HTMLElement {\n const n = document.createElement(tag);\n if (cls) n.className = cls;\n if (html != null) n.innerHTML = html;\n return n;\n}\n\nlet UID = 0;\n\n/* ============================================================ */\nexport class Select {\n /* ---- 配置 ---- */\n private root: HTMLElement;\n private options: SelectOption[];\n private placeholder: string;\n private customClass: string;\n private readonly width: \"trigger\" | \"auto\";\n private readonly duration: number;\n private readonly stagger: number;\n private readonly animate: boolean;\n private readonly maxStagger: number;\n private readonly onOpenChangeCb?: (open: boolean) => void;\n private readonly onChangeCb?: (value: string | null, option: SelectOption | null) => void;\n\n /* ---- 受控 / 非受控 ---- */\n private readonly controlledValue: boolean;\n private displayValue: string | null;\n\n /* ---- 运行时状态 ---- */\n private isOpen = false;\n private isDisabled = false;\n private active = -1;\n private dir: \"down\" | \"up\" = \"down\";\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n\n /* ---- DOM 引用 ---- */\n private trigger!: HTMLButtonElement;\n private valueEl!: HTMLElement;\n private list!: HTMLUListElement;\n private panel!: HTMLElement;\n\n /* ---- 监听器 ---- */\n private onDocPointerDown: ((e: PointerEvent) => void) | null = null;\n private onWinScroll: (() => void) | null = null;\n\n constructor(root: HTMLElement, opts: SelectOptions = {}) {\n this.root = root;\n this.options = opts.options ?? [];\n this.placeholder = opts.placeholder ?? \"\";\n this.customClass = opts.className ?? \"\";\n this.width = opts.width ?? \"trigger\";\n this.duration = opts.duration ?? 380;\n this.stagger = opts.stagger ?? 28;\n this.animate = opts.animate !== false;\n this.maxStagger = opts.maxStagger ?? 12;\n this.onOpenChangeCb = opts.onOpenChange;\n this.onChangeCb = opts.onChange;\n\n this.controlledValue = \"value\" in opts;\n this.displayValue = opts.value ?? opts.defaultValue ?? null;\n this.isDisabled = opts.disabled === true;\n\n this.build(opts);\n\n if (opts.open === true || (opts.defaultOpen === true && opts.open == null)) {\n this.open();\n }\n }\n\n /* ============================================================\n Build:一次性创建全部 DOM\n ============================================================ */\n private build(opts: SelectOptions): void {\n const ariaLabel = opts.ariaLabel ?? (this.placeholder || \"请选择\");\n\n this.root.classList.add(\"qsel\");\n if (this.customClass) this.root.classList.add(this.customClass);\n this.root.classList.toggle(\"is-disabled\", this.isDisabled);\n\n /* 触发器 */\n this.trigger = el(\"button\", \"qsel-trigger\") as HTMLButtonElement;\n this.trigger.type = \"button\";\n this.trigger.setAttribute(\"role\", \"combobox\");\n this.trigger.setAttribute(\"aria-haspopup\", \"listbox\");\n this.trigger.setAttribute(\"aria-expanded\", \"false\");\n this.trigger.setAttribute(\"aria-label\", ariaLabel);\n this.trigger.disabled = this.isDisabled;\n\n this.valueEl = el(\"span\", \"qsel-value\");\n const chev = el(\"span\", \"qsel-chevron\", ICON_CHEVRON_DOWN);\n chev.setAttribute(\"aria-hidden\", \"true\");\n this.trigger.append(this.valueEl, chev);\n this.root.append(this.trigger);\n\n /* 面板(挂 body,避免宿主 transform/filter/overflow 裁剪) */\n this.panel = el(\"div\", \"qsel-panel\");\n this.panel.hidden = true;\n this.panel.id = `qsel-panel-${++UID}`;\n this.panel.setAttribute(\"role\", \"listbox\");\n this.panel.setAttribute(\"aria-label\", ariaLabel);\n this.list = el(\"ul\", \"qsel-list\") as HTMLUListElement;\n this.panel.append(this.list);\n document.body.append(this.panel);\n\n this.syncValue();\n this.renderOptions();\n\n this.trigger.addEventListener(\"click\", () => {\n if (this.isDisabled) return;\n this.isOpen ? this.close() : this.open();\n });\n this.trigger.addEventListener(\"keydown\", (e) => this.onTriggerKey(e));\n\n /* 阻止 pointerdown 默认行为:聚焦在触发器上,避免列表抢占焦点破坏 aria-activedescendant */\n this.list.addEventListener(\"pointerdown\", (e) => e.preventDefault());\n this.list.addEventListener(\"click\", (e) => {\n const opt = (e.target as HTMLElement).closest<HTMLElement>(\".qsel-opt\");\n if (opt) this.select(Number(opt.dataset.index));\n });\n }\n\n /* ============================================================\n 渲染\n ============================================================ */\n private renderOptions(): void {\n this.list.textContent = \"\";\n const frag = document.createDocumentFragment();\n const shouldStagger = this.shouldStagger();\n\n this.options.forEach((opt, i) => {\n const li = el(\"li\", \"qsel-opt\");\n li.dataset.index = String(i);\n li.id = `qsel-opt-${i}`;\n li.setAttribute(\"role\", \"option\");\n li.setAttribute(\"aria-selected\", String(opt.value === this.displayValue));\n if (opt.disabled) {\n li.classList.add(\"is-disabled\");\n li.setAttribute(\"aria-disabled\", \"true\");\n }\n if (shouldStagger) li.classList.add(\"is-enter\");\n\n const glyph = opt.glyph ?? opt.label.slice(0, 1);\n li.innerHTML =\n `<span class=\"qsel-opt-ico\">${escapeHTML(glyph)}</span>` +\n `<span class=\"qsel-opt-main\"><span class=\"qsel-opt-label\">${escapeHTML(opt.label)}</span>` +\n (opt.hint ? `<span class=\"qsel-opt-hint\">${escapeHTML(opt.hint)}</span>` : \"\") +\n `</span>` +\n `<span class=\"qsel-check\" aria-hidden=\"true\">${ICON_CHECK}</span>`;\n frag.append(li);\n });\n this.list.append(frag);\n }\n\n /** 是否启用逐项错峰动画(尊重 reduced-motion 与超大列表降级) */\n private shouldStagger(): boolean {\n return this.animate && !PREFERS_REDUCED && this.options.length <= this.maxStagger;\n }\n\n private syncValue(): void {\n const opt = this.currentOption;\n this.valueEl.textContent = opt ? opt.label : this.placeholder;\n this.valueEl.classList.toggle(\"is-placeholder\", !opt);\n }\n\n private get currentOption(): SelectOption | null {\n return this.options.find((o) => o.value === this.displayValue) ?? null;\n }\n\n /* ============================================================\n 展开 / 关闭 / 定位\n ============================================================ */\n /** 打开下拉面板 */\n open(): void {\n if (this.isOpen || this.isDisabled) return;\n this.isOpen = true;\n this.renderOptions();\n\n this.panel.hidden = false;\n this.root.classList.add(\"is-open\");\n this.trigger.setAttribute(\"aria-expanded\", \"true\");\n\n this.position();\n this.setActive(this.startIndex(), false);\n this.applyStagger();\n\n requestAnimationFrame(() => this.panel.classList.add(\"is-open\"));\n\n this.onDocPointerDown = (e) => {\n if (this.isOpen && !this.root.contains(e.target as Node)) this.close();\n };\n document.addEventListener(\"pointerdown\", this.onDocPointerDown);\n this.onWinScroll = () => this.position();\n window.addEventListener(\"scroll\", this.onWinScroll, true);\n window.addEventListener(\"resize\", this.onWinScroll);\n\n this.onOpenChangeCb?.(true);\n }\n\n /** 关闭下拉面板 */\n close(): void {\n if (!this.isOpen) return;\n this.isOpen = false;\n this.root.classList.remove(\"is-open\");\n this.panel.classList.remove(\"is-open\");\n this.trigger.setAttribute(\"aria-expanded\", \"false\");\n this.trigger.removeAttribute(\"aria-activedescendant\");\n this.active = -1;\n\n if (this.onDocPointerDown) {\n document.removeEventListener(\"pointerdown\", this.onDocPointerDown);\n this.onDocPointerDown = null;\n }\n if (this.onWinScroll) {\n window.removeEventListener(\"scroll\", this.onWinScroll, true);\n window.removeEventListener(\"resize\", this.onWinScroll);\n this.onWinScroll = null;\n }\n\n if (this.closeTimer !== null) clearTimeout(this.closeTimer);\n this.closeTimer = setTimeout(\n () => {\n if (!this.isOpen) this.panel.hidden = true;\n },\n PREFERS_REDUCED ? 0 : this.duration,\n );\n\n this.onOpenChangeCb?.(false);\n }\n\n /** 切换展开状态 */\n toggle(): void {\n this.isOpen ? this.close() : this.open();\n }\n\n /** 计算面板位置:宽度跟随触发器、向上/向下翻转、错峰方向随之反向 */\n private position(): void {\n const tr = this.trigger.getBoundingClientRect();\n const gap = 8;\n\n this.panel.style.width = this.width === \"auto\" ? \"max-content\" : `${tr.width}px`;\n if (this.width === \"auto\") {\n this.panel.style.minWidth = `${tr.width}px`;\n }\n\n /* 隐藏态测量:决定展开方向(不闪烁) */\n this.panel.style.visibility = \"hidden\";\n const panelH = this.panel.offsetHeight;\n const panelW = this.panel.offsetWidth;\n const spaceBelow = window.innerHeight - tr.bottom;\n const spaceAbove = tr.top;\n\n const flipUp = spaceBelow - gap < panelH && spaceAbove > spaceBelow;\n this.dir = flipUp ? \"up\" : \"down\";\n this.panel.classList.toggle(\"is-up\", flipUp);\n\n let left = tr.left;\n if (this.width === \"auto\" && panelW > window.innerWidth - 16) {\n left = Math.max(8, window.innerWidth - panelW - 8);\n }\n this.panel.style.left = `${Math.max(8, left)}px`;\n\n if (flipUp) {\n this.panel.style.top = \"auto\";\n this.panel.style.bottom = `${Math.max(8, window.innerHeight - tr.top + gap)}px`;\n } else {\n this.panel.style.top = `${tr.bottom + gap}px`;\n this.panel.style.bottom = \"auto\";\n }\n this.panel.style.visibility = \"\";\n }\n\n /** 错峰动画:按展开方向给每个选项设置递增 / 递减延迟 */\n private applyStagger(): void {\n if (!this.shouldStagger()) return;\n const opts = this.list.querySelectorAll<HTMLElement>(\".qsel-opt.is-enter\");\n const n = opts.length;\n opts.forEach((o, i) => {\n const delay = this.dir === \"up\" ? (n - 1 - i) * this.stagger : i * this.stagger;\n o.style.animationDelay = `${delay}ms`;\n o.style.animationDuration = `${this.duration}ms`;\n });\n }\n\n /* ============================================================\n 选中 / 高亮\n ============================================================ */\n private select(index: number): void {\n const opt = this.options[index];\n if (!opt || opt.disabled) return;\n\n if (!this.controlledValue) {\n this.displayValue = opt.value;\n this.syncValue();\n }\n this.onChangeCb?.(opt.value, opt);\n this.close();\n }\n\n private setActive(idx: number, scroll = true): void {\n const opts = this.list.querySelectorAll<HTMLElement>(\".qsel-opt\");\n if (!opts.length) return;\n this.active = Math.max(0, Math.min(idx, opts.length - 1));\n opts.forEach((o, i) => {\n const on = i === this.active;\n o.classList.toggle(\"is-active\", on);\n if (on) {\n this.trigger.setAttribute(\"aria-activedescendant\", o.id);\n if (scroll) o.scrollIntoView({ block: \"nearest\" });\n }\n });\n }\n\n /* ============================================================\n 键盘导航(焦点保持在触发器,aria-activedescendant 指向列表)\n ============================================================ */\n private onTriggerKey(e: KeyboardEvent): void {\n if (this.isDisabled) return;\n switch (e.key) {\n case \"ArrowDown\":\n e.preventDefault();\n if (!this.isOpen) this.open();\n else this.moveActive(1);\n break;\n case \"ArrowUp\":\n e.preventDefault();\n if (!this.isOpen) this.open();\n else this.moveActive(-1);\n break;\n case \"Home\":\n if (this.isOpen) {\n e.preventDefault();\n this.moveActive(Number.MIN_SAFE_INTEGER);\n }\n break;\n case \"End\":\n if (this.isOpen) {\n e.preventDefault();\n this.moveActive(Number.MAX_SAFE_INTEGER);\n }\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n if (this.isOpen) {\n if (this.active >= 0) this.select(this.active);\n } else {\n this.open();\n }\n break;\n case \"Escape\":\n if (this.isOpen) {\n e.preventDefault();\n this.close();\n }\n break;\n case \"Tab\":\n if (this.isOpen) this.close();\n break;\n }\n }\n\n /** 在可用选项中移动(跳过禁用项,支持环绕) */\n private nextEnabled(from: number, dir: 1 | -1): number {\n const n = this.options.length;\n if (!n) return -1;\n for (let step = 1; step <= n; step++) {\n const i = (from + dir * step + n) % n;\n const o = this.options[i];\n if (o && !o.disabled) return i;\n }\n return -1;\n }\n\n private firstEnabled(): number {\n return this.options.findIndex((o) => !o.disabled);\n }\n\n private lastEnabled(): number {\n for (let i = this.options.length - 1; i >= 0; i--) {\n const o = this.options[i];\n if (o && !o.disabled) return i;\n }\n return -1;\n }\n\n private startIndex(): number {\n const idx = this.options.findIndex((o) => o.value === this.displayValue && !o.disabled);\n return idx >= 0 ? idx : this.firstEnabled();\n }\n\n private moveActive(delta: number): void {\n if (delta === Number.MIN_SAFE_INTEGER) {\n const i = this.firstEnabled();\n if (i >= 0) this.setActive(i);\n return;\n }\n if (delta === Number.MAX_SAFE_INTEGER) {\n const i = this.lastEnabled();\n if (i >= 0) this.setActive(i);\n return;\n }\n const from = this.active < 0 ? this.startIndex() : this.active;\n const next = this.nextEnabled(from, delta > 0 ? 1 : -1);\n if (next >= 0) this.setActive(next);\n }\n\n /* ============================================================\n Public API\n ============================================================ */\n\n /** 当前选中值(无选中为 null) */\n get value(): string | null {\n return this.displayValue;\n }\n\n /** 是否展开 */\n get expanded(): boolean {\n return this.isOpen;\n }\n\n /** 外部同步 / 更新配置。value 同步显示但不触发 onChange(UI 选择才会回调) */\n update(patch: Partial<SelectOptions>): void {\n if (\"options\" in patch && patch.options) {\n this.options = patch.options;\n this.renderOptions();\n this.syncValue();\n }\n if (\"value\" in patch) {\n this.displayValue = patch.value ?? null;\n this.syncValue();\n if (this.isOpen) this.renderOptions();\n }\n if (\"disabled\" in patch && patch.disabled !== undefined) {\n this.setDisabled(patch.disabled);\n }\n if (\"open\" in patch && patch.open !== undefined) {\n patch.open ? this.open() : this.close();\n }\n if (\"placeholder\" in patch && patch.placeholder !== undefined) {\n this.placeholder = patch.placeholder;\n this.syncValue();\n }\n if (\"ariaLabel\" in patch && patch.ariaLabel !== undefined) {\n this.trigger.setAttribute(\"aria-label\", patch.ariaLabel);\n }\n }\n\n /** 程序化选中(等价 update({ value })) */\n setValue(value: string | null): void {\n this.update({ value });\n }\n\n /** 动态切换整体禁用 */\n setDisabled(v: boolean): void {\n this.isDisabled = v;\n this.root.classList.toggle(\"is-disabled\", v);\n this.trigger.disabled = v;\n if (v) this.close();\n }\n\n /** 销毁组件,清空宿主容器并移除 body 上的面板 */\n destroy(): void {\n if (this.closeTimer !== null) clearTimeout(this.closeTimer);\n this.close();\n this.panel.remove();\n this.root.classList.remove(\"qsel\", \"is-open\", \"is-disabled\");\n if (this.customClass) this.root.classList.remove(this.customClass);\n this.root.textContent = \"\";\n }\n}\n"],"mappings":";AAaA,MAAM,KAAK,MACT,2MAA2M,EAAE;AAE/M,MAAM,OAAO,MACX,2MAA2M,EAAE;AAE/M,MAAM,OAAO,MACX,2MAA2M,EAAE;AAK/M,MAAM,OAAO,MACX,6MAA6M,EAAE;AAIpL,EAC3B,gGACF;AAEiC,EAC/B,4PACF;AAE2B,EAAE,qEAA6D;AAE/D,EACzB,2IACF;AAEiC,EAC/B,wEACF;AAEyB,EAAE,uCAAqC;AAEvC,EACvB,qGACF;AAE0B,EACxB,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,QAAQ,WAAW,aAAa;EAC3D,IAAI,KAAK,aAAa,KAAK,KAAK,UAAU,OAAO,KAAK,WAAW;EACjE,KAAK,KAAK,cAAc;CAC1B;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../icon/icons.ts","../src/select.ts"],"sourcesContent":["/* ============================================================\n 青梧 UI · 图标库\n ============================================================\n 零依赖 · 纯字符串常量 · tree-shakeable named exports\n 所有图标统一使用:viewBox=\"0 0 24 24\", stroke=\"currentColor\",\n stroke-width=\"2\", stroke-linecap=\"round\", stroke-linejoin=\"round\".\n\n 使用方式:\n import { ICON_CALENDAR, ICON_SEARCH } from \"@/icon/icons\";\n element.innerHTML = ICON_CALENDAR;\n 或者通过 dangerouslySetInnerHTML 渲染。\n ============================================================ */\n\nconst S = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S16 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S18 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S20 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S36 = (d: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"36\" height=\"36\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\n/* ---- 通用 UI 图标 ---- */\n\nexport const ICON_CALENDAR = S(\n '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M8 2v4M16 2v4M3 10h18\"/>',\n);\n\nexport const ICON_CALENDAR_DOT = S(\n '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"/><line x1=\"8\" y1=\"14\" x2=\"8.01\" y2=\"14\"/>',\n);\n\nexport const ICON_SEARCH = S('<circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/>');\n\nexport const ICON_UPLOAD = S(\n '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"17 8 12 3 7 8\"/><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"15\"/>',\n);\n\nexport const ICON_UPLOAD_ARROW = S(\n '<path d=\"M12 16V4\"/><path d=\"m6 9 6-5 6 5\"/><path d=\"M4 20h16\"/>',\n);\n\nexport const ICON_MENU = S('<path d=\"M3 7h18M3 12h18M3 17h18\"/>');\n\nexport const ICON_BELL = S(\n '<path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\"/><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\"/>',\n);\n\nexport const ICON_CLOSE = S(\n '<line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/>',\n);\n\nexport const ICON_CHECK = S('<polyline points=\"20 6 9 17 4 12\"/>');\n\nexport const ICON_PLUS = S(\n '<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>',\n);\n\nexport const ICON_MINUS = S('<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>');\n\nexport const ICON_BOX = S(\n '<path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"/>',\n);\n\nexport const ICON_EDIT = S(\n '<path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/>',\n);\n\nexport const ICON_FILE = S(\n '<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/><polyline points=\"14 2 14 8 20 8\"/>',\n);\n\nexport const ICON_FOLDER = S(\n '<path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"/>',\n);\n\nexport const ICON_INFO = S(\n '<circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/>',\n);\n\nexport const ICON_WARNING = S(\n '<path d=\"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/>',\n);\n\nexport const ICON_TRASH = S(\n '<polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/><line x1=\"10\" y1=\"11\" x2=\"10\" y2=\"17\"/><line x1=\"14\" y1=\"11\" x2=\"14\" y2=\"17\"/>',\n);\n\nexport const ICON_DOWNLOAD = S(\n '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/>',\n);\n\nexport const ICON_COPY = S(\n '<rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/>',\n);\n\nexport const ICON_EYE = S(\n '<path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>',\n);\n\nexport const ICON_STAR = S(\n '<polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/>',\n);\n\nexport const ICON_STAR_FILLED = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" stroke=\"none\" aria-hidden=\"true\"><polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/></svg>`;\n\nexport const ICON_BOOKMARK = S('<path d=\"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z\"/>');\n\nexport const ICON_EXTERNAL_LINK = S(\n '<path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/><polyline points=\"15 3 21 3 21 9\"/><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"/>',\n);\nexport const ICON_GITHUB = S(\n '<path d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\"/><path d=\"M9 18c-4.51 2-5-2-7-2\"/>',\n);\n\n/* ---- 导航箭头 ---- */\n\nexport const ICON_CHEVRON_LEFT = S16('<path d=\"m15 18-6-6 6-6\"/>');\nexport const ICON_CHEVRON_RIGHT = S16('<path d=\"m9 18 6-6-6-6\"/>');\nexport const ICON_CHEVRON_UP = S('<polyline points=\"18 15 12 9 6 15\"/>');\nexport const ICON_CHEVRON_DOWN = S('<polyline points=\"6 9 12 15 18 9\"/>');\nexport const ICON_CODE = S(\n '<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>',\n);\n\n/* ---- 全屏 ---- */\n\nexport const ICON_FULLSCREEN = S(\n '<polyline points=\"15 3 21 3 21 9\"/><polyline points=\"9 21 3 21 3 15\"/><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/>',\n);\nexport const ICON_FULLSCREEN_EXIT = S(\n '<polyline points=\"4 8 4 3 9 3\"/><polyline points=\"20 16 20 21 15 21\"/><line x1=\"4\" y1=\"3\" x2=\"11\" y2=\"10\"/><line x1=\"20\" y1=\"21\" x2=\"13\" y2=\"14\"/>',\n);\n\n/* ---- 功能图标 ---- */\n\nexport const ICON_CLOCK = S('<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 6v6l4 2\"/>');\nexport const ICON_TYPE = S(\n '<polyline points=\"4 7 4 4 20 4 20 7\"/><line x1=\"9\" y1=\"20\" x2=\"15\" y2=\"20\"/><line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\"/>',\n);\nexport const ICON_USERS = S(\n '<path d=\"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M23 21v-2a4 4 0 0 0-3-3.87\"/><path d=\"M16 3.13a4 4 0 0 1 0 7.75\"/>',\n);\nexport const ICON_MICROPHONE = S(\n '<path d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"/><line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"/>',\n);\nexport const ICON_MUSIC = S(\n '<path d=\"M9 18V5l12-2v13\"/><circle cx=\"6\" cy=\"18\" r=\"3\"/><circle cx=\"18\" cy=\"16\" r=\"3\"/>',\n);\nexport const ICON_VIDEO = S(\n '<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\" ry=\"2\"/>',\n);\nexport const ICON_IMAGE = S(\n '<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/>',\n);\n\n/* ---- 主题 ---- */\n\nexport const ICON_SUN = S(\n '<circle cx=\"12\" cy=\"12\" r=\"5\"/><line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"3\"/><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"/><line x1=\"4.22\" y1=\"4.22\" x2=\"5.64\" y2=\"5.64\"/><line x1=\"18.36\" y1=\"18.36\" x2=\"19.78\" y2=\"19.78\"/><line x1=\"1\" y1=\"12\" x2=\"3\" y2=\"12\"/><line x1=\"21\" y1=\"12\" x2=\"23\" y2=\"12\"/><line x1=\"4.22\" y1=\"19.78\" x2=\"5.64\" y2=\"18.36\"/><line x1=\"18.36\" y1=\"5.64\" x2=\"19.78\" y2=\"4.22\"/>',\n);\nexport const ICON_MOON = S('<path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"/>');\n\n/* ---- 侧边栏 ---- */\n\nexport const ICON_SIDEBAR_TOGGLE = S(\n '<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"M9 3v18\"/><path d=\"m14 9-3 3 3 3\"/>',\n);\n\n/* ---- 编辑器图标 ---- */\n\nexport const ICON_LIST = S(\n '<line x1=\"8\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"8\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"8\" y1=\"18\" x2=\"21\" y2=\"18\"/><line x1=\"3\" y1=\"6\" x2=\"3.01\" y2=\"6\"/><line x1=\"3\" y1=\"12\" x2=\"3.01\" y2=\"12\"/><line x1=\"3\" y1=\"18\" x2=\"3.01\" y2=\"18\"/>',\n);\nexport const ICON_AI = S(\n '<path d=\"M12 2l2.4 7.2h7.6l-6 4.8 2.4 7.2-6.4-4.8-6.4 4.8 2.4-7.2-6-4.8h7.6z\"/>',\n);\nexport const ICON_BOLT = S('<polygon points=\"13 2 3 14 12 14 11 22 21 10 12 10 13 2\"/>');\nexport const ICON_REFRESH = S(\n '<polyline points=\"23 4 23 10 17 10\"/><polyline points=\"1 20 1 14 7 14\"/><path d=\"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15\"/>',\n);\nexport const ICON_RETRY = S(\n '<polyline points=\"1 4 1 10 7 10\"/><path d=\"M3.51 15a9 9 0 1 0 2.13-9.36L1 10\"/>',\n);\nexport const ICON_SETTINGS = S(\n '<circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z\"/>',\n);\nexport const ICON_HISTORY = S(\n '<path d=\"M3 3v5h5\"/><path d=\"M3.05 13A9 9 0 1 0 6.11 6.11L3 8\"/><path d=\"M12 7v5l4 2\"/>',\n);\nexport const ICON_PUSH = S(\n '<line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"13\"/><polygon points=\"22 2 15 22 11 13 2 9 22 2\"/>',\n);\nexport const ICON_TRANSLATE = S(\n '<path d=\"M5 8l6 6\"/><path d=\"M4 14l6-6 2-3\"/><path d=\"M2 5h12\"/><path d=\"M7 2h1\"/><path d=\"M22 22l-5-10-5 10\"/><path d=\"M14 18h6\"/>',\n);\nexport const ICON_SUMMARY = S(\n '<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/><polyline points=\"14 2 14 8 20 8\"/><line x1=\"16\" y1=\"13\" x2=\"8\" y2=\"13\"/><line x1=\"16\" y1=\"17\" x2=\"8\" y2=\"17\"/><polyline points=\"10 9 9 9 8 9\"/>',\n);\nexport const ICON_RENAME = S('<path d=\"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z\"/>');\nexport const ICON_SELECTION = S(\n '<circle cx=\"12\" cy=\"12\" r=\"1\"/><path d=\"M20 12a8 8 0 1 1-8-8\"/><path d=\"m16 2 4 4-4 4\"/>',\n);\nexport const ICON_TAG = S(\n '<path d=\"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z\"/><line x1=\"7\" y1=\"7\" x2=\"7.01\" y2=\"7\"/>',\n);\nexport const ICON_GRIP = S(\n '<circle cx=\"9\" cy=\"12\" r=\"1\"/><circle cx=\"15\" cy=\"12\" r=\"1\"/><circle cx=\"9\" cy=\"6\" r=\"1\"/><circle cx=\"15\" cy=\"6\" r=\"1\"/><circle cx=\"9\" cy=\"18\" r=\"1\"/><circle cx=\"15\" cy=\"18\" r=\"1\"/>',\n);\nexport const ICON_DIAGRAM = S(\n '<rect x=\"2\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"14\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"2\" y=\"14\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"8\" height=\"8\" rx=\"1\"/>',\n);\nexport const ICON_LANGUAGE = S(\n '<circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\"/>',\n);\nexport const ICON_PAPERCLIP = S(\n '<path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"/>',\n);\nexport const ICON_BROKEN_IMAGE =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"2\"/><path d=\"M2 14l4-4 4 4 4-4 4 4 4-4\"/><path d=\"M6 6h.01M18 6h.01\"/></svg>';\n\n/* ---- 包级别图标(用于 upload/search/calendar 包) ---- */\n\nexport const ICO_UPLOAD = S36('<path d=\"M12 16V4\"/><path d=\"m6 9 6-5 6 5\"/><path d=\"M4 20h16\"/>');\nconst S18c = (d: string) =>\n `<svg class=\"qs-ico\" xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nconst S20c = (d: string) =>\n `<svg class=\"qw-cal-svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\n\nexport const ICO_SEARCH = S18c('<circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.2-3.2\"/>');\nexport const ICO_MENU = S18('<path d=\"M4 7h16M4 12h16M4 17h16\"/>');\nexport const ICO_CALENDAR = S20c(\n '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M8 2v4M16 2v4M3 10h18\"/>',\n);\nexport const ICO_ARROW_LEFT = S16('<path d=\"m15 18-6-6 6-6\"/>');\nexport const ICO_ARROW_RIGHT = S16('<path d=\"m9 18 6-6-6-6\"/>');\n\n/* ---- 搜索插图(大尺寸 art) ---- */\n\nexport const SEARCH_ART =\n '<svg viewBox=\"0 0 160 140\" role=\"img\" aria-label=\"Search illustration\">' +\n '<ellipse class=\"qs-art-shadow\" cx=\"80\" cy=\"124\" rx=\"46\" ry=\"6\"/>' +\n '<g class=\"qs-art-float\">' +\n '<rect class=\"qs-art-paper\" x=\"40\" y=\"20\" width=\"80\" height=\"82\" rx=\"13\"/>' +\n '<line class=\"qs-art-row-accent\" x1=\"54\" y1=\"42\" x2=\"92\" y2=\"42\"/>' +\n '<line class=\"qs-art-row\" x1=\"54\" y1=\"56\" x2=\"106\" y2=\"56\"/>' +\n '<line class=\"qs-art-row\" x1=\"54\" y1=\"70\" x2=\"84\" y2=\"70\"/>' +\n '<circle class=\"qs-art-glass\" cx=\"96\" cy=\"86\" r=\"23\"/>' +\n '<line class=\"qs-art-handle\" x1=\"113\" y1=\"103\" x2=\"129\" y2=\"119\"/>' +\n '<text class=\"qs-art-seal\" x=\"96\" y=\"94\" text-anchor=\"middle\" font-size=\"24\">寻</text>' +\n \"</g>\" +\n '<circle class=\"qs-art-dot-a qs-art-twinkle\" cx=\"34\" cy=\"32\" r=\"3\"/>' +\n '<circle class=\"qs-art-dot-b qs-art-twinkle\" cx=\"126\" cy=\"40\" r=\"2.6\" style=\"animation-delay:.8s\"/>' +\n '<circle class=\"qs-art-dot-c qs-art-twinkle\" cx=\"30\" cy=\"98\" r=\"2.4\" style=\"animation-delay:1.5s\"/>' +\n \"</svg>\";\n","/* ============================================================\n 青梧UI · 下拉选择器组件(Select)\n - 单选 · 手风琴错峰展开动画 · 选项禁用 · 向上/向下自适应翻转\n - 零框架依赖,纯 DOM + CSS\n - ARIA: combobox / listbox / option + aria-activedescendant\n ============================================================ */\n\nimport { ICON_CHECK, ICON_CHEVRON_DOWN } from \"../../../icon/icons\";\nimport type { SelectOption, SelectOptions } from \"./types\";\n\nconst PREFERS_REDUCED =\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n : false;\n\nconst HTML_ESCAPES: Record<string, string> = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n};\n\nfunction escapeHTML(s: string): string {\n return s.replace(/[&<>\"]/g, (c) => HTML_ESCAPES[c] ?? c);\n}\n\nfunction el(tag: string, cls?: string, html?: string): HTMLElement {\n const n = document.createElement(tag);\n if (cls) n.className = cls;\n if (html != null) n.innerHTML = html;\n return n;\n}\n\nlet UID = 0;\n\n/* ============================================================ */\nexport class Select {\n /* ---- 配置 ---- */\n private root: HTMLElement;\n private options: SelectOption[];\n private placeholder: string;\n private customClass: string;\n private readonly width: \"trigger\" | \"auto\";\n private readonly duration: number;\n private readonly stagger: number;\n private readonly animate: boolean;\n private readonly maxStagger: number;\n private frosted: boolean;\n private readonly onOpenChangeCb?: (open: boolean) => void;\n private readonly onChangeCb?: (value: string | null, option: SelectOption | null) => void;\n\n /* ---- 受控 / 非受控 ---- */\n private readonly controlledValue: boolean;\n private displayValue: string | null;\n\n /* ---- 运行时状态 ---- */\n private isOpen = false;\n private isDisabled = false;\n private active = -1;\n private dir: \"down\" | \"up\" = \"down\";\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n\n /* ---- DOM 引用 ---- */\n private trigger!: HTMLButtonElement;\n private valueEl!: HTMLElement;\n private list!: HTMLUListElement;\n private panel!: HTMLElement;\n\n /* ---- 监听器 ---- */\n private onDocPointerDown: ((e: PointerEvent) => void) | null = null;\n private onWinScroll: (() => void) | null = null;\n\n constructor(root: HTMLElement, opts: SelectOptions = {}) {\n this.root = root;\n this.options = opts.options ?? [];\n this.placeholder = opts.placeholder ?? \"\";\n this.customClass = opts.className ?? \"\";\n this.width = opts.width ?? \"trigger\";\n this.duration = opts.duration ?? 380;\n this.stagger = opts.stagger ?? 28;\n this.animate = opts.animate !== false;\n this.maxStagger = opts.maxStagger ?? 12;\n this.frosted = opts.frosted !== false;\n this.onOpenChangeCb = opts.onOpenChange;\n this.onChangeCb = opts.onChange;\n\n this.controlledValue = \"value\" in opts;\n this.displayValue = opts.value ?? opts.defaultValue ?? null;\n this.isDisabled = opts.disabled === true;\n\n this.build(opts);\n\n if (opts.open === true || (opts.defaultOpen === true && opts.open == null)) {\n this.open();\n }\n }\n\n /* ============================================================\n Build:一次性创建全部 DOM\n ============================================================ */\n private build(opts: SelectOptions): void {\n const ariaLabel = opts.ariaLabel ?? (this.placeholder || \"请选择\");\n\n this.root.classList.add(\"qsel\");\n if (this.customClass) this.root.classList.add(this.customClass);\n this.root.classList.toggle(\"is-disabled\", this.isDisabled);\n\n /* 触发器 */\n this.trigger = el(\"button\", \"qsel-trigger\") as HTMLButtonElement;\n this.trigger.type = \"button\";\n this.trigger.setAttribute(\"role\", \"combobox\");\n this.trigger.setAttribute(\"aria-haspopup\", \"listbox\");\n this.trigger.setAttribute(\"aria-expanded\", \"false\");\n this.trigger.setAttribute(\"aria-label\", ariaLabel);\n this.trigger.disabled = this.isDisabled;\n\n this.valueEl = el(\"span\", \"qsel-value\");\n const chev = el(\"span\", \"qsel-chevron\", ICON_CHEVRON_DOWN);\n chev.setAttribute(\"aria-hidden\", \"true\");\n this.trigger.append(this.valueEl, chev);\n this.root.append(this.trigger);\n\n /* 面板(挂 body,避免宿主 transform/filter/overflow 裁剪) */\n this.panel = el(\"div\", \"qsel-panel\");\n this.panel.classList.toggle(\"is-frosted\", this.frosted);\n this.panel.hidden = true;\n this.panel.id = `qsel-panel-${++UID}`;\n this.panel.setAttribute(\"role\", \"listbox\");\n this.panel.setAttribute(\"aria-label\", ariaLabel);\n this.list = el(\"ul\", \"qsel-list\") as HTMLUListElement;\n this.panel.append(this.list);\n document.body.append(this.panel);\n\n this.syncValue();\n this.renderOptions();\n\n this.trigger.addEventListener(\"click\", () => {\n if (this.isDisabled) return;\n this.isOpen ? this.close() : this.open();\n });\n this.trigger.addEventListener(\"keydown\", (e) => this.onTriggerKey(e));\n\n /* 阻止 pointerdown 默认行为:聚焦在触发器上,避免列表抢占焦点破坏 aria-activedescendant */\n this.list.addEventListener(\"pointerdown\", (e) => e.preventDefault());\n this.list.addEventListener(\"click\", (e) => {\n const opt = (e.target as HTMLElement).closest<HTMLElement>(\".qsel-opt\");\n if (opt) this.select(Number(opt.dataset.index));\n });\n }\n\n /* ============================================================\n 渲染\n ============================================================ */\n private renderOptions(): void {\n this.list.textContent = \"\";\n const frag = document.createDocumentFragment();\n const shouldStagger = this.shouldStagger();\n\n this.options.forEach((opt, i) => {\n const li = el(\"li\", \"qsel-opt\");\n li.dataset.index = String(i);\n li.id = `qsel-opt-${i}`;\n li.setAttribute(\"role\", \"option\");\n li.setAttribute(\"aria-selected\", String(opt.value === this.displayValue));\n if (opt.disabled) {\n li.classList.add(\"is-disabled\");\n li.setAttribute(\"aria-disabled\", \"true\");\n }\n if (shouldStagger) li.classList.add(\"is-enter\");\n\n const glyph = opt.glyph ?? opt.label.slice(0, 1);\n li.innerHTML =\n `<span class=\"qsel-opt-ico\">${escapeHTML(glyph)}</span>` +\n `<span class=\"qsel-opt-main\"><span class=\"qsel-opt-label\">${escapeHTML(opt.label)}</span>` +\n (opt.hint ? `<span class=\"qsel-opt-hint\">${escapeHTML(opt.hint)}</span>` : \"\") +\n `</span>` +\n `<span class=\"qsel-check\" aria-hidden=\"true\">${ICON_CHECK}</span>`;\n frag.append(li);\n });\n this.list.append(frag);\n }\n\n /** 是否启用逐项错峰动画(尊重 reduced-motion 与超大列表降级) */\n private shouldStagger(): boolean {\n return this.animate && !PREFERS_REDUCED && this.options.length <= this.maxStagger;\n }\n\n private syncValue(): void {\n const opt = this.currentOption;\n this.valueEl.textContent = opt ? opt.label : this.placeholder;\n this.valueEl.classList.toggle(\"is-placeholder\", !opt);\n }\n\n private get currentOption(): SelectOption | null {\n return this.options.find((o) => o.value === this.displayValue) ?? null;\n }\n\n /* ============================================================\n 展开 / 关闭 / 定位\n ============================================================ */\n /** 打开下拉面板 */\n open(): void {\n if (this.isOpen || this.isDisabled) return;\n this.isOpen = true;\n this.renderOptions();\n\n this.panel.hidden = false;\n this.root.classList.add(\"is-open\");\n this.trigger.setAttribute(\"aria-expanded\", \"true\");\n\n this.position();\n this.setActive(this.startIndex(), false);\n this.applyStagger();\n\n requestAnimationFrame(() => this.panel.classList.add(\"is-open\"));\n\n this.onDocPointerDown = (e) => {\n if (this.isOpen && !this.root.contains(e.target as Node)) this.close();\n };\n document.addEventListener(\"pointerdown\", this.onDocPointerDown);\n this.onWinScroll = () => this.position();\n window.addEventListener(\"scroll\", this.onWinScroll, true);\n window.addEventListener(\"resize\", this.onWinScroll);\n\n this.onOpenChangeCb?.(true);\n }\n\n /** 关闭下拉面板 */\n close(): void {\n if (!this.isOpen) return;\n this.isOpen = false;\n this.root.classList.remove(\"is-open\");\n this.panel.classList.remove(\"is-open\");\n this.trigger.setAttribute(\"aria-expanded\", \"false\");\n this.trigger.removeAttribute(\"aria-activedescendant\");\n this.active = -1;\n\n if (this.onDocPointerDown) {\n document.removeEventListener(\"pointerdown\", this.onDocPointerDown);\n this.onDocPointerDown = null;\n }\n if (this.onWinScroll) {\n window.removeEventListener(\"scroll\", this.onWinScroll, true);\n window.removeEventListener(\"resize\", this.onWinScroll);\n this.onWinScroll = null;\n }\n\n if (this.closeTimer !== null) clearTimeout(this.closeTimer);\n this.closeTimer = setTimeout(\n () => {\n if (!this.isOpen) this.panel.hidden = true;\n },\n PREFERS_REDUCED ? 0 : this.duration,\n );\n\n this.onOpenChangeCb?.(false);\n }\n\n /** 切换展开状态 */\n toggle(): void {\n this.isOpen ? this.close() : this.open();\n }\n\n /** 计算面板位置:宽度跟随触发器、向上/向下翻转、错峰方向随之反向 */\n private position(): void {\n const tr = this.trigger.getBoundingClientRect();\n const gap = 8;\n\n this.panel.style.width = this.width === \"auto\" ? \"max-content\" : `${tr.width}px`;\n if (this.width === \"auto\") {\n this.panel.style.minWidth = `${tr.width}px`;\n }\n\n /* 隐藏态测量:决定展开方向(不闪烁) */\n this.panel.style.visibility = \"hidden\";\n const panelH = this.panel.offsetHeight;\n const panelW = this.panel.offsetWidth;\n const spaceBelow = window.innerHeight - tr.bottom;\n const spaceAbove = tr.top;\n\n const flipUp = spaceBelow - gap < panelH && spaceAbove > spaceBelow;\n this.dir = flipUp ? \"up\" : \"down\";\n this.panel.classList.toggle(\"is-up\", flipUp);\n\n let left = tr.left;\n if (this.width === \"auto\" && panelW > window.innerWidth - 16) {\n left = Math.max(8, window.innerWidth - panelW - 8);\n }\n this.panel.style.left = `${Math.max(8, left)}px`;\n\n if (flipUp) {\n this.panel.style.top = \"auto\";\n this.panel.style.bottom = `${Math.max(8, window.innerHeight - tr.top + gap)}px`;\n } else {\n this.panel.style.top = `${tr.bottom + gap}px`;\n this.panel.style.bottom = \"auto\";\n }\n this.panel.style.visibility = \"\";\n }\n\n /** 错峰动画:按展开方向给每个选项设置递增 / 递减延迟 */\n private applyStagger(): void {\n if (!this.shouldStagger()) return;\n const opts = this.list.querySelectorAll<HTMLElement>(\".qsel-opt.is-enter\");\n const n = opts.length;\n opts.forEach((o, i) => {\n const delay = this.dir === \"up\" ? (n - 1 - i) * this.stagger : i * this.stagger;\n o.style.animationDelay = `${delay}ms`;\n o.style.animationDuration = `${this.duration}ms`;\n });\n }\n\n /* ============================================================\n 选中 / 高亮\n ============================================================ */\n private select(index: number): void {\n const opt = this.options[index];\n if (!opt || opt.disabled) return;\n\n if (!this.controlledValue) {\n this.displayValue = opt.value;\n this.syncValue();\n }\n this.onChangeCb?.(opt.value, opt);\n this.close();\n }\n\n private setActive(idx: number, scroll = true): void {\n const opts = this.list.querySelectorAll<HTMLElement>(\".qsel-opt\");\n if (!opts.length) return;\n this.active = Math.max(0, Math.min(idx, opts.length - 1));\n opts.forEach((o, i) => {\n const on = i === this.active;\n o.classList.toggle(\"is-active\", on);\n if (on) {\n this.trigger.setAttribute(\"aria-activedescendant\", o.id);\n if (scroll) o.scrollIntoView({ block: \"nearest\" });\n }\n });\n }\n\n /* ============================================================\n 键盘导航(焦点保持在触发器,aria-activedescendant 指向列表)\n ============================================================ */\n private onTriggerKey(e: KeyboardEvent): void {\n if (this.isDisabled) return;\n switch (e.key) {\n case \"ArrowDown\":\n e.preventDefault();\n if (!this.isOpen) this.open();\n else this.moveActive(1);\n break;\n case \"ArrowUp\":\n e.preventDefault();\n if (!this.isOpen) this.open();\n else this.moveActive(-1);\n break;\n case \"Home\":\n if (this.isOpen) {\n e.preventDefault();\n this.moveActive(Number.MIN_SAFE_INTEGER);\n }\n break;\n case \"End\":\n if (this.isOpen) {\n e.preventDefault();\n this.moveActive(Number.MAX_SAFE_INTEGER);\n }\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n if (this.isOpen) {\n if (this.active >= 0) this.select(this.active);\n } else {\n this.open();\n }\n break;\n case \"Escape\":\n if (this.isOpen) {\n e.preventDefault();\n this.close();\n }\n break;\n case \"Tab\":\n if (this.isOpen) this.close();\n break;\n }\n }\n\n /** 在可用选项中移动(跳过禁用项,支持环绕) */\n private nextEnabled(from: number, dir: 1 | -1): number {\n const n = this.options.length;\n if (!n) return -1;\n for (let step = 1; step <= n; step++) {\n const i = (from + dir * step + n) % n;\n const o = this.options[i];\n if (o && !o.disabled) return i;\n }\n return -1;\n }\n\n private firstEnabled(): number {\n return this.options.findIndex((o) => !o.disabled);\n }\n\n private lastEnabled(): number {\n for (let i = this.options.length - 1; i >= 0; i--) {\n const o = this.options[i];\n if (o && !o.disabled) return i;\n }\n return -1;\n }\n\n private startIndex(): number {\n const idx = this.options.findIndex((o) => o.value === this.displayValue && !o.disabled);\n return idx >= 0 ? idx : this.firstEnabled();\n }\n\n private moveActive(delta: number): void {\n if (delta === Number.MIN_SAFE_INTEGER) {\n const i = this.firstEnabled();\n if (i >= 0) this.setActive(i);\n return;\n }\n if (delta === Number.MAX_SAFE_INTEGER) {\n const i = this.lastEnabled();\n if (i >= 0) this.setActive(i);\n return;\n }\n const from = this.active < 0 ? this.startIndex() : this.active;\n const next = this.nextEnabled(from, delta > 0 ? 1 : -1);\n if (next >= 0) this.setActive(next);\n }\n\n /* ============================================================\n Public API\n ============================================================ */\n\n /** 当前选中值(无选中为 null) */\n get value(): string | null {\n return this.displayValue;\n }\n\n /** 是否展开 */\n get expanded(): boolean {\n return this.isOpen;\n }\n\n /** 外部同步 / 更新配置。value 同步显示但不触发 onChange(UI 选择才会回调) */\n update(patch: Partial<SelectOptions>): void {\n if (\"options\" in patch && patch.options) {\n this.options = patch.options;\n this.renderOptions();\n this.syncValue();\n }\n if (\"value\" in patch) {\n this.displayValue = patch.value ?? null;\n this.syncValue();\n if (this.isOpen) this.renderOptions();\n }\n if (\"disabled\" in patch && patch.disabled !== undefined) {\n this.setDisabled(patch.disabled);\n }\n if (\"open\" in patch && patch.open !== undefined) {\n patch.open ? this.open() : this.close();\n }\n if (\"placeholder\" in patch && patch.placeholder !== undefined) {\n this.placeholder = patch.placeholder;\n this.syncValue();\n }\n if (\"ariaLabel\" in patch && patch.ariaLabel !== undefined) {\n this.trigger.setAttribute(\"aria-label\", patch.ariaLabel);\n }\n if (\"frosted\" in patch && patch.frosted !== undefined) {\n this.frosted = patch.frosted;\n this.panel.classList.toggle(\"is-frosted\", this.frosted);\n }\n }\n\n /** 程序化选中(等价 update({ value })) */\n setValue(value: string | null): void {\n this.update({ value });\n }\n\n /** 动态切换整体禁用 */\n setDisabled(v: boolean): void {\n this.isDisabled = v;\n this.root.classList.toggle(\"is-disabled\", v);\n this.trigger.disabled = v;\n if (v) this.close();\n }\n\n /** 销毁组件,清空宿主容器并移除 body 上的面板 */\n destroy(): void {\n if (this.closeTimer !== null) clearTimeout(this.closeTimer);\n this.close();\n this.panel.remove();\n this.root.classList.remove(\"qsel\", \"is-open\", \"is-disabled\");\n if (this.customClass) this.root.classList.remove(this.customClass);\n this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AI,eAAe,SAAS,MAAM,cAAc,KAAA,GAC9C,KAAK,QAAQ,aAAa,cAAc,MAAM,SAAS;EAEzD,IAAI,aAAa,SAAS,MAAM,YAAY,KAAA,GAAW;GACrD,KAAK,UAAU,MAAM;GACrB,KAAK,MAAM,UAAU,OAAO,cAAc,KAAK,OAAO;EACxD;CACF;;CAGA,SAAS,OAA4B;EACnC,KAAK,OAAO,EAAE,MAAM,CAAC;CACvB;;CAGA,YAAY,GAAkB;EAC5B,KAAK,aAAa;EAClB,KAAK,KAAK,UAAU,OAAO,eAAe,CAAC;EAC3C,KAAK,QAAQ,WAAW;EACxB,IAAI,GAAG,KAAK,MAAM;CACpB;;CAGA,UAAgB;EACd,IAAI,KAAK,eAAe,MAAM,aAAa,KAAK,UAAU;EAC1D,KAAK,MAAM;EACX,KAAK,MAAM,OAAO;EAClB,KAAK,KAAK,UAAU,OAAO,QAAQ,WAAW,aAAa;EAC3D,IAAI,KAAK,aAAa,KAAK,KAAK,UAAU,OAAO,KAAK,WAAW;EACjE,KAAK,KAAK,cAAc;CAC1B;AACF"}
|
package/dist/style.css
CHANGED
|
@@ -168,6 +168,12 @@
|
|
|
168
168
|
.qsel-panel.is-up.is-open {
|
|
169
169
|
transform: translateY(0) scale(1);
|
|
170
170
|
}
|
|
171
|
+
/* 半透明磨砂:默认开启(构造时挂 is-frosted)。关闭时回退为上方不透明实体面板 */
|
|
172
|
+
.qsel-panel.is-frosted {
|
|
173
|
+
background: color-mix(in srgb, var(--qsel-card) 72%, transparent);
|
|
174
|
+
-webkit-backdrop-filter: blur(20px) saturate(140%);
|
|
175
|
+
backdrop-filter: blur(20px) saturate(140%);
|
|
176
|
+
}
|
|
171
177
|
|
|
172
178
|
/* ============================================================
|
|
173
179
|
⑤ 选项列表
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qingwu-ui/select",
|
|
3
|
-
"version": "0.9.0-beta",
|
|
3
|
+
"version": "0.9.0-beta.1",
|
|
4
4
|
"description": "Framework-agnostic dropdown select for Qingwu UI — single-select, accordion stagger open animation, disabled options, zero dependencies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|