@linxin666/dsh-liangshen 0.3.23 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +45 -38
  3. package/README.zh.md +44 -37
  4. package/lib/client.js +1058 -11
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +105 -22
  7. package/lib/types/client/LiangShenSettingsCard.d.ts +61 -0
  8. package/lib/types/client/PluginSettingsCard.d.ts +133 -0
  9. package/lib/types/client/index.d.ts +34 -0
  10. package/lib/types/client/locales.d.ts +27 -1
  11. package/lib/types/client/plugin-card-seat.d.ts +96 -0
  12. package/lib/types/client/settings-form.d.ts +197 -0
  13. package/lib/types/core/lever.d.ts +6 -3
  14. package/lib/types/index.d.ts +23 -11
  15. package/lib/types/sync.d.ts +29 -2
  16. package/package.json +6 -2
  17. package/presets/liangshen/NOTICE +4 -4
  18. package/presets/liangshen/agent.cordis.yml +130 -119
  19. package/presets/liangshen/minimal-prompt.mjs +71 -36
  20. package/presets/liangshen/paging.mjs +232 -0
  21. package/presets/liangshen/tool-activate.mjs +176 -0
  22. package/presets/liangshen/tool-catalog.mjs +610 -218
  23. package/presets/liangshen/working-context.mjs +214 -0
  24. package/src/client/LiangShenLever.tsx +4 -1
  25. package/src/client/LiangShenSettingsCard.tsx +149 -0
  26. package/src/client/PluginSettingsCard.tsx +550 -0
  27. package/src/client/index.ts +60 -1
  28. package/src/client/locales.ts +53 -1
  29. package/src/client/plugin-card-seat.ts +185 -0
  30. package/src/client/settings-card.module.css +418 -0
  31. package/src/client/settings-form.ts +439 -0
  32. package/src/core/lever.ts +7 -4
  33. package/src/index.ts +35 -14
  34. package/src/sync.test.ts +86 -7
  35. package/src/sync.ts +108 -6
  36. package/tools/benchmark-live-run.mjs +24 -33
  37. package/presets/liangshen/custom-bash.mjs +0 -213
@@ -21,6 +21,32 @@ export const zh = {
21
21
  'lever.failed.failed': '切换失败:{reason}',
22
22
  'burst.line1': '三秒,三辈子的代码',
23
23
  'burst.line2': '文言文 · 二进制 · 摩斯电码',
24
+ 'settings.title': '梁神模式',
25
+ 'settings.description': '控制本插件与工具面呈现方式。',
26
+ 'settings.enabled': '启用梁神模式',
27
+ 'settings.enabledHint': '关闭后预设同步与 agent 公告都不执行。',
28
+ 'settings.announceToAgent': '向 agent 公告本插件',
29
+ 'settings.announceToAgentHint': '开启后向每一轮 agent 系统提示注入本插件公告;默认关闭以保持提示词干净。',
30
+ 'settings.presentation': '工具面呈现方式',
31
+ 'settings.presentationHint': '写入同步后的预设:ptc 把 wire 收拢为 run_code;native 保持原生工具清单;both 让两者同驻。改动需重启 DSH 生效。',
32
+ 'settings.on': '开',
33
+ 'settings.off': '关',
34
+ 'settings.inherit': '继承(跟随部署默认)',
35
+ 'settings.overridden': '已覆盖',
36
+ 'settings.reset': '重置',
37
+ 'settings.notExposed': '当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 ~/.dsh/settings.yaml 直接配置,或将本命名空间加入 Host 设置白名单后重启。',
38
+ 'settings.readOnly': '当前部署的设置只读。',
39
+ 'settings.expand': '展开设置',
40
+ 'settings.collapse': '收起设置',
41
+ 'settings.save': '保存',
42
+ 'settings.saving': '保存中…',
43
+ 'settings.discard': '放弃',
44
+ 'settings.unsaved': '未保存',
45
+ 'settings.saveFailed': '部署未接受这些值,已保留供你修改。',
46
+ 'settings.invalidValue': '该取值不被接受',
47
+ 'presentation.ptc': 'ptc(仅 run_code)',
48
+ 'presentation.native': 'native(原生工具清单)',
49
+ 'presentation.both': 'both(两者同驻)',
24
50
  }
