@phoenix-wing/code-core 0.6.3 → 0.6.5

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PnwCleanupDialog.js","sourceRoot":"","sources":["../../../src/ui/elements/PnwCleanupDialog.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAgFrE,MAAM,8BAA8B,GAA0B,MAAM,CAAC,MAAM,CAAC;IAC1E,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IACnE,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,yBAAyB,EAAE,qBAAqB;IAChD,2BAA2B,EAAE,IAAI;CAClC,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8ChC,CAAC;AAEF,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC9B,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,cAAc,GAAG,8BAA8B,CAAC;IAChD,SAAS,CAAqB;IAC9B,OAAO,CAAkB;IACzB,Q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W;QAAE,OAAO,SAAS,CAAC;IAC5C,IAAI,KAAK,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAC;IAC1C,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACxC,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,cAAc,CAAC;IAC7C,OAAO,qBAAqB,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,70 @@
1
+ export declare const PNW_COMBO_TAG = "pnw-combo";
2
+ export declare const PNW_COMBO_ACTION = "pnw-combo-action";
3
+ export interface PnwComboItem {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly group?: string;
7
+ readonly title?: string;
8
+ readonly removable: boolean;
9
+ readonly removeDisabledReason?: string;
10
+ }
11
+ export interface PnwComboModel {
12
+ readonly ariaLabel: string;
13
+ readonly placeholder: string;
14
+ readonly emptyText: string;
15
+ readonly items: readonly PnwComboItem[];
16
+ readonly selectedId?: string;
17
+ readonly disabled: boolean;
18
+ readonly disabledReason?: string;
19
+ readonly clearEnabled: boolean;
20
+ readonly clearLabel: string;
21
+ readonly clearDisabledReason?: string;
22
+ }
23
+ export type PnwComboActionDetail = {
24
+ readonly kind: "select";
25
+ readonly itemId: string;
26
+ } | {
27
+ readonly kind: "remove";
28
+ readonly itemId: string;
29
+ } | {
30
+ readonly kind: "clear";
31
+ };
32
+ export declare class PnwCombo extends HTMLElement {
33
+ private readonly pnwRoot;
34
+ private pnwActiveModel;
35
+ private pnwTrigger?;
36
+ private pnwValue?;
37
+ private pnwPopup?;
38
+ private pnwList?;
39
+ private pnwFooter?;
40
+ private pnwClearButton?;
41
+ private pnwOpen;
42
+ private pnwListening;
43
+ private readonly pnwOnDocumentPointerDown;
44
+ private readonly pnwOnViewportChange;
45
+ connectedCallback(): void;
46
+ disconnectedCallback(): void;
47
+ set model(value: PnwComboModel | undefined);
48
+ get model(): PnwComboModel;
49
+ private pnwUpgradePreDefinitionModel;
50
+ private pnwEnsureDom;
51
+ private pnwApplyModel;
52
+ private pnwGroupNode;
53
+ private pnwItemNode;
54
+ private pnwSetOpen;
55
+ private pnwPlacePopup;
56
+ private pnwClippingBoundary;
57
+ private pnwOnTriggerKeyDown;
58
+ private pnwOnPopupKeyDown;
59
+ private pnwOptionButtons;
60
+ private pnwCaret;
61
+ private pnwEmit;
62
+ }
63
+ export declare function pnwNormalizeComboModel(value: PnwComboModel | null | undefined): PnwComboModel;
64
+ export declare function pnwCodeDefineCombo(tagName?: string): typeof PnwCombo;
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ "pnw-combo": PnwCombo;
68
+ }
69
+ }
70
+ //# sourceMappingURL=PnwCombo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PnwCombo.d.ts","sourceRoot":"","sources":["../../../src/ui/elements/PnwCombo.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,c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CAAC,WAAW;IAiCnB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,OAAO;CAOhB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACtC,aAAa,CA6Cf;AAED,wBAAgB,kBAAkB,CAAC,OAAO,SAAgB,GAAG,OAAO,QAAQ,CAK3E;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
@@ -0,0 +1,533 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ export const PNW_COMBO_TAG = "pnw-combo";
3
+ export const PNW_COMBO_ACTION = "pnw-combo-action";
4
+ const PNW_EMPTY_COMBO_MODEL = Object.freeze({
5
+ ariaLabel: "选择项目",
6
+ placeholder: "请选择…",
7
+ emptyText: "暂无项目",
8
+ items: Object.freeze([]),
9
+ disabled: false,
10
+ clearEnabled: false,
11
+ clearLabel: "全部清空",
12
+ });
13
+ const PNW_COMBO_STYLE = `
14
+ :host {
15
+ position: relative;
16
+ display: block;
17
+ width: 100%;
18
+ min-width: 0;
19
+ color: var(--pnw-combo-foreground, var(--vscode-foreground, #1f1f1f));
20
+ font: var(--vscode-font-size, 13px)/1.35 var(--vscode-font-family, system-ui, sans-serif);
21
+ }
22
+ :host([hidden]) { display: none !important; }
23
+ * { box-sizing: border-box; }
24
+ button { font: inherit; }
25
+ button:focus-visible {
26
+ outline: 1px solid var(--pnw-combo-focus, var(--vscode-focusBorder, #0078d4));
27
+ outline-offset: -1px;
28
+ }
29
+ .pnw-combo-trigger {
30
+ display: grid;
31
+ width: 100%;
32
+ min-width: 0;
33
+ min-height: var(--pnw-combo-height, 28px);
34
+ grid-template-columns: minmax(0, 1fr) 14px;
35
+ align-items: center;
36
+ gap: 5px;
37
+ padding: 3px 6px;
38
+ overflow: hidden;
39
+ border: 1px solid var(--pnw-combo-border, var(--vscode-dropdown-border, var(--vscode-input-border, #8e8e8e)));
40
+ border-radius: 2px;
41
+ color: var(--pnw-combo-foreground, var(--vscode-dropdown-foreground, var(--vscode-input-foreground, #1f1f1f)));
42
+ background: var(--pnw-combo-background, var(--vscode-dropdown-background, var(--vscode-input-background, #ffffff)));
43
+ cursor: pointer;
44
+ text-align: left;
45
+ }
46
+ .pnw-combo-trigger:hover:not(:disabled),
47
+ .pnw-combo-trigger[aria-expanded="true"] {
48
+ border-color: var(--pnw-combo-focus, var(--vscode-focusBorder, #0078d4));
49
+ }
50
+ .pnw-combo-trigger:disabled {
51
+ color: var(--vscode-disabledForeground, var(--vscode-descriptionForeground, #616161));
52
+ cursor: default;
53
+ opacity: .65;
54
+ }
55
+ .pnw-combo-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
56
+ .pnw-combo-caret { width: 12px; height: 12px; transition: transform 80ms ease; }
57
+ .pnw-combo-caret path {
58
+ fill: none;
59
+ stroke: currentColor;
60
+ stroke-linecap: round;
61
+ stroke-linejoin: round;
62
+ stroke-width: 1.5;
63
+ }
64
+ .pnw-combo-trigger[aria-expanded="true"] .pnw-combo-caret { transform: rotate(180deg); }
65
+ .pnw-combo-popup {
66
+ position: fixed;
67
+ z-index: var(--pnw-combo-z-index, 1000);
68
+ top: 0;
69
+ left: 0;
70
+ min-width: 0;
71
+ max-height: 300px;
72
+ overflow: auto;
73
+ border: 1px solid var(--pnw-combo-popup-border, var(--vscode-widget-border, var(--vscode-dropdown-border, #8e8e8e)));
74
+ color: var(--pnw-combo-popup-foreground, var(--vscode-menu-foreground, var(--vscode-foreground, #1f1f1f)));
75
+ background: var(--pnw-combo-popup-background, var(--vscode-menu-background, var(--vscode-dropdown-background, #ffffff)));
76
+ box-shadow: 0 3px 10px var(--vscode-widget-shadow, rgba(0, 0, 0, .32));
77
+ }
78
+ .pnw-combo-popup[hidden] { display: none; }
79
+ .pnw-combo-group + .pnw-combo-group {
80
+ border-top: 1px solid var(--vscode-menu-separatorBackground, var(--vscode-panel-border, #d4d4d4));
81
+ }
82
+ .pnw-combo-group-label {
83
+ padding: 5px 7px 3px;
84
+ overflow: hidden;
85
+ color: var(--vscode-descriptionForeground, #616161);
86
+ font-size: 10px;
87
+ text-overflow: ellipsis;
88
+ white-space: nowrap;
89
+ }
90
+ .pnw-combo-row {
91
+ display: grid;
92
+ min-width: 0;
93
+ grid-template-columns: minmax(0, 1fr) 26px;
94
+ align-items: stretch;
95
+ }
96
+ .pnw-combo-select, .pnw-combo-remove, .pnw-combo-clear {
97
+ min-width: 0;
98
+ min-height: 27px;
99
+ border: 0;
100
+ border-radius: 0;
101
+ color: inherit;
102
+ background: transparent;
103
+ cursor: pointer;
104
+ }
105
+ .pnw-combo-select {
106
+ padding: 4px 7px;
107
+ overflow: hidden;
108
+ text-align: left;
109
+ text-overflow: ellipsis;
110
+ white-space: nowrap;
111
+ }
112
+ .pnw-combo-remove {
113
+ display: grid;
114
+ width: 26px;
115
+ padding: 0;
116
+ place-items: center;
117
+ color: var(--vscode-descriptionForeground, #616161);
118
+ font-size: 15px;
119
+ }
120
+ .pnw-combo-select:hover,
121
+ .pnw-combo-select[aria-selected="true"],
122
+ .pnw-combo-remove:hover:not(:disabled),
123
+ .pnw-combo-clear:hover:not(:disabled) {
124
+ color: var(--vscode-list-hoverForeground, var(--vscode-foreground, #1f1f1f));
125
+ background: var(--vscode-list-hoverBackground, var(--vscode-toolbar-hoverBackground, #e8e8e8));
126
+ }
127
+ .pnw-combo-select[aria-selected="true"] {
128
+ color: var(--vscode-list-activeSelectionForeground, var(--vscode-foreground, #ffffff));
129
+ background: var(--vscode-list-activeSelectionBackground, var(--vscode-list-hoverBackground, #0078d4));
130
+ }
131
+ .pnw-combo-remove:disabled, .pnw-combo-clear:disabled {
132
+ color: var(--vscode-disabledForeground, var(--vscode-descriptionForeground, #616161));
133
+ cursor: default;
134
+ opacity: .45;
135
+ }
136
+ .pnw-combo-footer {
137
+ padding: 4px;
138
+ border-top: 1px solid var(--vscode-menu-separatorBackground, var(--vscode-panel-border, #d4d4d4));
139
+ }
140
+ .pnw-combo-clear {
141
+ width: 100%;
142
+ min-height: 25px;
143
+ padding: 3px 6px;
144
+ border: 1px solid var(--vscode-button-secondaryBackground, var(--vscode-panel-border, #d4d4d4));
145
+ text-align: center;
146
+ }
147
+ .pnw-combo-empty { padding: 7px; color: var(--vscode-descriptionForeground, #616161); text-align: center; }
148
+ @media (prefers-color-scheme: dark) {
149
+ :host(:not([color-scheme="light"]):not([color-scheme="dark"])) {
150
+ --pnw-combo-foreground: var(--vscode-foreground, #cccccc);
151
+ --pnw-combo-background: var(--vscode-dropdown-background, #3c3c3c);
152
+ --pnw-combo-popup-background: var(--vscode-menu-background, #252526);
153
+ --pnw-combo-popup-foreground: var(--vscode-menu-foreground, #cccccc);
154
+ }
155
+ }
156
+ @media (forced-colors: active) {
157
+ .pnw-combo-trigger, .pnw-combo-popup, .pnw-combo-clear { border-color: CanvasText; }
158
+ button:focus-visible { outline: 2px solid Highlight; }
159
+ }
160
+ @media (prefers-reduced-motion: reduce) {
161
+ .pnw-combo-caret { transition: none; }
162
+ }
163
+ `;
164
+ export class PnwCombo extends HTMLElement {
165
+ pnwRoot = this.attachShadow({ mode: "open" });
166
+ pnwActiveModel = PNW_EMPTY_COMBO_MODEL;
167
+ pnwTrigger;
168
+ pnwValue;
169
+ pnwPopup;
170
+ pnwList;
171
+ pnwFooter;
172
+ pnwClearButton;
173
+ pnwOpen = false;
174
+ pnwListening = false;
175
+ pnwOnDocumentPointerDown = (event) => {
176
+ if (!this.pnwOpen || event.composedPath().includes(this))
177
+ return;
178
+ this.pnwSetOpen(false);
179
+ };
180
+ pnwOnViewportChange = () => {
181
+ if (this.pnwOpen)
182
+ this.pnwPlacePopup();
183
+ };
184
+ connectedCallback() {
185
+ this.pnwUpgradePreDefinitionModel();
186
+ this.pnwEnsureDom();
187
+ if (!this.pnwListening) {
188
+ this.ownerDocument.addEventListener("pointerdown", this.pnwOnDocumentPointerDown);
189
+ this.ownerDocument.addEventListener("scroll", this.pnwOnViewportChange, true);
190
+ this.ownerDocument.defaultView?.addEventListener("resize", this.pnwOnViewportChange);
191
+ this.pnwListening = true;
192
+ }
193
+ this.pnwApplyModel();
194
+ }
195
+ disconnectedCallback() {
196
+ if (!this.pnwListening)
197
+ return;
198
+ this.ownerDocument.removeEventListener("pointerdown", this.pnwOnDocumentPointerDown);
199
+ this.ownerDocument.removeEventListener("scroll", this.pnwOnViewportChange, true);
200
+ this.ownerDocument.defaultView?.removeEventListener("resize", this.pnwOnViewportChange);
201
+ this.pnwListening = false;
202
+ }
203
+ set model(value) {
204
+ this.pnwActiveModel = pnwNormalizeComboModel(value);
205
+ this.pnwEnsureDom();
206
+ this.pnwApplyModel();
207
+ }
208
+ get model() { return this.pnwActiveModel; }
209
+ pnwUpgradePreDefinitionModel() {
210
+ if (!Object.prototype.hasOwnProperty.call(this, "model"))
211
+ return;
212
+ const holder = this;
213
+ const model = holder.model;
214
+ delete holder.model;
215
+ this.model = model;
216
+ }
217
+ pnwEnsureDom() {
218
+ if (this.pnwTrigger)
219
+ return;
220
+ const style = document.createElement("style");
221
+ style.textContent = PNW_COMBO_STYLE;
222
+ const trigger = document.createElement("button");
223
+ trigger.type = "button";
224
+ trigger.className = "pnw-combo-trigger";
225
+ trigger.setAttribute("part", "trigger");
226
+ trigger.setAttribute("role", "combobox");
227
+ trigger.setAttribute("aria-haspopup", "listbox");
228
+ trigger.setAttribute("aria-expanded", "false");
229
+ const value = document.createElement("span");
230
+ value.className = "pnw-combo-value";
231
+ value.setAttribute("part", "value");
232
+ trigger.append(value, this.pnwCaret());
233
+ trigger.onclick = () => this.pnwSetOpen(!this.pnwOpen, true);
234
+ trigger.onkeydown = (event) => this.pnwOnTriggerKeyDown(event);
235
+ const popup = document.createElement("div");
236
+ popup.className = "pnw-combo-popup";
237
+ popup.setAttribute("part", "popup");
238
+ popup.hidden = true;
239
+ popup.onkeydown = (event) => this.pnwOnPopupKeyDown(event);
240
+ const list = document.createElement("div");
241
+ list.className = "pnw-combo-list";
242
+ list.setAttribute("role", "listbox");
243
+ const footer = document.createElement("div");
244
+ footer.className = "pnw-combo-footer";
245
+ const clear = document.createElement("button");
246
+ clear.type = "button";
247
+ clear.className = "pnw-combo-clear";
248
+ clear.setAttribute("part", "clear");
249
+ clear.onclick = () => {
250
+ if (!this.pnwActiveModel.clearEnabled)
251
+ return;
252
+ this.pnwSetOpen(false);
253
+ this.pnwEmit({ kind: "clear" });
254
+ };
255
+ footer.append(clear);
256
+ popup.append(list, footer);
257
+ this.pnwRoot.replaceChildren(style, trigger, popup);
258
+ this.pnwTrigger = trigger;
259
+ this.pnwValue = value;
260
+ this.pnwPopup = popup;
261
+ this.pnwList = list;
262
+ this.pnwFooter = footer;
263
+ this.pnwClearButton = clear;
264
+ }
265
+ pnwApplyModel() {
266
+ if (!this.pnwTrigger || !this.pnwValue || !this.pnwPopup || !this.pnwList
267
+ || !this.pnwFooter || !this.pnwClearButton)
268
+ return;
269
+ const selected = this.pnwActiveModel.items.find(({ id }) => id === this.pnwActiveModel.selectedId);
270
+ this.pnwValue.textContent = selected?.label ?? this.pnwActiveModel.placeholder;
271
+ this.pnwValue.title = selected?.title ?? selected?.label ?? this.pnwActiveModel.placeholder;
272
+ this.pnwTrigger.disabled = this.pnwActiveModel.disabled;
273
+ this.pnwTrigger.title = this.pnwActiveModel.disabledReason
274
+ ?? selected?.title ?? selected?.label ?? this.pnwActiveModel.placeholder;
275
+ this.pnwTrigger.setAttribute("aria-label", this.pnwActiveModel.ariaLabel);
276
+ if (this.pnwActiveModel.disabled)
277
+ this.pnwSetOpen(false);
278
+ const groups = new Map();
279
+ for (const item of this.pnwActiveModel.items) {
280
+ const group = item.group ?? "";
281
+ const items = groups.get(group) ?? [];
282
+ items.push(item);
283
+ groups.set(group, items);
284
+ }
285
+ const groupNodes = Array.from(groups, ([group, items]) => this.pnwGroupNode(group, items));
286
+ if (!groupNodes.length) {
287
+ const empty = document.createElement("div");
288
+ empty.className = "pnw-combo-empty";
289
+ empty.textContent = this.pnwActiveModel.emptyText;
290
+ groupNodes.push(empty);
291
+ }
292
+ this.pnwList.replaceChildren(...groupNodes);
293
+ this.pnwClearButton.textContent = this.pnwActiveModel.clearLabel;
294
+ this.pnwClearButton.disabled = !this.pnwActiveModel.clearEnabled;
295
+ this.pnwClearButton.title = this.pnwActiveModel.clearEnabled
296
+ ? this.pnwActiveModel.clearLabel
297
+ : (this.pnwActiveModel.clearDisabledReason ?? "当前没有可清空的项目");
298
+ this.pnwClearButton.setAttribute("aria-label", this.pnwActiveModel.clearLabel);
299
+ this.pnwFooter.hidden = this.pnwActiveModel.items.length === 0
300
+ && !this.pnwActiveModel.clearEnabled;
301
+ if (this.pnwOpen)
302
+ queueMicrotask(() => this.pnwPlacePopup());
303
+ }
304
+ pnwGroupNode(group, items) {
305
+ const groupNode = document.createElement("div");
306
+ groupNode.className = "pnw-combo-group";
307
+ groupNode.setAttribute("role", "group");
308
+ if (group) {
309
+ const label = document.createElement("div");
310
+ label.className = "pnw-combo-group-label";
311
+ label.textContent = group;
312
+ label.title = group;
313
+ groupNode.setAttribute("aria-label", group);
314
+ groupNode.append(label);
315
+ }
316
+ for (const item of items)
317
+ groupNode.append(this.pnwItemNode(item));
318
+ return groupNode;
319
+ }
320
+ pnwItemNode(item) {
321
+ const row = document.createElement("div");
322
+ row.className = "pnw-combo-row";
323
+ row.setAttribute("part", "row");
324
+ row.dataset.itemId = item.id;
325
+ const select = document.createElement("button");
326
+ select.type = "button";
327
+ select.className = "pnw-combo-select";
328
+ select.setAttribute("role", "option");
329
+ select.setAttribute("aria-selected", item.id === this.pnwActiveModel.selectedId ? "true" : "false");
330
+ select.setAttribute("aria-label", `选择${item.label}`);
331
+ select.textContent = item.label;
332
+ select.title = item.title ?? item.label;
333
+ select.onclick = () => {
334
+ this.pnwSetOpen(false);
335
+ this.pnwEmit({ kind: "select", itemId: item.id });
336
+ };
337
+ const remove = document.createElement("button");
338
+ remove.type = "button";
339
+ remove.className = "pnw-combo-remove";
340
+ remove.textContent = "×";
341
+ remove.disabled = !item.removable;
342
+ remove.title = item.removable ? `删除${item.label}` : (item.removeDisabledReason ?? "此项不能删除");
343
+ remove.setAttribute("aria-label", `删除${item.label}`);
344
+ remove.onclick = (event) => {
345
+ event.stopPropagation();
346
+ if (!item.removable)
347
+ return;
348
+ this.pnwEmit({ kind: "remove", itemId: item.id });
349
+ };
350
+ row.append(select, remove);
351
+ return row;
352
+ }
353
+ pnwSetOpen(open, focusFirst = false) {
354
+ if (!this.pnwTrigger || !this.pnwPopup)
355
+ return;
356
+ this.pnwOpen = open && !this.pnwActiveModel.disabled;
357
+ this.pnwPopup.hidden = !this.pnwOpen;
358
+ this.pnwTrigger.setAttribute("aria-expanded", this.pnwOpen ? "true" : "false");
359
+ if (this.pnwOpen) {
360
+ this.pnwPlacePopup();
361
+ if (focusFirst)
362
+ queueMicrotask(() => this.pnwOptionButtons()[0]?.focus());
363
+ }
364
+ }
365
+ pnwPlacePopup() {
366
+ if (!this.pnwOpen || !this.pnwTrigger || !this.pnwPopup)
367
+ return;
368
+ const trigger = this.pnwTrigger.getBoundingClientRect();
369
+ const view = this.ownerDocument.defaultView;
370
+ const viewport = {
371
+ top: 0,
372
+ left: 0,
373
+ right: view?.innerWidth ?? this.ownerDocument.documentElement?.clientWidth ?? trigger.right,
374
+ bottom: view?.innerHeight ?? this.ownerDocument.documentElement?.clientHeight ?? trigger.bottom,
375
+ };
376
+ const boundary = this.pnwClippingBoundary(viewport);
377
+ const gap = 2;
378
+ const below = Math.max(0, boundary.bottom - trigger.bottom - gap);
379
+ const above = Math.max(0, trigger.top - boundary.top - gap);
380
+ const desiredHeight = Math.min(300, Math.max(28, this.pnwPopup.scrollHeight || 300));
381
+ const opensUp = below < desiredHeight && above > below;
382
+ const availableHeight = opensUp ? above : below;
383
+ const maxHeight = Math.min(300, availableHeight);
384
+ const popupHeight = Math.min(desiredHeight, maxHeight);
385
+ const boundaryWidth = Math.max(0, boundary.right - boundary.left);
386
+ const popupWidth = Math.min(Math.max(0, trigger.width), boundaryWidth);
387
+ const furthestLeft = Math.max(boundary.left, boundary.right - popupWidth);
388
+ const left = Math.min(Math.max(trigger.left, boundary.left), furthestLeft);
389
+ const top = opensUp
390
+ ? Math.max(boundary.top, trigger.top - gap - popupHeight)
391
+ : trigger.bottom + gap;
392
+ this.pnwPopup.dataset.placement = opensUp ? "top" : "bottom";
393
+ this.pnwPopup.style.left = `${Math.round(left)}px`;
394
+ this.pnwPopup.style.top = `${Math.round(top)}px`;
395
+ this.pnwPopup.style.width = `${Math.round(popupWidth)}px`;
396
+ this.pnwPopup.style.maxHeight = `${Math.max(0, Math.floor(maxHeight))}px`;
397
+ }
398
+ pnwClippingBoundary(viewport) {
399
+ const boundary = { ...viewport };
400
+ const view = this.ownerDocument.defaultView;
401
+ let ancestor = this.parentElement;
402
+ while (ancestor) {
403
+ const style = view?.getComputedStyle(ancestor);
404
+ if (style && /(?:auto|scroll|hidden|clip)/u.test(`${style.overflow} ${style.overflowX} ${style.overflowY}`)) {
405
+ const rect = ancestor.getBoundingClientRect();
406
+ boundary.top = Math.max(boundary.top, rect.top);
407
+ boundary.left = Math.max(boundary.left, rect.left);
408
+ boundary.right = Math.min(boundary.right, rect.right);
409
+ boundary.bottom = Math.min(boundary.bottom, rect.bottom);
410
+ }
411
+ ancestor = ancestor.parentElement;
412
+ }
413
+ return boundary;
414
+ }
415
+ pnwOnTriggerKeyDown(event) {
416
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
417
+ event.preventDefault();
418
+ this.pnwSetOpen(true);
419
+ const options = this.pnwOptionButtons();
420
+ queueMicrotask(() => (event.key === "ArrowUp" ? options.at(-1) : options[0])?.focus());
421
+ return;
422
+ }
423
+ if (event.key === "Escape" && this.pnwOpen) {
424
+ event.preventDefault();
425
+ this.pnwSetOpen(false);
426
+ }
427
+ }
428
+ pnwOnPopupKeyDown(event) {
429
+ if (event.key === "Escape") {
430
+ event.preventDefault();
431
+ this.pnwSetOpen(false);
432
+ this.pnwTrigger?.focus();
433
+ return;
434
+ }
435
+ if (event.key === "Tab") {
436
+ this.pnwSetOpen(false);
437
+ return;
438
+ }
439
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key))
440
+ return;
441
+ const options = this.pnwOptionButtons();
442
+ if (!options.length)
443
+ return;
444
+ event.preventDefault();
445
+ const current = this.pnwRoot.activeElement;
446
+ const index = options.findIndex((option) => option === current);
447
+ const next = event.key === "Home" ? 0
448
+ : event.key === "End" ? options.length - 1
449
+ : event.key === "ArrowDown" ? (index + 1 + options.length) % options.length
450
+ : (index - 1 + options.length) % options.length;
451
+ options[next]?.focus();
452
+ }
453
+ pnwOptionButtons() {
454
+ return Array.from(this.pnwRoot.querySelectorAll('.pnw-combo-select[role="option"]'));
455
+ }
456
+ pnwCaret() {
457
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
458
+ svg.classList.add("pnw-combo-caret");
459
+ svg.setAttribute("viewBox", "0 0 16 16");
460
+ svg.setAttribute("aria-hidden", "true");
461
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
462
+ path.setAttribute("d", "M4 6l4 4 4-4");
463
+ svg.append(path);
464
+ return svg;
465
+ }
466
+ pnwEmit(detail) {
467
+ this.dispatchEvent(new CustomEvent(PNW_COMBO_ACTION, {
468
+ detail: Object.freeze({ ...detail }),
469
+ bubbles: true,
470
+ composed: true,
471
+ }));
472
+ }
473
+ }
474
+ export function pnwNormalizeComboModel(value) {
475
+ if (!value)
476
+ return PNW_EMPTY_COMBO_MODEL;
477
+ const items = [];
478
+ const seen = new Set();
479
+ for (const candidate of value.items ?? []) {
480
+ const id = pnwComboText(candidate.id, 512);
481
+ const label = pnwComboText(candidate.label, 1_024);
482
+ if (!id || !label || seen.has(id))
483
+ continue;
484
+ seen.add(id);
485
+ items.push(Object.freeze({
486
+ id,
487
+ label,
488
+ ...(pnwComboText(candidate.group, 256)
489
+ ? { group: pnwComboText(candidate.group, 256) }
490
+ : {}),
491
+ ...(pnwComboText(candidate.title, 2_048)
492
+ ? { title: pnwComboText(candidate.title, 2_048) }
493
+ : {}),
494
+ removable: candidate.removable === true,
495
+ ...(pnwComboText(candidate.removeDisabledReason, 512)
496
+ ? { removeDisabledReason: pnwComboText(candidate.removeDisabledReason, 512) }
497
+ : {}),
498
+ }));
499
+ if (items.length >= 200)
500
+ break;
501
+ }
502
+ const selectedId = pnwComboText(value.selectedId, 512);
503
+ const selected = selectedId && items.some(({ id }) => id === selectedId)
504
+ ? selectedId
505
+ : undefined;
506
+ return Object.freeze({
507
+ ariaLabel: pnwComboText(value.ariaLabel, 256) || PNW_EMPTY_COMBO_MODEL.ariaLabel,
508
+ placeholder: pnwComboText(value.placeholder, 512) || PNW_EMPTY_COMBO_MODEL.placeholder,
509
+ emptyText: pnwComboText(value.emptyText, 512) || PNW_EMPTY_COMBO_MODEL.emptyText,
510
+ items: Object.freeze(items),
511
+ ...(selected ? { selectedId: selected } : {}),
512
+ disabled: value.disabled === true,
513
+ ...(pnwComboText(value.disabledReason, 512)
514
+ ? { disabledReason: pnwComboText(value.disabledReason, 512) }
515
+ : {}),
516
+ clearEnabled: value.clearEnabled === true && items.some(({ removable }) => removable),
517
+ clearLabel: pnwComboText(value.clearLabel, 128) || PNW_EMPTY_COMBO_MODEL.clearLabel,
518
+ ...(pnwComboText(value.clearDisabledReason, 512)
519
+ ? { clearDisabledReason: pnwComboText(value.clearDisabledReason, 512) }
520
+ : {}),
521
+ });
522
+ }
523
+ export function pnwCodeDefineCombo(tagName = PNW_COMBO_TAG) {
524
+ const existing = customElements.get(tagName);
525
+ if (existing)
526
+ return existing;
527
+ customElements.define(tagName, PnwCombo);
528
+ return PnwCombo;
529
+ }
530
+ function pnwComboText(value, maxLength) {
531
+ return typeof value === "string" ? value.trim().slice(0, maxLength) : "";
532
+ }
533
+ //# sourceMappingURL=PnwCombo.js.map