25
51
 
26
52
  /** English counterpart; the key set mirrors {@link zh} exactly. */
@@ -40,7 +66,33 @@ export const en: Record<keyof typeof zh, string> = {
40
66
  'lever.failed.failed': 'Switch failed: {reason}',
41
67
  'burst.line1': 'Three seconds, three lifetimes of code',
42
68
  'burst.line2': 'Classical Chinese · Binary · Morse code',
69
+ 'settings.title': 'LiangShen mode',
70
+ 'settings.description': 'Controls this plugin and the wire presentation.',
71
+ 'settings.enabled': 'Enable LiangShen mode',
72
+ 'settings.enabledHint': 'When off, neither preset sync nor the agent announcement runs.',
73
+ 'settings.announceToAgent': 'Announce this plugin to agents',
74
+ 'settings.announceToAgentHint': 'Adds this plugin announcement to every agent system prompt; off by default so prompts stay clean.',
75
+ 'settings.presentation': 'Wire presentation',
76
+ 'settings.presentationHint': 'Written into the synced preset: ptc collapses the wire to run_code; native keeps the native roster; both keeps them co-resident. Restart DSH for a change to take effect.',
77
+ 'settings.on': 'On',
78
+ 'settings.off': 'Off',
79
+ 'settings.inherit': 'Inherit (deployment default)',
80
+ 'settings.overridden': 'Overridden',
81
+ 'settings.reset': 'Reset',
82
+ 'settings.notExposed': "This DSH version does not expose this plugin's settings namespace to the configuration page, so the form is unavailable. Edit ~/.dsh/settings.yaml directly, or add the namespace to the Host settings allowlist and restart.",
83
+ 'settings.readOnly': 'This deployment serves settings read-only.',
84
+ 'settings.expand': 'Show settings',
85
+ 'settings.collapse': 'Hide settings',
86
+ 'settings.save': 'Save',
87
+ 'settings.saving': 'Saving…',
88
+ 'settings.discard': 'Discard',
89
+ 'settings.unsaved': 'Unsaved',
90
+ 'settings.saveFailed': 'The deployment did not accept these values; they were left for you to correct.',
91
+ 'settings.invalidValue': 'The value is not accepted',
92
+ 'presentation.ptc': 'ptc (run_code only)',
93
+ 'presentation.native': 'native (native tool roster)',
94
+ 'presentation.both': 'both (both co-resident)',
43
95
  }
44
96
 
45
- /** One lever copy key. */
97
+ /** Every key in the locale catalog. */
46
98
  export type LiangShenKey = keyof typeof zh
@@ -0,0 +1,185 @@
1
+ // Generated by scripts/sync-shared.mjs from shared/client/settings/plugin-card-seat.ts. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
2
+ /**
3
+ * Family plugin-card seat.
4
+ *
5
+ * A family plugin contributes its settings card to whichever plugin-card seat
6
+ * the running host actually renders:
7
+ *
8
+ * - `web-ui.plugin.item` — the list seat declared by the dsh-web-settings
9
+ * group section (this family's own first-level "Web UI plugins" section);
10
+ * - `settings.plugin.item` — the official keyed seat of the harness's
11
+ * `ui-settings-plugins` tab, keyed by the settings namespace the card edits.
12
+ *
13
+ * SEAT SELECTION IS NOT A DECLARATION PROBE. The official `ui-settings-plugins`
14
+ * row belongs to the harness bundle and its `configurable` tab always declares
15
+ * `settings.plugin.item` before any external plugin's `apply()` runs, so
16
+ * "is the official seat declared?" answers yes even in the deployment whose
17
+ * whole point is the family group. Choosing on that probe sends every family
18
+ * card to the official Plugins tab and leaves the group's own section
19
+ * permanently empty — the family of reports where the section renders its
20
+ * heading and zero cards.
21
+ *
22
+ * The signal that actually distinguishes the two deployments is whether
23
+ * dsh-web-settings is loaded: it is the package that owns the group section and
24
+ * it publishes the `webUiSettings` service during `apply()`, which every
25
+ * family plugin already reads for its settings scope. Group loaded -> the family
26
+ * seat; group absent -> the official seat.
27
+ *
28
+ * The decision is re-evaluated on every `slots/changed` because the group may
29
+ * apply after this plugin (the family aggregate orders it first, a profile that
30
+ * installs the group separately need not): the initial contribution goes to the
31
+ * official seat, then moves to the family seat the moment the group's section
32
+ * registers. The entry is disposed before the replacement is registered, so a
33
+ * card is never in two seats at once.
34
+ *
35
+ * The shared tree has no client-SDK dependency, so this module reads its
36
+ * context through the structural shape below; callers pass the plugin's own
37
+ * `ctx`.
38
+ */
39
+
40
+ /** The family list seat key. */
41
+ export const FAMILY_PLUGIN_CARD_SEAT = 'web-ui.plugin.item'
42
+
43
+ /** The official keyed plugin-card seat key. */
44
+ export const OFFICIAL_PLUGIN_CARD_SEAT = 'settings.plugin.item'
45
+
46
+ /** The service dsh-web-settings publishes while it is loaded. */
47
+ export const FAMILY_GROUP_SERVICE = 'webUiSettings'
48
+
49
+ /** The slot-registry member this helper uses (structurally satisfied by ctx.slots). */
50
+ export interface PluginCardSlots {
51
+ /** Contribution of one card entry. */
52
+ register(options: never, component: never): unknown
53
+ }
54
+
55
+ /** The slice of the client context a card contribution needs. */
56
+ export interface PluginCardContext {
57
+ slots: PluginCardSlots
58
+ /** Service lookup; absent on a context double that only models the slots. */
59
+ get?(name: string): unknown
60
+ /** Event subscription seat; absent on an event-less test double. */
61
+ on?(event: string, listener: (...args: never[]) => void): unknown
62
+ }
63
+
64
+ /** Owner share of a plugin card (both seats supply nothing). */
65
+ export interface SettingsPluginItemOwnerProps {
66
+ /** Marker field: card owner props are intentionally empty. */
67
+ children?: never
68
+ }
69
+
70
+ /** One family plugin's card contribution. */
71
+ export interface PluginCardSeat {
72
+ /** Settings namespace the card edits (the official seat's dispatch key). */
73
+ namespace: string
74
+ /** Family list-seat entry id. */
75
+ id: string
76
+ /** Family list-seat sort order. */
77
+ order?: number
78
+ /** Family list-seat display label; the official keyed seat carries none. */
79
+ label?: () => string
80
+ /** Locale namespace the card renders with. */
81
+ locale: string
82
+ /** Business-face factory of the registration. */
83
+ inject?: () => object
84
+ /**
85
+ * The card component. Its props type is the seat's composed shape, which is
86
+ * chosen at runtime, so the helper takes it erased; the registrant keeps its
87
+ * own precise typing at the call site.
88
+ */
89
+ component: unknown
90
+ }
91
+
92
+ /**
93
+ * Whether the family group (dsh-web-settings) is loaded in this page. The
94
+ * service is the group package's own contract, so the probe cannot be fooled
95
+ * by a harness release that starts declaring the official seat differently.
96
+ */
97
+ export function familyGroupLoaded(ctx: PluginCardContext): boolean {
98
+ const get = ctx.get
99
+ if (typeof get !== 'function') return false
100
+ try {
101
+ return get.call(ctx, FAMILY_GROUP_SERVICE) !== undefined
102
+ } catch {
103
+ // A context that refuses the lookup: treat the group as absent, which
104
+ // falls back to the official seat the harness declares.
105
+ return false
106
+ }
107
+ }
108
+
109
+ /** Report a refused registration instead of leaving the user with no card. */
110
+ function warnRefusedSeat(seat: string, error: unknown): void {
111
+ try {
112
+ console.warn(`[dsh-web] plugin card registration into "${seat}" was refused; the card will not render`, error)
113
+ } catch {
114
+ // Best-effort console write; a failed warning must not break the plugin.
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Contribute one family plugin card to the seat this host renders, following
120
+ * the group if it loads later. The entry is disposed and re-registered on a
121
+ * seat change, never duplicated.
122
+ * @param ctx - client context (its slot registry decides the seat).
123
+ * @param seat - the card contribution.
124
+ */
125
+ export function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat): void {
126
+ const slots = ctx.slots
127
+ const component = seat.component as never
128
+ const inject = seat.inject as never
129
+
130
+ let dispose: (() => void) | undefined
131
+ let current: string | undefined
132
+ /**
133
+ * Re-entrancy latch. The registry emits a change event synchronously from
134
+ * inside both `register` and the previous entry's disposer, so an unguarded
135
+ * reconcile would re-enter itself mid-move and register the card twice into
136
+ * the seat it is leaving ("already has an entry for key ...").
137
+ */
138
+ let reconciling = false
139
+
140
+ /** Reconcile the contribution with the currently live seat (no-op when unchanged). */
141
+ const reconcile = (): void => {
142
+ if (reconciling) return
143
+ const target = familyGroupLoaded(ctx) ? FAMILY_PLUGIN_CARD_SEAT : OFFICIAL_PLUGIN_CARD_SEAT
144
+ if (current === target) return
145
+ reconciling = true
146
+ const previous = dispose
147
+ dispose = undefined
148
+ current = undefined
149
+ previous?.()
150
+ try {
151
+ dispose = slots.register((target === FAMILY_PLUGIN_CARD_SEAT
152
+ ? {
153
+ name: FAMILY_PLUGIN_CARD_SEAT,
154
+ id: seat.id,
155
+ ...(seat.order === undefined ? {} : { order: seat.order }),
156
+ ...(seat.label === undefined ? {} : { label: seat.label }),
157
+ locale: seat.locale,
158
+ ...(seat.inject === undefined ? {} : { inject }),
159
+ }
160
+ : {
161
+ name: OFFICIAL_PLUGIN_CARD_SEAT,
162
+ key: seat.namespace,
163
+ locale: seat.locale,
164
+ ...(seat.inject === undefined ? {} : { inject }),
165
+ }) as never, component) as () => void
166
+ current = target
167
+ } catch (error) {
168
+ warnRefusedSeat(target, error)
169
+ } finally {
170
+ reconciling = false
171
+ }
172
+ }
173
+
174
+ if (typeof ctx.on === 'function') {
175
+ try {
176
+ ctx.on('slots/changed', () => { reconcile() })
177
+ } catch {
178
+ // An event seat that refuses the subscription leaves the initial
179
+ // decision in place; the card still renders in the seat chosen below.
180
+ }
181
+ }
182
+ // The initial decision: the group, when it is already loaded (the aggregate
183
+ // order), otherwise the official seat the harness declares.
184
+ reconcile()
185
+ }
@@ -0,0 +1,418 @@
1
+ /* Generated by scripts/sync-shared.mjs from shared/client/settings/settings-card.module.css. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs". */
2
+ /* Plugin settings card chrome + staged form fields.
3
+ * Aligned with the official ui-settings-plugins PluginCard / fields CSS:
4
+ * same semantic tokens, radius, typography and states so family cards read
5
+ * as siblings of the built-in Shell / Agent loop / Web search cards. */
6
+
7
+ .card {
8
+ border: 1px solid var(--dsw-alias-border-l2);
9
+ background: var(--dsw-alias-bg-layer-3);
10
+ border-radius: 12px;
11
+ list-style: none;
12
+ transition: border-color 0.16s, background 0.16s;
13
+ }
14
+
15
+ .card:hover {
16
+ border-color: var(--dsw-alias-label-dimmed);
17
+ }
18
+
19
+ .cardOpen {
20
+ background: var(--dsw-alias-bg-layer-2);
21
+ border-color: var(--dsw-alias-label-dimmed);
22
+ }
23
+
24
+ .header {
25
+ appearance: none;
26
+ width: 100%;
27
+ /* The suite does not force a global border-box, so width:100% + padding
28
+ would stretch the row 32px past the card and push the trailing pending
29
+ badge (last flex item) outside the card border. */
30
+ box-sizing: border-box;
31
+ font: inherit;
32
+ color: inherit;
33
+ text-align: left;
34
+ cursor: pointer;
35
+ background: transparent;
36
+ border: 0;
37
+ border-radius: 12px;
38
+ align-items: center;
39
+ gap: 12px;
40
+ padding: 14px 16px;
41
+ display: flex;
42
+ }
43
+
44
+ .header:focus-visible {
45
+ outline: 2px solid var(--dsw-alias-brand-primary);
46
+ outline-offset: -2px;
47
+ }
48
+
49
+ .headerStatic {
50
+ width: 100%;
51
+ box-sizing: border-box;
52
+ border-radius: 12px;
53
+ align-items: center;
54
+ gap: 12px;
55
+ padding: 14px 16px;
56
+ display: flex;
57
+ }
58
+
59
+ .headText {
60
+ flex-direction: column;
61
+ flex: 1;
62
+ gap: 4px;
63
+ min-width: 0;
64
+ display: flex;
65
+ }
66
+
67
+ .name {
68
+ color: var(--dsw-alias-label-primary);
69
+ font-size: 15px;
70
+ font-weight: 600;
71
+ line-height: 1.4;
72
+ }
73
+
74
+ .description {
75
+ /* Secondary, not tertiary: skins whose tertiary token is tuned for large
76
+ print leave 12-13px hint text below readable contrast (orca-link #778399
77
+ on cream measures ~3.4:1). */
78
+ color: var(--dsw-alias-label-secondary);
79
+ font-size: 13px;
80
+ line-height: 1.5;
81
+ }
82
+
83
+ .pending {
84
+ white-space: nowrap;
85
+ background: var(--dsw-alias-bg-module-platform);
86
+ color: var(--dsw-alias-label-secondary);
87
+ border-radius: 999px;
88
+ flex: none;
89
+ padding: 1px 8px;
90
+ font-size: 11px;
91
+ font-weight: 500;
92
+ line-height: 17px;
93
+ }
94
+
95
+ .chevron {
96
+ color: var(--dsw-alias-label-tertiary);
97
+ flex: none;
98
+ transition: transform 0.16s;
99
+ }
100
+
101
+ .chevronOpen {
102
+ transform: rotate(180deg);
103
+ }
104
+
105
+ .body {
106
+ border-top: 1px solid var(--dsw-alias-border-l2);
107
+ margin: 0 16px;
108
+ padding-bottom: 8px;
109
+ }
110
+
111
+ .readOnly {
112
+ color: var(--dsw-alias-label-secondary);
113
+ margin: 12px 0 0;
114
+ font-size: 12px;
115
+ line-height: 1.5;
116
+ }
117
+
118
+ .notExposed {
119
+ color: var(--dsw-alias-state-warn-primary);
120
+ margin: 12px 0 0;
121
+ font-size: 12px;
122
+ line-height: 1.5;
123
+ }
124
+
125
+ .footer {
126
+ border-top: 1px solid var(--dsw-alias-border-l2);
127
+ justify-content: flex-end;
128
+ align-items: center;
129
+ gap: 8px;
130
+ padding: 12px 0 4px;
131
+ display: flex;
132
+ }
133
+
134
+ .failed {
135
+ min-width: 0;
136
+ /* The suite's error alias is state-error-primary; a label-error token does
137
+ not exist, so the var() would resolve to nothing and the message would
138
+ inherit the ink color, losing the failure signal. */
139
+ color: var(--dsw-alias-state-error-primary, #b42318);
140
+ flex: 1;
141
+ margin: 0;
142
+ font-size: 12px;
143
+ line-height: 1.5;
144
+ text-overflow: ellipsis;
145
+ overflow: hidden;
146
+ white-space: nowrap;
147
+ }
148
+
149
+ .discard,
150
+ .save {
151
+ appearance: none;
152
+ font: inherit;
153
+ cursor: pointer;
154
+ border: 1px solid transparent;
155
+ border-radius: 8px;
156
+ padding: 5px 14px;
157
+ font-size: 13px;
158
+ line-height: 1.5;
159
+ }
160
+
161
+ .discard {
162
+ border-color: var(--dsw-alias-border-l2);
163
+ color: var(--dsw-alias-label-secondary);
164
+ background: transparent;
165
+ }
166
+
167
+ .discard:hover:not(:disabled) {
168
+ color: var(--dsw-alias-label-primary);
169
+ border-color: var(--dsw-alias-label-dimmed);
170
+ }
171
+
172
+ .save {
173
+ background: var(--dsw-alias-label-primary);
174
+ color: var(--dsw-alias-bg-layer-3);
175
+ }
176
+
177
+ .discard:disabled,
178
+ .save:disabled {
179
+ opacity: 0.4;
180
+ cursor: default;
181
+ }
182
+
183
+ .discard:focus-visible,
184
+ .save:focus-visible {
185
+ outline: 2px solid var(--dsw-alias-brand-primary);
186
+ outline-offset: 1px;
187
+ }
188
+
189
+ .field {
190
+ flex-direction: column;
191
+ gap: 6px;
192
+ padding: 12px 0;
193
+ display: flex;
194
+ }
195
+
196
+ .field + .field {
197
+ border-top: 1px solid var(--dsw-alias-border-l2);
198
+ }
199
+
200
+ .head {
201
+ align-items: center;
202
+ gap: 8px;
203
+ display: flex;
204
+ }
205
+
206
+ .label {
207
+ min-width: 0;
208
+ color: var(--dsw-alias-label-primary);
209
+ flex: 1;
210
+ font-size: 13px;
211
+ font-weight: 500;
212
+ line-height: 1.5;
213
+ }
214
+
215
+ .badges {
216
+ align-items: center;
217
+ gap: 8px;
218
+ display: inline-flex;
219
+ }
220
+
221
+ .badge {
222
+ white-space: nowrap;
223
+ background: var(--dsw-alias-bg-module-platform);
224
+ color: var(--dsw-alias-label-secondary);
225
+ border-radius: 999px;
226
+ padding: 1px 8px;
227
+ font-size: 11px;
228
+ font-weight: 500;
229
+ line-height: 17px;
230
+ }
231
+
232
+ .reset {
233
+ font: inherit;
234
+ color: var(--dsw-alias-label-secondary);
235
+ cursor: pointer;
236
+ background: transparent;
237
+ border: none;
238
+ padding: 0;
239
+ font-size: 12px;
240
+ line-height: 1.5;
241
+ }
242
+
243
+ .reset:hover:not(:disabled) {
244
+ color: var(--dsw-alias-label-primary);
245
+ }
246
+
247
+ .reset:disabled {
248
+ cursor: default;
249
+ }
250
+
251
+ .reset:focus-visible {
252
+ outline: 2px solid var(--dsw-alias-brand-primary);
253
+ outline-offset: 2px;
254
+ }
255
+
256
+ .reset:focus-visible {
257
+ outline: 2px solid var(--dsw-alias-brand-primary);
258
+ outline-offset: 2px;
259
+ }
260
+
261
+ .input,
262
+ .select {
263
+ border: 1px solid var(--dsw-alias-border-l2);
264
+ background: var(--dsw-alias-bg-layer-3);
265
+ height: 34px;
266
+ font: inherit;
267
+ color: var(--dsw-alias-label-primary);
268
+ border-radius: 8px;
269
+ padding: 0 12px;
270
+ font-size: 13px;
271
+ line-height: 1.5;
272
+ }
273
+
274
+ .input:focus-visible,
275
+ .select:focus-visible {
276
+ border-color: var(--dsw-alias-brand-primary);
277
+ outline: none;
278
+ }
279
+
280
+ .input:disabled,
281
+ .select:disabled {
282
+ color: var(--dsw-alias-label-tertiary);
283
+ cursor: default;
284
+ }
285
+
286
+ .inputInvalid {
287
+ border: 1px solid var(--dsw-alias-state-error-primary, #b42318);
288
+ background: var(--dsw-alias-bg-layer-3);
289
+ height: 34px;
290
+ font: inherit;
291
+ color: var(--dsw-alias-label-primary);
292
+ border-radius: 8px;
293
+ padding: 0 12px;
294
+ font-size: 13px;
295
+ line-height: 1.5;
296
+ }
297
+
298
+ .inputInvalid:focus-visible {
299
+ outline: 2px solid var(--dsw-alias-state-error-primary, #b42318);
300
+ outline-offset: 1px;
301
+ border-color: var(--dsw-alias-state-error-primary, #b42318);
302
+ }
303
+
304
+ .selectWrap {
305
+ position: relative;
306
+ }
307
+
308
+ .selectButton {
309
+ appearance: none;
310
+ width: 100%;
311
+ text-align: left;
312
+ cursor: pointer;
313
+ align-items: center;
314
+ justify-content: space-between;
315
+ gap: 8px;
316
+ display: flex;
317
+ }
318
+
319
+ .selectLabel {
320
+ min-width: 0;
321
+ overflow: hidden;
322
+ text-overflow: ellipsis;
323
+ white-space: nowrap;
324
+ }
325
+
326
+ .selectChevron {
327
+ color: var(--dsw-alias-label-tertiary);
328
+ flex: none;
329
+ transition: transform 0.16s;
330
+ }
331
+
332
+ .selectChevronOpen {
333
+ transform: rotate(180deg);
334
+ }
335
+
336
+ .selectPopup {
337
+ position: absolute;
338
+ top: calc(100% + 4px);
339
+ left: 0;
340
+ right: 0;
341
+ z-index: 40;
342
+ flex-direction: column;
343
+ max-height: 240px;
344
+ overflow-y: auto;
345
+ border: 1px solid var(--dsw-alias-border-l2);
346
+ border-radius: 8px;
347
+ background: var(--dsw-alias-bg-layer-3);
348
+ box-shadow: 0 8px 24px var(--dsw-alias-bg-mask-2);
349
+ padding: 4px;
350
+ opacity: 0;
351
+ transform: translateY(-4px);
352
+ transition: opacity 0.1s ease, transform 0.1s ease;
353
+ display: flex;
354
+ }
355
+
356
+ .selectPopupOpen {
357
+ opacity: 1;
358
+ transform: none;
359
+ }
360
+
361
+ .selectPopupClose {
362
+ opacity: 0;
363
+ transform: translateY(-4px);
364
+ pointer-events: none;
365
+ }
366
+
367
+ .selectOption {
368
+ /* 弹层是 max-height 受限的 flex 列:选项必须保持自然行高,超出交给弹层滚动 */
369
+ flex-shrink: 0;
370
+ border-radius: 6px;
371
+ padding: 6px 10px;
372
+ font-size: 13px;
373
+ line-height: 1.5;
374
+ color: var(--dsw-alias-label-primary);
375
+ cursor: pointer;
376
+ white-space: nowrap;
377
+ overflow: hidden;
378
+ text-overflow: ellipsis;
379
+ }
380
+
381
+ .selectOption:hover,
382
+ .selectOptionActive {
383
+ background: var(--dsw-alias-interactive-bg-hover);
384
+ }
385
+
386
+ .selectOptionSelected {
387
+ color: var(--dsw-alias-brand-primary);
388
+ font-weight: 500;
389
+ background: color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 10%, transparent);
390
+ }
391
+
392
+ .invalid {
393
+ color: var(--dsw-alias-state-error-primary, #b42318);
394
+ margin: 0;
395
+ font-size: 12px;
396
+ line-height: 1.5;
397
+ }
398
+
399
+ .hint {
400
+ color: var(--dsw-alias-label-secondary);
401
+ margin: 0;
402
+ font-size: 12px;
403
+ line-height: 1.5;
404
+ }
405
+
406
+ @media (prefers-reduced-motion: reduce) {
407
+ .card,
408
+ .header,
409
+ .chevron,
410
+ .chevronOpen,
411
+ .discard,
412
+ .save,
413
+ .selectChevron,
414
+ .selectChevronOpen,
415
+ .selectPopup {
416
+ transition: none;
417
+ }
418
+ }