@greypan/web-ui 2.1.1 → 2.1.2

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 (76) hide show
  1. package/README.CN.md +43 -39
  2. package/README.md +53 -48
  3. package/dist/assets/menu-portal.js +1 -1
  4. package/dist/assets/menu-portal.js.map +1 -1
  5. package/dist/assets/toast-containers.js +1 -1
  6. package/dist/assets/toast-containers.js.map +1 -1
  7. package/dist/components/back-top/index.d.ts +3 -1
  8. package/dist/components/back-top/index.js +16 -12
  9. package/dist/components/back-top/index.js.map +1 -1
  10. package/dist/components/back-top/style.js +1 -1
  11. package/dist/components/back-top/style.js.map +1 -1
  12. package/dist/components/context-menu/index.d.ts +3 -4
  13. package/dist/components/context-menu/index.js +55 -69
  14. package/dist/components/context-menu/index.js.map +1 -1
  15. package/dist/components/context-menu/style.js +1 -1
  16. package/dist/components/context-menu/style.js.map +1 -1
  17. package/dist/components/dialog/index.d.ts +4 -11
  18. package/dist/components/dialog/index.js +29 -53
  19. package/dist/components/dialog/index.js.map +1 -1
  20. package/dist/components/drawer/index.d.ts +4 -11
  21. package/dist/components/drawer/index.js +42 -63
  22. package/dist/components/drawer/index.js.map +1 -1
  23. package/dist/components/dropdown/index.d.ts +3 -3
  24. package/dist/components/dropdown/index.js +70 -78
  25. package/dist/components/dropdown/index.js.map +1 -1
  26. package/dist/components/dropdown/style.js +1 -1
  27. package/dist/components/dropdown/style.js.map +1 -1
  28. package/dist/components/dropdown-item/style.js +1 -1
  29. package/dist/components/dropdown-item/style.js.map +1 -1
  30. package/dist/components/option/style.js +1 -1
  31. package/dist/components/option/style.js.map +1 -1
  32. package/dist/components/popover/index.d.ts +2 -5
  33. package/dist/components/popover/index.js +47 -70
  34. package/dist/components/popover/index.js.map +1 -1
  35. package/dist/components/select/index.d.ts +4 -7
  36. package/dist/components/select/index.js +64 -74
  37. package/dist/components/select/index.js.map +1 -1
  38. package/dist/components/select/style.js +1 -1
  39. package/dist/components/select/style.js.map +1 -1
  40. package/dist/components/switch/style.js +1 -1
  41. package/dist/components/switch/style.js.map +1 -1
  42. package/dist/components/theme/style.js +1 -1
  43. package/dist/components/theme/style.js.map +1 -1
  44. package/dist/components/toast/manager.js +1 -1
  45. package/dist/components/toast/manager.js.map +1 -1
  46. package/dist/components/toast/toast.d.ts +1 -1
  47. package/dist/components/toast/toast.js +26 -26
  48. package/dist/components/toast/toast.js.map +1 -1
  49. package/dist/components/tooltip/index.d.ts +3 -5
  50. package/dist/components/tooltip/index.js +61 -70
  51. package/dist/components/tooltip/index.js.map +1 -1
  52. package/dist/icons/generated/ooui-close.d.ts +6 -0
  53. package/dist/icons/generated/ooui-close.js +10 -0
  54. package/dist/icons/generated/ooui-close.js.map +1 -0
  55. package/dist/icons/index.d.ts +1 -0
  56. package/dist/icons/index.js +2 -1
  57. package/dist/shared/menu-portal/menu-portal.js +8 -1
  58. package/dist/shared/menu-portal/menu-portal.js.map +1 -1
  59. package/dist/shared/menu-portal/menu-tree.js +29 -0
  60. package/dist/shared/menu-portal/menu-tree.js.map +1 -0
  61. package/dist/shared/overlay/anchored-panel.js +49 -0
  62. package/dist/shared/overlay/anchored-panel.js.map +1 -0
  63. package/dist/shared/overlay/native-dialog-presence.js +45 -0
  64. package/dist/shared/overlay/native-dialog-presence.js.map +1 -0
  65. package/dist/shared/overlay/overlay.js +5 -2
  66. package/dist/shared/overlay/overlay.js.map +1 -1
  67. package/dist/shared/overlay/portal.js +3 -3
  68. package/dist/shared/overlay/portal.js.map +1 -1
  69. package/dist/shared/overlay/presence.js +1 -1
  70. package/dist/shared/overlay/presence.js.map +1 -1
  71. package/dist/shared/scroll-lock/scroll-lock.js +15 -1
  72. package/dist/shared/scroll-lock/scroll-lock.js.map +1 -1
  73. package/dist/types/vue.d.ts +2 -1
  74. package/package.json +1 -1
  75. package/dist/shared/property-converters/boolean-with-false-string.js +0 -9
  76. package/dist/shared/property-converters/boolean-with-false-string.js.map +0 -1
@@ -1,19 +1,18 @@
1
1
  import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
2
- import t from "../../assets/glass.js";
3
- import { normalizeLiteral as n, normalizeNumber as r } from "../../shared/normalize/index.js";
4
- import { booleanWithFalseString as i } from "../../shared/property-converters/boolean-with-false-string.js";
2
+ import { normalizeLiteral as t, normalizeNumber as n } from "../../shared/normalize/index.js";
5
3
  import "../dropdown-divider/index.js";
6
4
  import "../dropdown-header/index.js";
7
5
  import "../dropdown-item/index.js";
8
- import { createMenuPortalOverlay as a } from "../../shared/menu-portal/menu-portal.js";
9
- import { hideOverlayPresence as o, showOverlayPresence as s } from "../../shared/overlay/presence.js";
10
- import { lockScroll as c, unlockScroll as l } from "../../shared/scroll-lock/scroll-lock.js";
11
- import { withOverlay as u } from "../../shared/overlay/overlay.js";
12
- import d from "./style.js";
13
- import { LitElement as f, html as p, unsafeCSS as m } from "lit";
14
- import { customElement as h, property as g, state as _ } from "lit/decorators.js";
6
+ import { createMenuPortalOverlay as r } from "../../shared/menu-portal/menu-portal.js";
7
+ import { findFocusedMenuItem as i, focusMenuItem as a, getEnabledMenuItems as o, getMenuChildren as s, getMenuItemFromEvent as c, hideNestedMenuChildren as l, moveMenuChildren as u } from "../../shared/menu-portal/menu-tree.js";
8
+ import { hideOverlayPresence as d, showOverlayPresence as f } from "../../shared/overlay/presence.js";
9
+ import { createScrollLockLease as p } from "../../shared/scroll-lock/scroll-lock.js";
10
+ import { defineOverlay as m } from "../../shared/overlay/overlay.js";
11
+ import h from "./style.js";
12
+ import { LitElement as g, html as _, unsafeCSS as v } from "lit";
13
+ import { customElement as y, property as b, state as x } from "lit/decorators.js";
15
14
  //#region src/components/dropdown/index.ts
16
- var v = "web-ui-menu-level-", y = [
15
+ var S = "web-ui-menu-level-", C = [
17
16
  "top",
18
17
  "top-start",
19
18
  "top-end",
@@ -26,14 +25,14 @@ var v = "web-ui-menu-level-", y = [
26
25
  "left",
27
26
  "left-start",
28
27
  "left-end"
29
- ], b = class extends f {
28
+ ], w = class extends g {
30
29
  constructor(...e) {
31
- super(...e), this.open = !1, this.disabled = !1, this.matchWidth = !1, this.lockScroll = !0, this._placement = "bottom-start", this._offset = 4, this._activePath = [], this._overlays = /* @__PURE__ */ new Map(), this._closingSubmenuOverlays = /* @__PURE__ */ new Map(), this._ignoreOutsideClick = !1, this._hoverCleanupFns = [], this._hasScrollLock = !1, this._shouldOpenInstantly = !0, this._onTriggerClick = (e) => {
30
+ super(...e), this.open = !1, this.disabled = !1, this.matchWidth = !1, this.noScrollLock = !1, this._placement = "bottom-start", this._offset = 4, this._activePath = [], this._overlays = /* @__PURE__ */ new Map(), this._closingSubmenuOverlays = /* @__PURE__ */ new Map(), this._ignoreOutsideClick = !1, this._hoverCleanupFns = [], this._scrollLock = p(), this._shouldOpenInstantly = !0, this._onTriggerClick = (e) => {
32
31
  this.disabled || (this.open ? this.closeAll() : this._openMenu(e.detail === 0));
33
32
  }, this._onClickOutside = (e) => {
34
33
  !this.isOpen || this._ignoreOutsideClick || this._isInsideShadowRoot(e) || this.closeAll();
35
34
  }, this._onMenuClick = (e) => {
36
- let t = e.composedPath().find((e) => e instanceof HTMLElement && e.matches("web-ui-dropdown-item"));
35
+ let t = c(e);
37
36
  if (!t || t.hasAttribute("disabled") || !t.hasAttribute("submenu")) return;
38
37
  let n = this._getFocusedLevel(t);
39
38
  if (n === void 0) return;
@@ -83,19 +82,19 @@ var v = "web-ui-menu-level-", y = [
83
82
  };
84
83
  }
85
84
  static {
86
- this.styles = [m(t), m(d)];
85
+ this.styles = v(h);
87
86
  }
88
87
  get placement() {
89
88
  return this._placement;
90
89
  }
91
90
  set placement(e) {
92
- this._placement = n(e, y, "bottom-start");
91
+ this._placement = t(e, C, "bottom-start");
93
92
  }
94
93
  get offset() {
95
94
  return this._offset;
96
95
  }
97
96
  set offset(e) {
98
- this._offset = r(e, 0, 100, 4);
97
+ this._offset = n(e, 0, 100, 4);
99
98
  }
100
99
  get isOpen() {
101
100
  return this.open || this._activePath.length > 0;
@@ -104,7 +103,7 @@ var v = "web-ui-menu-level-", y = [
104
103
  super.connectedCallback(), this.addEventListener("keydown", this._onKeydown), document.addEventListener("click", this._onClickOutside);
105
104
  }
106
105
  disconnectedCallback() {
107
- super.disconnectedCallback(), this.removeEventListener("keydown", this._onKeydown), document.removeEventListener("click", this._onClickOutside), clearTimeout(this._openTimer), clearTimeout(this._ignoreOutsideClickTimer), this._syncScrollLock(!1), this._cleanupClosedMenu(), this._hoverCleanupFns.forEach((e) => e());
106
+ super.disconnectedCallback(), this.removeEventListener("keydown", this._onKeydown), document.removeEventListener("click", this._onClickOutside), clearTimeout(this._openTimer), clearTimeout(this._ignoreOutsideClickTimer), this._scrollLock.release(), this._cleanupClosedMenu(), this._hoverCleanupFns.forEach((e) => e());
108
107
  }
109
108
  updated(e) {
110
109
  e.has("open") && (this.open ? (this._restoreFocusTarget ??= document.activeElement instanceof HTMLElement ? document.activeElement : void 0, this._ignoreCurrentOutsideClick(), this._syncScrollLock(), this._hideAllSubmenuChildren(), requestAnimationFrame(() => {
@@ -113,7 +112,11 @@ var v = "web-ui-menu-level-", y = [
113
112
  detail: { open: this.open },
114
113
  bubbles: !0,
115
114
  composed: !0
116
- }))), e.has("lockScroll") && this._syncScrollLock(), this._bindLevelHovers();
115
+ }))), e.has("noScrollLock") && this._syncScrollLock(), (e.has("placement") || e.has("offset") || e.has("matchWidth")) && this._overlays.get(0)?.api.update({
116
+ placement: this.placement,
117
+ offset: this.offset,
118
+ matchWidth: this.matchWidth
119
+ }), this._bindLevelHovers();
117
120
  }
118
121
  openMenu() {
119
122
  this._openMenu(!0);
@@ -125,25 +128,21 @@ var v = "web-ui-menu-level-", y = [
125
128
  this.open &&= !1;
126
129
  }
127
130
  _closeAllSubmenus() {
128
- this._closeSubmenuFrom(1, !0), this._disposeClosingSubmenuOverlays(), this._activePath = [], this._syncActiveAttrs();
131
+ this._closeSubmenuFrom(1, !0), this._disposeClosingSubmenuOverlays(), this._syncActiveAttrs();
129
132
  }
130
133
  _cleanupClosedMenu() {
131
134
  this._closeAllSubmenus(), this._returnLevel0Items(), this._disposeAll();
132
135
  }
133
136
  async _closeRootAfterPresence() {
134
137
  let e = this._overlays.get(0)?.overlay;
135
- e && !await o(e) || this.open || !this.isConnected || (this._cleanupClosedMenu(), this._restoreFocusTarget?.focus(), this._restoreFocusTarget = void 0);
138
+ e && !await d(e) || this.open || !this.isConnected || (this._cleanupClosedMenu(), this._restoreFocusTarget?.focus(), this._restoreFocusTarget = void 0);
136
139
  }
137
140
  _hideAllSubmenuChildren() {
138
- this.querySelectorAll("web-ui-dropdown-item[submenu]").forEach((e) => {
139
- Array.from(e.children).forEach((e) => {
140
- e.matches("web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header") && e.setAttribute("slot", `${v}-hidden`);
141
- });
142
- });
141
+ l(this, `${S}-hidden`);
143
142
  }
144
143
  _toggleSubmenu(e, t, n = !1) {
145
144
  if (this._activePath[e] === t) return;
146
- this._closeSubmenuFrom(e + 1), this._activePath[e] = t, this._syncActiveAttrs();
145
+ this._closeSubmenuFrom(e + 1), this._activePath = [...this._activePath.slice(0, e), t], this._syncActiveAttrs();
147
146
  let r = this._getLevelItems(e)[t];
148
147
  r?.hasAttribute("submenu") && requestAnimationFrame(() => {
149
148
  !this.open || this._activePath[e] !== t || this._ensureOverlay(e + 1, n, r) || this._populateOverlay(e + 1, r);
@@ -154,7 +153,8 @@ var v = "web-ui-menu-level-", y = [
154
153
  let e = this._overlays.get(n), r = this._getLevelItems(n - 1)[this._activePath[n - 1]];
155
154
  e && (!r || t ? (this._depopulateOverlay(n, r), this._disposeOverlay(n)) : (this._overlays.delete(n), this._closingSubmenuOverlays.set(r, e), this._closeSubmenuAfterPresence(e, r)));
156
155
  }
157
- this._activePath = this._activePath.slice(0, e - 1), this._syncActiveAttrs();
156
+ let n = this._activePath.slice(0, e - 1);
157
+ n.length !== this._activePath.length && (this._activePath = n), this._syncActiveAttrs();
158
158
  }
159
159
  _syncActiveAttrs() {
160
160
  this.querySelectorAll("web-ui-dropdown-item").forEach((e) => {
@@ -167,49 +167,40 @@ var v = "web-ui-menu-level-", y = [
167
167
  });
168
168
  }
169
169
  _getLevelItems(e) {
170
- let t = this._overlays.get(e)?.overlay.querySelector(".dropdown-scroll");
171
- return t ? Array.from(t.children).filter((e) => e.matches("web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header")) : [];
170
+ let t = this._overlays.get(e)?.content;
171
+ return t ? s(t) : [];
172
172
  }
173
173
  _populateLevel0() {
174
- let e = this._overlays.get(0)?.overlay.querySelector(".dropdown-scroll");
175
- e && Array.from(this.children).forEach((t) => {
176
- t.matches("web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header") && e.appendChild(t);
177
- });
174
+ let e = this._overlays.get(0)?.content;
175
+ e && u(this, e);
178
176
  }
179
177
  _returnLevel0Items() {
180
- let e = this._overlays.get(0)?.overlay.querySelector(".dropdown-scroll");
181
- e && Array.from(e.children).forEach((e) => {
182
- e.matches("web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header") && this.appendChild(e);
183
- });
178
+ let e = this._overlays.get(0)?.content;
179
+ e && u(e, this);
184
180
  }
185
181
  _populateOverlay(e, t) {
186
- let n = this._overlays.get(e)?.overlay.querySelector(".dropdown-scroll");
187
- if (n) for (let e of Array.from(t.children)) e.matches("web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header") && n.appendChild(e);
182
+ let n = this._overlays.get(e)?.content;
183
+ n && u(t, n);
188
184
  }
189
185
  _depopulateOverlay(e, t) {
190
- let n = this._overlays.get(e)?.overlay.querySelector(".dropdown-scroll");
191
- if (n) {
192
- for (let r of Array.from(n.children)) if (r.matches("web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header")) {
193
- let n = e - 1, i = t ?? this._getLevelItems(n)[this._activePath[n]];
194
- i && i.appendChild(r);
195
- }
196
- }
186
+ let n = this._overlays.get(e)?.content;
187
+ if (!n) return;
188
+ let r = e - 1, i = t ?? this._getLevelItems(r)[this._activePath[r]];
189
+ i && u(n, i);
197
190
  }
198
191
  _ensureOverlay(e, t = !1, n) {
199
192
  let r = n ? this._closingSubmenuOverlays.get(n) : void 0;
200
- if (r) return this._closingSubmenuOverlays.delete(n), this._overlays.set(e, r), r.api.open(), s(r.overlay, { isInstant: t }), !0;
193
+ if (r) return this._closingSubmenuOverlays.delete(n), this._overlays.set(e, r), r.api.open(), f(r.overlay, { isInstant: t }), !0;
201
194
  let i = this._overlays.get(e);
202
- return i ? (i.api.open(), s(i.overlay, { isInstant: t }), !1) : (this._buildOverlay(e, t), !1);
195
+ return i ? (i.api.open(), f(i.overlay, { isInstant: t }), !1) : (this._buildOverlay(e, t), !1);
203
196
  }
204
197
  _buildOverlay(e, t = !1) {
205
- let n = a("dropdown-overlay");
198
+ let { panel: n, content: i } = r("dropdown-overlay");
206
199
  n.setAttribute("role", "menu"), n.dataset.level = String(e), n.addEventListener("click", this._onMenuClick), n.addEventListener("keydown", this._onKeydown);
207
- let r = document.createElement("div");
208
- r.className = "dropdown-scroll", n.appendChild(r);
209
- let i = e === 0 ? this._queryTriggerAnchor() : this._getSubmenuTriggerAnchor(e - 1);
210
- if (i) {
211
- let r = u.make({
212
- anchor: i,
200
+ let a = e === 0 ? this._queryTriggerAnchor() : this._getSubmenuTriggerAnchor(e - 1);
201
+ if (a) {
202
+ let r = m().make({
203
+ anchor: a,
213
204
  overlay: n,
214
205
  placement: e === 0 ? this.placement : "right-start",
215
206
  offset: e === 0 ? this.offset : 0,
@@ -218,8 +209,9 @@ var v = "web-ui-menu-level-", y = [
218
209
  });
219
210
  this._overlays.set(e, {
220
211
  api: r,
221
- overlay: n
222
- }), e === 0 && this._populateLevel0(), r.open(), s(n, { isInstant: t });
212
+ overlay: n,
213
+ content: i
214
+ }), e === 0 && this._populateLevel0(), r.open(), f(n, { isInstant: t });
223
215
  }
224
216
  }
225
217
  _disposeOverlay(e) {
@@ -230,20 +222,18 @@ var v = "web-ui-menu-level-", y = [
230
222
  for (let e of this._overlays.keys()) this._disposeOverlay(e);
231
223
  }
232
224
  async _closeSubmenuAfterPresence(e, t) {
233
- await o(e.overlay) && this._closingSubmenuOverlays.get(t) === e && (this._closingSubmenuOverlays.delete(t), this._restoreSubmenuItems(e.overlay, t), e.api.dispose(), e.overlay.remove());
225
+ await d(e.overlay) && this._closingSubmenuOverlays.get(t) === e && (this._closingSubmenuOverlays.delete(t), this._restoreSubmenuItems(e, t), e.api.dispose(), e.overlay.remove());
234
226
  }
235
227
  _disposeClosingSubmenuOverlays() {
236
228
  this._closingSubmenuOverlays.forEach((e, t) => {
237
- this._restoreSubmenuItems(e.overlay, t), e.api.dispose(), e.overlay.remove();
229
+ this._restoreSubmenuItems(e, t), e.api.dispose(), e.overlay.remove();
238
230
  }), this._closingSubmenuOverlays.clear();
239
231
  }
240
232
  _restoreSubmenuItems(e, t) {
241
- let n = e.querySelector(".dropdown-scroll");
242
- n && Array.from(n.children).forEach((e) => t.appendChild(e));
233
+ u(e.content, t);
243
234
  }
244
235
  _syncScrollLock(e = this.open) {
245
- let t = e && this.lockScroll;
246
- t !== this._hasScrollLock && (t ? c() : l(), this._hasScrollLock = t);
236
+ this._scrollLock.sync(e && !this.noScrollLock);
247
237
  }
248
238
  _queryTriggerAnchor() {
249
239
  let e = (this.shadowRoot?.querySelector("slot[name=\"trigger\"]"))?.assignedElements()[0];
@@ -256,16 +246,17 @@ var v = "web-ui-menu-level-", y = [
256
246
  return n ? n.shadowRoot?.querySelector(".item-inner") ?? n : null;
257
247
  }
258
248
  _getEnabledLevelItems(e) {
259
- return this._getLevelItems(e).filter((e) => e.matches("web-ui-dropdown-item:not([disabled])"));
249
+ let t = this._overlays.get(e)?.content;
250
+ return t ? o(t) : [];
260
251
  }
261
252
  _getFocusedItem(e) {
262
- return e?.composedPath().find((e) => e instanceof HTMLElement && e.matches("web-ui-dropdown-item")) || [...this._overlays.values()].flatMap(({ overlay: e }) => Array.from(e.querySelectorAll("web-ui-dropdown-item"))).find((e) => !!e.shadowRoot?.activeElement);
253
+ return e?.composedPath().find((e) => e instanceof HTMLElement && e.matches("web-ui-dropdown-item")) || i([...this._overlays.values()].map(({ overlay: e }) => e));
263
254
  }
264
255
  _getFocusedLevel(e = this._getFocusedItem()) {
265
256
  if (e) return [...this._overlays.entries()].find(([, t]) => t.overlay.contains(e))?.[0];
266
257
  }
267
258
  _focusMenuItem(e) {
268
- !e || e.hasAttribute("disabled") || e.focusItem?.();
259
+ a(e);
269
260
  }
270
261
  _isInsideShadowRoot(e) {
271
262
  for (let t of e.composedPath()) if (t === this || t === this.shadowRoot || t instanceof Node && t.getRootNode() === this.shadowRoot || t instanceof Node && [...this._overlays.values()].some(({ overlay: e }) => e.contains(t))) return !0;
@@ -294,31 +285,32 @@ var v = "web-ui-menu-level-", y = [
294
285
  requestAnimationFrame(() => this._bindLevelHovers());
295
286
  }
296
287
  render() {
297
- return p`
288
+ return _`
298
289
  <div class="dropdown-trigger" @click=${this._onTriggerClick}>
299
290
  <slot name="trigger"></slot>
300
291
  </div>
301
292
  `;
302
293
  }
303
294
  };
304
- e([g({
295
+ e([b({
305
296
  type: Boolean,
306
297
  reflect: !0
307
- })], b.prototype, "open", void 0), e([g({
298
+ })], w.prototype, "open", void 0), e([b({
308
299
  type: Boolean,
309
300
  reflect: !0
310
- })], b.prototype, "disabled", void 0), e([g({
301
+ })], w.prototype, "disabled", void 0), e([b({
302
+ type: Boolean,
303
+ reflect: !0,
304
+ attribute: "match-width"
305
+ })], w.prototype, "matchWidth", void 0), e([b({
311
306
  type: Boolean,
312
- reflect: !0
313
- })], b.prototype, "matchWidth", void 0), e([g({
314
307
  reflect: !0,
315
- attribute: "lock-scroll",
316
- converter: i
317
- })], b.prototype, "lockScroll", void 0), e([g({
308
+ attribute: "no-scroll-lock"
309
+ })], w.prototype, "noScrollLock", void 0), e([b({
318
310
  type: String,
319
311
  reflect: !0
320
- })], b.prototype, "placement", null), e([g({ type: Number })], b.prototype, "offset", null), e([_()], b.prototype, "_activePath", void 0), b = e([h("web-ui-dropdown")], b);
312
+ })], w.prototype, "placement", null), e([b({ type: Number })], w.prototype, "offset", null), e([x()], w.prototype, "_activePath", void 0), w = e([y("web-ui-dropdown")], w);
321
313
  //#endregion
322
- export { b as WebUiDropdown };
314
+ export { w as WebUiDropdown };
323
315
 
324
316
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown/index.ts"],"sourcesContent":["import type { Placement } from '@floating-ui/dom'\nimport { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/dropdown-divider'\nimport '@/components/dropdown-header'\nimport '@/components/dropdown-item'\nimport glass from '@/assets/glass.css?inline'\nimport { createMenuPortalOverlay } from '@/shared/menu-portal/menu-portal'\nimport { normalizeLiteral, normalizeNumber } from '@/shared/normalize'\nimport { withOverlay } from '@/shared/overlay/overlay'\nimport type { OverlayApi } from '@/shared/overlay/overlay'\nimport { hideOverlayPresence, showOverlayPresence } from '@/shared/overlay/presence'\nimport { booleanWithFalseString } from '@/shared/property-converters/boolean-with-false-string'\nimport { lockScroll, unlockScroll } from '@/shared/scroll-lock/scroll-lock'\n\nimport style from './style.css?inline'\n\nexport type { Placement }\n\nconst SLOT_PREFIX = 'web-ui-menu-level-'\nconst ALLOWED_PLACEMENTS = [\n 'top',\n 'top-start',\n 'top-end',\n 'right',\n 'right-start',\n 'right-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'left',\n 'left-start',\n 'left-end'\n] as const\n\ninterface MenuOverlay {\n api: OverlayApi\n overlay: HTMLElement\n}\n\n@customElement('web-ui-dropdown')\nexport class WebUiDropdown extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: Boolean, reflect: true }) open = false\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) matchWidth = false\n @property({ reflect: true, attribute: 'lock-scroll', converter: booleanWithFalseString }) lockScroll = true\n\n private _placement: Placement = 'bottom-start'\n\n @property({ type: String, reflect: true })\n get placement(): Placement {\n return this._placement\n }\n set placement(v: string) {\n this._placement = normalizeLiteral(v, ALLOWED_PLACEMENTS, 'bottom-start')\n }\n\n private _offset = 4\n\n @property({ type: Number })\n get offset(): number {\n return this._offset\n }\n set offset(v: number) {\n this._offset = normalizeNumber(v, 0, 100, 4)\n }\n\n @state() private _activePath: number[] = []\n\n private readonly _overlays = new Map<number, MenuOverlay>()\n private readonly _closingSubmenuOverlays = new Map<HTMLElement, MenuOverlay>()\n private _openTimer?: ReturnType<typeof setTimeout>\n private _ignoreOutsideClick = false\n private _ignoreOutsideClickTimer?: ReturnType<typeof setTimeout>\n private _hoverCleanupFns: (() => void)[] = []\n private _hasScrollLock = false\n private _restoreFocusTarget?: HTMLElement\n private _shouldOpenInstantly = true\n\n get isOpen(): boolean {\n return this.open || this._activePath.length > 0\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.addEventListener('keydown', this._onKeydown)\n document.addEventListener('click', this._onClickOutside)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('keydown', this._onKeydown)\n document.removeEventListener('click', this._onClickOutside)\n clearTimeout(this._openTimer)\n clearTimeout(this._ignoreOutsideClickTimer)\n this._syncScrollLock(false)\n this._cleanupClosedMenu()\n this._hoverCleanupFns.forEach(fn => fn())\n }\n\n protected override updated(changed: Map<string, unknown>) {\n if (changed.has('open')) {\n if (this.open) {\n this._restoreFocusTarget ??= document.activeElement instanceof HTMLElement ? document.activeElement : undefined\n this._ignoreCurrentOutsideClick()\n this._syncScrollLock()\n this._hideAllSubmenuChildren()\n requestAnimationFrame(() => {\n if (!this.open) return\n this._ensureOverlay(0, this._shouldOpenInstantly)\n this._shouldOpenInstantly = true\n this._focusMenuItem(this._getEnabledLevelItems(0)[0])\n })\n this._bindHoversAfterUpdate()\n } else {\n this._syncScrollLock()\n void this._closeRootAfterPresence()\n }\n this.dispatchEvent(\n new CustomEvent('open-change', {\n detail: { open: this.open },\n bubbles: true,\n composed: true\n })\n )\n }\n if (changed.has('lockScroll')) this._syncScrollLock()\n this._bindLevelHovers()\n }\n\n /**\n * 打开菜单。\n * @returns 无返回值;打开后派发 `open-change` 事件。\n */\n openMenu() {\n this._openMenu(true)\n }\n\n private _openMenu(isInstant: boolean) {\n if (this.disabled || this.open) return\n this._ignoreCurrentOutsideClick()\n this._shouldOpenInstantly = isInstant\n this.open = true\n }\n\n /**\n * 关闭所有层级。\n * @returns 无返回值;关闭后派发 `open-change` 事件。\n */\n closeAll() {\n if (!this.open) return\n this.open = false\n }\n\n /** 清理子菜单状态(不影响 open prop) */\n private _closeAllSubmenus() {\n this._closeSubmenuFrom(1, true)\n this._disposeClosingSubmenuOverlays()\n this._activePath = []\n this._syncActiveAttrs()\n }\n\n private _cleanupClosedMenu() {\n this._closeAllSubmenus()\n this._returnLevel0Items()\n this._disposeAll()\n }\n\n private async _closeRootAfterPresence() {\n const overlay = this._overlays.get(0)?.overlay\n if (overlay && !(await hideOverlayPresence(overlay))) return\n if (this.open || !this.isConnected) return\n\n this._cleanupClosedMenu()\n this._restoreFocusTarget?.focus()\n this._restoreFocusTarget = undefined\n }\n\n private _hideAllSubmenuChildren() {\n this.querySelectorAll('web-ui-dropdown-item[submenu]').forEach(item => {\n Array.from(item.children).forEach(child => {\n if (child.matches('web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header')) {\n child.setAttribute('slot', `${SLOT_PREFIX}-hidden`)\n }\n })\n })\n }\n\n private _toggleSubmenu(level: number, itemIndex: number, isInstant = false) {\n if (this._activePath[level] === itemIndex) {\n return\n }\n\n this._closeSubmenuFrom(level + 1)\n\n this._activePath[level] = itemIndex\n this._syncActiveAttrs()\n\n const item = this._getLevelItems(level)[itemIndex]\n if (item?.hasAttribute('submenu')) {\n requestAnimationFrame(() => {\n if (!this.open || this._activePath[level] !== itemIndex) return\n const restored = this._ensureOverlay(level + 1, isInstant, item)\n if (!restored) this._populateOverlay(level + 1, item)\n })\n }\n\n this._bindHoversAfterUpdate()\n }\n\n private _closeSubmenuFrom(level: number, isInstant = false) {\n for (let lv = this._activePath.length; lv >= level; lv--) {\n const overlay = this._overlays.get(lv)\n const parentItem = this._getLevelItems(lv - 1)[this._activePath[lv - 1]]\n if (!overlay) continue\n\n if (!parentItem || isInstant) {\n this._depopulateOverlay(lv, parentItem)\n this._disposeOverlay(lv)\n } else {\n this._overlays.delete(lv)\n this._closingSubmenuOverlays.set(parentItem, overlay)\n void this._closeSubmenuAfterPresence(overlay, parentItem)\n }\n }\n this._activePath = this._activePath.slice(0, level - 1)\n this._syncActiveAttrs()\n }\n\n private _syncActiveAttrs() {\n this.querySelectorAll('web-ui-dropdown-item').forEach(item => {\n item.removeAttribute('active')\n })\n this._overlays.forEach((_, level) => {\n this._getLevelItems(level).forEach(item => item.removeAttribute('active'))\n })\n this._activePath.forEach((itemIndex, level) => {\n const item = this._getLevelItems(level)[itemIndex]\n if (item?.matches('web-ui-dropdown-item')) {\n item.setAttribute('active', '')\n }\n })\n }\n\n private _getLevelItems(level: number): HTMLElement[] {\n const scroll = this._overlays.get(level)?.overlay.querySelector<HTMLElement>('.dropdown-scroll')\n if (!scroll) return []\n return Array.from(scroll.children).filter((c): c is HTMLElement =>\n c.matches('web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header')\n )\n }\n\n private _populateLevel0() {\n const overlay = this._overlays.get(0)?.overlay.querySelector<HTMLElement>('.dropdown-scroll')\n if (!overlay) return\n Array.from(this.children).forEach(child => {\n if (child.matches('web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header')) {\n overlay.appendChild(child)\n }\n })\n }\n\n private _returnLevel0Items() {\n const overlay = this._overlays.get(0)?.overlay.querySelector<HTMLElement>('.dropdown-scroll')\n if (!overlay) return\n Array.from(overlay.children).forEach(child => {\n if (child.matches('web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header')) {\n this.appendChild(child)\n }\n })\n }\n\n private _populateOverlay(level: number, submenuItem: HTMLElement) {\n const overlay = this._overlays.get(level)?.overlay.querySelector<HTMLElement>('.dropdown-scroll')\n if (!overlay) return\n for (const child of Array.from(submenuItem.children)) {\n if (child.matches('web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header')) {\n overlay.appendChild(child)\n }\n }\n }\n\n private _depopulateOverlay(level: number, parentItem?: HTMLElement) {\n const scroll = this._overlays.get(level)?.overlay.querySelector<HTMLElement>('.dropdown-scroll')\n if (!scroll) return\n for (const child of Array.from(scroll.children)) {\n if (child.matches('web-ui-dropdown-item, web-ui-dropdown-divider, web-ui-dropdown-header')) {\n const targetLevel = level - 1\n const submenuItem = parentItem ?? this._getLevelItems(targetLevel)[this._activePath[targetLevel]]\n if (submenuItem) {\n submenuItem.appendChild(child)\n }\n }\n }\n }\n\n private _ensureOverlay(level: number, isInstant = false, submenuItem?: HTMLElement): boolean {\n const closingOverlay = submenuItem ? this._closingSubmenuOverlays.get(submenuItem) : undefined\n if (closingOverlay) {\n this._closingSubmenuOverlays.delete(submenuItem!)\n this._overlays.set(level, closingOverlay)\n closingOverlay.api.open()\n showOverlayPresence(closingOverlay.overlay, { isInstant })\n return true\n }\n const existing = this._overlays.get(level)\n if (existing) {\n existing.api.open()\n showOverlayPresence(existing.overlay, { isInstant })\n return false\n }\n this._buildOverlay(level, isInstant)\n return false\n }\n\n private _buildOverlay(level: number, isInstant = false) {\n const overlay = createMenuPortalOverlay('dropdown-overlay')\n overlay.setAttribute('role', 'menu')\n overlay.dataset.level = String(level)\n overlay.addEventListener('click', this._onMenuClick)\n overlay.addEventListener('keydown', this._onKeydown)\n\n const scroll = document.createElement('div')\n scroll.className = 'dropdown-scroll'\n overlay.appendChild(scroll)\n\n const anchor = level === 0 ? this._queryTriggerAnchor() : this._getSubmenuTriggerAnchor(level - 1)\n\n if (anchor) {\n const ctrl = withOverlay.make({\n anchor,\n overlay,\n placement: level === 0 ? this.placement : 'right-start',\n offset: level === 0 ? this.offset : 0,\n matchWidth: level === 0 ? this.matchWidth : false,\n strategy: 'fixed'\n })\n this._overlays.set(level, { api: ctrl, overlay })\n if (level === 0) this._populateLevel0()\n ctrl.open()\n showOverlayPresence(overlay, { isInstant })\n }\n }\n\n private _disposeOverlay(level: number) {\n const overlay = this._overlays.get(level)?.overlay\n overlay?.removeEventListener('click', this._onMenuClick)\n overlay?.removeEventListener('keydown', this._onKeydown)\n overlay?.remove()\n this._overlays.get(level)?.api.dispose()\n this._overlays.delete(level)\n }\n\n private _disposeAll() {\n for (const level of this._overlays.keys()) {\n this._disposeOverlay(level)\n }\n }\n\n private async _closeSubmenuAfterPresence(overlay: MenuOverlay, parentItem: HTMLElement) {\n if (!(await hideOverlayPresence(overlay.overlay))) return\n if (this._closingSubmenuOverlays.get(parentItem) !== overlay) return\n\n this._closingSubmenuOverlays.delete(parentItem)\n this._restoreSubmenuItems(overlay.overlay, parentItem)\n overlay.api.dispose()\n overlay.overlay.remove()\n }\n\n private _disposeClosingSubmenuOverlays() {\n this._closingSubmenuOverlays.forEach((overlay, parentItem) => {\n this._restoreSubmenuItems(overlay.overlay, parentItem)\n overlay.api.dispose()\n overlay.overlay.remove()\n })\n this._closingSubmenuOverlays.clear()\n }\n\n private _restoreSubmenuItems(overlay: HTMLElement, parentItem: HTMLElement) {\n const scroll = overlay.querySelector<HTMLElement>('.dropdown-scroll')\n if (!scroll) return\n Array.from(scroll.children).forEach(child => parentItem.appendChild(child))\n }\n\n private _syncScrollLock(isOpen = this.open) {\n const shouldLock = isOpen && this.lockScroll\n if (shouldLock === this._hasScrollLock) return\n\n if (shouldLock) lockScroll()\n else unlockScroll()\n this._hasScrollLock = shouldLock\n }\n\n private _queryTriggerAnchor(): HTMLElement | null {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n const el = slot?.assignedElements()[0]\n return el instanceof HTMLElement ? el : null\n }\n\n private _getSubmenuTriggerAnchor(level: number): HTMLElement | null {\n const idx = this._activePath[level]\n if (idx === undefined) return null\n const items = this._getLevelItems(level)\n const item = items[idx]\n if (!item) return null\n return item.shadowRoot?.querySelector('.item-inner') ?? item\n }\n\n private _onTriggerClick = (event: MouseEvent) => {\n if (this.disabled) return\n if (this.open) {\n this.closeAll()\n } else {\n this._openMenu(event.detail === 0)\n }\n }\n\n private _onClickOutside = (e: MouseEvent) => {\n if (!this.isOpen || this._ignoreOutsideClick) return\n if (this._isInsideShadowRoot(e)) return\n this.closeAll()\n }\n\n private _onMenuClick = (e: MouseEvent) => {\n const item = e\n .composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.matches('web-ui-dropdown-item'))\n if (!item || item.hasAttribute('disabled') || !item.hasAttribute('submenu')) return\n\n const level = this._getFocusedLevel(item)\n if (level === undefined) return\n const itemIndex = this._getLevelItems(level).indexOf(item)\n if (itemIndex >= 0) this._toggleSubmenu(level, itemIndex, e.detail === 0)\n }\n\n private _onKeydown = (e: KeyboardEvent) => {\n if (this.disabled || !this.open) return\n\n if (e.key === 'Escape' && e.target === this) {\n if (this._activePath.length > 0) this._closeSubmenuFrom(this._activePath.length)\n else this.closeAll()\n e.preventDefault()\n return\n }\n\n const focused = this._getFocusedItem(e)\n const level = this._getFocusedLevel(focused)\n if (level === undefined) return\n const items = this._getEnabledLevelItems(level)\n const currentIndex = focused ? items.indexOf(focused) : -1\n\n switch (e.key) {\n case 'ArrowDown':\n this._focusMenuItem(items[(currentIndex + 1 + items.length) % items.length])\n break\n case 'ArrowUp':\n this._focusMenuItem(items[(currentIndex - 1 + items.length) % items.length])\n break\n case 'Home':\n this._focusMenuItem(items[0])\n break\n case 'End':\n this._focusMenuItem(items.at(-1))\n break\n case 'ArrowRight':\n if (focused?.hasAttribute('submenu')) {\n const itemIndex = this._getLevelItems(level).indexOf(focused)\n this._toggleSubmenu(level, itemIndex, true)\n requestAnimationFrame(() =>\n requestAnimationFrame(() => this._focusMenuItem(this._getEnabledLevelItems(level + 1)[0]))\n )\n }\n break\n case 'ArrowLeft':\n if (level > 0) {\n this._closeSubmenuFrom(level)\n this._focusMenuItem(this._getLevelItems(level - 1)[this._activePath[level - 1]])\n }\n break\n case 'Enter':\n case ' ':\n focused?.click()\n break\n case 'Escape':\n if (this._activePath.length > 0) this._closeSubmenuFrom(this._activePath.length)\n else this.closeAll()\n break\n default:\n return\n }\n e.preventDefault()\n e.stopPropagation()\n }\n\n private _getEnabledLevelItems(level: number) {\n return this._getLevelItems(level).filter(item => item.matches('web-ui-dropdown-item:not([disabled])'))\n }\n\n private _getFocusedItem(event?: KeyboardEvent): HTMLElement | undefined {\n const eventItem = event\n ?.composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.matches('web-ui-dropdown-item'))\n if (eventItem) return eventItem\n\n return [...this._overlays.values()]\n .flatMap(({ overlay }) => Array.from(overlay.querySelectorAll<HTMLElement>('web-ui-dropdown-item')))\n .find(item => Boolean(item.shadowRoot?.activeElement))\n }\n\n private _getFocusedLevel(item = this._getFocusedItem()): number | undefined {\n if (!item) return undefined\n const overlay = [...this._overlays.entries()].find(([, value]) => value.overlay.contains(item))\n return overlay?.[0]\n }\n\n private _focusMenuItem(item: HTMLElement | undefined) {\n if (!item || item.hasAttribute('disabled')) return\n const focusable = item as HTMLElement & { focusItem?: () => void }\n focusable.focusItem?.()\n }\n\n private _isInsideShadowRoot(e: MouseEvent): boolean {\n for (const node of e.composedPath()) {\n if (node === this || node === this.shadowRoot) return true\n if (node instanceof Node && node.getRootNode() === this.shadowRoot) return true\n if (node instanceof Node && [...this._overlays.values()].some(({ overlay }) => overlay.contains(node)))\n return true\n }\n return false\n }\n\n private _ignoreCurrentOutsideClick() {\n this._ignoreOutsideClick = true\n clearTimeout(this._ignoreOutsideClickTimer)\n this._ignoreOutsideClickTimer = setTimeout(() => {\n this._ignoreOutsideClick = false\n })\n }\n\n private _bindLevelHovers() {\n this._hoverCleanupFns.forEach(fn => fn())\n this._hoverCleanupFns.length = 0\n\n const maxLevel = this._activePath.length + 1\n for (let lv = 0; lv <= maxLevel; lv++) {\n const items = this._getLevelItems(lv)\n if (!items.length) continue\n items.forEach((item, idx) => {\n if (!item.matches('web-ui-dropdown-item') || item.hasAttribute('disabled')) return\n const handler = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n clearTimeout(this._openTimer)\n if (item.hasAttribute('submenu')) {\n if (this._activePath[lv] !== idx) {\n this._openTimer = setTimeout(() => this._toggleSubmenu(lv, idx), 200)\n }\n } else if (this._activePath.length > lv) {\n this._closeSubmenuFrom(lv + 1)\n }\n }\n item.addEventListener('pointerenter', handler, { passive: true })\n this._hoverCleanupFns.push(() => item.removeEventListener('pointerenter', handler))\n })\n }\n }\n\n private _bindHoversAfterUpdate() {\n requestAnimationFrame(() => this._bindLevelHovers())\n }\n\n override render() {\n return html`\n <div class=\"dropdown-trigger\" @click=${this._onTriggerClick}>\n <slot name=\"trigger\"></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n 'open-change': CustomEvent<{ open: boolean }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-dropdown': WebUiDropdown\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,IAAM,IAAc,sBACd,IAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAQa,IAAN,cAA4B,EAAW;;EA4YtB,aAzY6B,KAAA,OAAA,IACI,KAAA,WAAA,IACE,KAAA,aAAA,IAC8C,KAAA,aAAA,IAEvE,KAAA,aAAA,gBAUd,KAAA,UAAA,GAUuB,KAAA,cAAA,CAAC,GAEb,KAAA,4BAAA,IAAI,IAAyB,GACf,KAAA,0CAAA,IAAI,IAA8B,GAE/C,KAAA,sBAAA,IAEa,KAAA,mBAAA,CAAC,GACnB,KAAA,iBAAA,IAEM,KAAA,uBAAA,IA2UJ,KAAA,mBAAA,MAAsB;GAC3C,KAAK,aACL,KAAK,OACP,K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C;EACH;CACF;CAEA,yBAAiC;EAC/B,4BAA4B,KAAK,iBAAiB,CAAC;CACrD;CAEA,SAAkB;EAChB,OAAO,CAAI;6CAC8B,KAAK,gBAAgB;;;;CAIhE;AAKF;AA3hBG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,SAAS;CAAM,WAAW;CAAe,WAAW;AAAuB,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GAIvF,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,IAAA,GAUxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,IAAA,GAQzB,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,eAAA,KAAA,CAAA,GA7BR,IAAA,EAAA,CAAA,EAAc,iBAAiB,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown/index.ts"],"sourcesContent":["import type { Placement } from '@floating-ui/dom'\nimport { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/dropdown-divider'\nimport '@/components/dropdown-header'\nimport '@/components/dropdown-item'\nimport { createMenuPortalOverlay } from '@/shared/menu-portal/menu-portal'\nimport {\n findFocusedMenuItem,\n focusMenuItem,\n getEnabledMenuItems,\n getMenuChildren,\n getMenuItemFromEvent,\n hideNestedMenuChildren,\n moveMenuChildren\n} from '@/shared/menu-portal/menu-tree'\nimport { normalizeLiteral, normalizeNumber } from '@/shared/normalize'\nimport { defineOverlay } from '@/shared/overlay/overlay'\nimport type { OverlayApi } from '@/shared/overlay/overlay'\nimport { hideOverlayPresence, showOverlayPresence } from '@/shared/overlay/presence'\nimport { createScrollLockLease } from '@/shared/scroll-lock/scroll-lock'\n\nimport style from './style.css?inline'\n\nexport type { Placement }\n\nconst SLOT_PREFIX = 'web-ui-menu-level-'\nconst ALLOWED_PLACEMENTS = [\n 'top',\n 'top-start',\n 'top-end',\n 'right',\n 'right-start',\n 'right-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'left',\n 'left-start',\n 'left-end'\n] as const\n\ninterface MenuOverlay {\n api: OverlayApi\n overlay: HTMLElement\n content: HTMLElement\n}\n\n@customElement('web-ui-dropdown')\nexport class WebUiDropdown extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: Boolean, reflect: true }) open = false\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true, attribute: 'match-width' }) matchWidth = false\n @property({ type: Boolean, reflect: true, attribute: 'no-scroll-lock' }) noScrollLock = false\n\n private _placement: Placement = 'bottom-start'\n\n @property({ type: String, reflect: true })\n get placement(): Placement {\n return this._placement\n }\n set placement(v: string) {\n this._placement = normalizeLiteral(v, ALLOWED_PLACEMENTS, 'bottom-start')\n }\n\n private _offset = 4\n\n @property({ type: Number })\n get offset(): number {\n return this._offset\n }\n set offset(v: number) {\n this._offset = normalizeNumber(v, 0, 100, 4)\n }\n\n @state() private _activePath: number[] = []\n\n private readonly _overlays = new Map<number, MenuOverlay>()\n private readonly _closingSubmenuOverlays = new Map<HTMLElement, MenuOverlay>()\n private _openTimer?: ReturnType<typeof setTimeout>\n private _ignoreOutsideClick = false\n private _ignoreOutsideClickTimer?: ReturnType<typeof setTimeout>\n private _hoverCleanupFns: (() => void)[] = []\n private readonly _scrollLock = createScrollLockLease()\n private _restoreFocusTarget?: HTMLElement\n private _shouldOpenInstantly = true\n\n get isOpen(): boolean {\n return this.open || this._activePath.length > 0\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.addEventListener('keydown', this._onKeydown)\n document.addEventListener('click', this._onClickOutside)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('keydown', this._onKeydown)\n document.removeEventListener('click', this._onClickOutside)\n clearTimeout(this._openTimer)\n clearTimeout(this._ignoreOutsideClickTimer)\n this._scrollLock.release()\n this._cleanupClosedMenu()\n this._hoverCleanupFns.forEach(fn => fn())\n }\n\n protected override updated(changed: Map<string, unknown>) {\n if (changed.has('open')) {\n if (this.open) {\n this._restoreFocusTarget ??= document.activeElement instanceof HTMLElement ? document.activeElement : undefined\n this._ignoreCurrentOutsideClick()\n this._syncScrollLock()\n this._hideAllSubmenuChildren()\n requestAnimationFrame(() => {\n if (!this.open) return\n this._ensureOverlay(0, this._shouldOpenInstantly)\n this._shouldOpenInstantly = true\n this._focusMenuItem(this._getEnabledLevelItems(0)[0])\n })\n this._bindHoversAfterUpdate()\n } else {\n this._syncScrollLock()\n void this._closeRootAfterPresence()\n }\n this.dispatchEvent(\n new CustomEvent('open-change', {\n detail: { open: this.open },\n bubbles: true,\n composed: true\n })\n )\n }\n if (changed.has('noScrollLock')) this._syncScrollLock()\n if (changed.has('placement') || changed.has('offset') || changed.has('matchWidth')) {\n this._overlays.get(0)?.api.update({\n placement: this.placement,\n offset: this.offset,\n matchWidth: this.matchWidth\n })\n }\n this._bindLevelHovers()\n }\n\n /**\n * 打开菜单。\n * @returns 无返回值;打开后派发 `open-change` 事件。\n */\n openMenu() {\n this._openMenu(true)\n }\n\n private _openMenu(isInstant: boolean) {\n if (this.disabled || this.open) return\n this._ignoreCurrentOutsideClick()\n this._shouldOpenInstantly = isInstant\n this.open = true\n }\n\n /**\n * 关闭所有层级。\n * @returns 无返回值;关闭后派发 `open-change` 事件。\n */\n closeAll() {\n if (!this.open) return\n this.open = false\n }\n\n /** 清理子菜单状态(不影响 open prop) */\n private _closeAllSubmenus() {\n this._closeSubmenuFrom(1, true)\n this._disposeClosingSubmenuOverlays()\n this._syncActiveAttrs()\n }\n\n private _cleanupClosedMenu() {\n this._closeAllSubmenus()\n this._returnLevel0Items()\n this._disposeAll()\n }\n\n private async _closeRootAfterPresence() {\n const overlay = this._overlays.get(0)?.overlay\n if (overlay && !(await hideOverlayPresence(overlay))) return\n if (this.open || !this.isConnected) return\n\n this._cleanupClosedMenu()\n this._restoreFocusTarget?.focus()\n this._restoreFocusTarget = undefined\n }\n\n private _hideAllSubmenuChildren() {\n hideNestedMenuChildren(this, `${SLOT_PREFIX}-hidden`)\n }\n\n private _toggleSubmenu(level: number, itemIndex: number, isInstant = false) {\n if (this._activePath[level] === itemIndex) {\n return\n }\n\n this._closeSubmenuFrom(level + 1)\n\n this._activePath = [...this._activePath.slice(0, level), itemIndex]\n this._syncActiveAttrs()\n\n const item = this._getLevelItems(level)[itemIndex]\n if (item?.hasAttribute('submenu')) {\n requestAnimationFrame(() => {\n if (!this.open || this._activePath[level] !== itemIndex) return\n const restored = this._ensureOverlay(level + 1, isInstant, item)\n if (!restored) this._populateOverlay(level + 1, item)\n })\n }\n\n this._bindHoversAfterUpdate()\n }\n\n private _closeSubmenuFrom(level: number, isInstant = false) {\n for (let lv = this._activePath.length; lv >= level; lv--) {\n const overlay = this._overlays.get(lv)\n const parentItem = this._getLevelItems(lv - 1)[this._activePath[lv - 1]]\n if (!overlay) continue\n\n if (!parentItem || isInstant) {\n this._depopulateOverlay(lv, parentItem)\n this._disposeOverlay(lv)\n } else {\n this._overlays.delete(lv)\n this._closingSubmenuOverlays.set(parentItem, overlay)\n void this._closeSubmenuAfterPresence(overlay, parentItem)\n }\n }\n const nextActivePath = this._activePath.slice(0, level - 1)\n if (nextActivePath.length !== this._activePath.length) {\n this._activePath = nextActivePath\n }\n this._syncActiveAttrs()\n }\n\n private _syncActiveAttrs() {\n this.querySelectorAll('web-ui-dropdown-item').forEach(item => {\n item.removeAttribute('active')\n })\n this._overlays.forEach((_, level) => {\n this._getLevelItems(level).forEach(item => item.removeAttribute('active'))\n })\n this._activePath.forEach((itemIndex, level) => {\n const item = this._getLevelItems(level)[itemIndex]\n if (item?.matches('web-ui-dropdown-item')) {\n item.setAttribute('active', '')\n }\n })\n }\n\n private _getLevelItems(level: number): HTMLElement[] {\n const content = this._overlays.get(level)?.content\n return content ? getMenuChildren(content) : []\n }\n\n private _populateLevel0() {\n const content = this._overlays.get(0)?.content\n if (content) moveMenuChildren(this, content)\n }\n\n private _returnLevel0Items() {\n const content = this._overlays.get(0)?.content\n if (content) moveMenuChildren(content, this)\n }\n\n private _populateOverlay(level: number, submenuItem: HTMLElement) {\n const content = this._overlays.get(level)?.content\n if (content) moveMenuChildren(submenuItem, content)\n }\n\n private _depopulateOverlay(level: number, parentItem?: HTMLElement) {\n const content = this._overlays.get(level)?.content\n if (!content) return\n const targetLevel = level - 1\n const submenuItem = parentItem ?? this._getLevelItems(targetLevel)[this._activePath[targetLevel]]\n if (submenuItem) moveMenuChildren(content, submenuItem)\n }\n\n private _ensureOverlay(level: number, isInstant = false, submenuItem?: HTMLElement): boolean {\n const closingOverlay = submenuItem ? this._closingSubmenuOverlays.get(submenuItem) : undefined\n if (closingOverlay) {\n this._closingSubmenuOverlays.delete(submenuItem!)\n this._overlays.set(level, closingOverlay)\n closingOverlay.api.open()\n showOverlayPresence(closingOverlay.overlay, { isInstant })\n return true\n }\n const existing = this._overlays.get(level)\n if (existing) {\n existing.api.open()\n showOverlayPresence(existing.overlay, { isInstant })\n return false\n }\n this._buildOverlay(level, isInstant)\n return false\n }\n\n private _buildOverlay(level: number, isInstant = false) {\n const { panel: overlay, content } = createMenuPortalOverlay('dropdown-overlay')\n overlay.setAttribute('role', 'menu')\n overlay.dataset.level = String(level)\n overlay.addEventListener('click', this._onMenuClick)\n overlay.addEventListener('keydown', this._onKeydown)\n\n const anchor = level === 0 ? this._queryTriggerAnchor() : this._getSubmenuTriggerAnchor(level - 1)\n\n if (anchor) {\n const ctrl = defineOverlay().make({\n anchor,\n overlay,\n placement: level === 0 ? this.placement : 'right-start',\n offset: level === 0 ? this.offset : 0,\n matchWidth: level === 0 ? this.matchWidth : false,\n strategy: 'fixed'\n })\n this._overlays.set(level, { api: ctrl, overlay, content })\n if (level === 0) this._populateLevel0()\n ctrl.open()\n showOverlayPresence(overlay, { isInstant })\n }\n }\n\n private _disposeOverlay(level: number) {\n const overlay = this._overlays.get(level)?.overlay\n overlay?.removeEventListener('click', this._onMenuClick)\n overlay?.removeEventListener('keydown', this._onKeydown)\n overlay?.remove()\n this._overlays.get(level)?.api.dispose()\n this._overlays.delete(level)\n }\n\n private _disposeAll() {\n for (const level of this._overlays.keys()) {\n this._disposeOverlay(level)\n }\n }\n\n private async _closeSubmenuAfterPresence(overlay: MenuOverlay, parentItem: HTMLElement) {\n if (!(await hideOverlayPresence(overlay.overlay))) return\n if (this._closingSubmenuOverlays.get(parentItem) !== overlay) return\n\n this._closingSubmenuOverlays.delete(parentItem)\n this._restoreSubmenuItems(overlay, parentItem)\n overlay.api.dispose()\n overlay.overlay.remove()\n }\n\n private _disposeClosingSubmenuOverlays() {\n this._closingSubmenuOverlays.forEach((overlay, parentItem) => {\n this._restoreSubmenuItems(overlay, parentItem)\n overlay.api.dispose()\n overlay.overlay.remove()\n })\n this._closingSubmenuOverlays.clear()\n }\n\n private _restoreSubmenuItems(overlay: MenuOverlay, parentItem: HTMLElement) {\n moveMenuChildren(overlay.content, parentItem)\n }\n\n private _syncScrollLock(isOpen = this.open) {\n this._scrollLock.sync(isOpen && !this.noScrollLock)\n }\n\n private _queryTriggerAnchor(): HTMLElement | null {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n const el = slot?.assignedElements()[0]\n return el instanceof HTMLElement ? el : null\n }\n\n private _getSubmenuTriggerAnchor(level: number): HTMLElement | null {\n const idx = this._activePath[level]\n if (idx === undefined) return null\n const items = this._getLevelItems(level)\n const item = items[idx]\n if (!item) return null\n return item.shadowRoot?.querySelector('.item-inner') ?? item\n }\n\n private _onTriggerClick = (event: MouseEvent) => {\n if (this.disabled) return\n if (this.open) {\n this.closeAll()\n } else {\n this._openMenu(event.detail === 0)\n }\n }\n\n private _onClickOutside = (e: MouseEvent) => {\n if (!this.isOpen || this._ignoreOutsideClick) return\n if (this._isInsideShadowRoot(e)) return\n this.closeAll()\n }\n\n private _onMenuClick = (e: MouseEvent) => {\n const item = getMenuItemFromEvent(e)\n if (!item || item.hasAttribute('disabled') || !item.hasAttribute('submenu')) return\n\n const level = this._getFocusedLevel(item)\n if (level === undefined) return\n const itemIndex = this._getLevelItems(level).indexOf(item)\n if (itemIndex >= 0) this._toggleSubmenu(level, itemIndex, e.detail === 0)\n }\n\n private _onKeydown = (e: KeyboardEvent) => {\n if (this.disabled || !this.open) return\n\n if (e.key === 'Escape' && e.target === this) {\n if (this._activePath.length > 0) this._closeSubmenuFrom(this._activePath.length)\n else this.closeAll()\n e.preventDefault()\n return\n }\n\n const focused = this._getFocusedItem(e)\n const level = this._getFocusedLevel(focused)\n if (level === undefined) return\n const items = this._getEnabledLevelItems(level)\n const currentIndex = focused ? items.indexOf(focused) : -1\n\n switch (e.key) {\n case 'ArrowDown':\n this._focusMenuItem(items[(currentIndex + 1 + items.length) % items.length])\n break\n case 'ArrowUp':\n this._focusMenuItem(items[(currentIndex - 1 + items.length) % items.length])\n break\n case 'Home':\n this._focusMenuItem(items[0])\n break\n case 'End':\n this._focusMenuItem(items.at(-1))\n break\n case 'ArrowRight':\n if (focused?.hasAttribute('submenu')) {\n const itemIndex = this._getLevelItems(level).indexOf(focused)\n this._toggleSubmenu(level, itemIndex, true)\n requestAnimationFrame(() =>\n requestAnimationFrame(() => this._focusMenuItem(this._getEnabledLevelItems(level + 1)[0]))\n )\n }\n break\n case 'ArrowLeft':\n if (level > 0) {\n this._closeSubmenuFrom(level)\n this._focusMenuItem(this._getLevelItems(level - 1)[this._activePath[level - 1]])\n }\n break\n case 'Enter':\n case ' ':\n focused?.click()\n break\n case 'Escape':\n if (this._activePath.length > 0) this._closeSubmenuFrom(this._activePath.length)\n else this.closeAll()\n break\n default:\n return\n }\n e.preventDefault()\n e.stopPropagation()\n }\n\n private _getEnabledLevelItems(level: number) {\n const content = this._overlays.get(level)?.content\n return content ? getEnabledMenuItems(content) : []\n }\n\n private _getFocusedItem(event?: KeyboardEvent): HTMLElement | undefined {\n const eventItem = event\n ?.composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.matches('web-ui-dropdown-item'))\n if (eventItem) return eventItem\n\n return findFocusedMenuItem([...this._overlays.values()].map(({ overlay }) => overlay))\n }\n\n private _getFocusedLevel(item = this._getFocusedItem()): number | undefined {\n if (!item) return undefined\n const overlay = [...this._overlays.entries()].find(([, value]) => value.overlay.contains(item))\n return overlay?.[0]\n }\n\n private _focusMenuItem(item: HTMLElement | undefined) {\n focusMenuItem(item)\n }\n\n private _isInsideShadowRoot(e: MouseEvent): boolean {\n for (const node of e.composedPath()) {\n if (node === this || node === this.shadowRoot) return true\n if (node instanceof Node && node.getRootNode() === this.shadowRoot) return true\n if (node instanceof Node && [...this._overlays.values()].some(({ overlay }) => overlay.contains(node)))\n return true\n }\n return false\n }\n\n private _ignoreCurrentOutsideClick() {\n this._ignoreOutsideClick = true\n clearTimeout(this._ignoreOutsideClickTimer)\n this._ignoreOutsideClickTimer = setTimeout(() => {\n this._ignoreOutsideClick = false\n })\n }\n\n private _bindLevelHovers() {\n this._hoverCleanupFns.forEach(fn => fn())\n this._hoverCleanupFns.length = 0\n\n const maxLevel = this._activePath.length + 1\n for (let lv = 0; lv <= maxLevel; lv++) {\n const items = this._getLevelItems(lv)\n if (!items.length) continue\n items.forEach((item, idx) => {\n if (!item.matches('web-ui-dropdown-item') || item.hasAttribute('disabled')) return\n const handler = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n clearTimeout(this._openTimer)\n if (item.hasAttribute('submenu')) {\n if (this._activePath[lv] !== idx) {\n this._openTimer = setTimeout(() => this._toggleSubmenu(lv, idx), 200)\n }\n } else if (this._activePath.length > lv) {\n this._closeSubmenuFrom(lv + 1)\n }\n }\n item.addEventListener('pointerenter', handler, { passive: true })\n this._hoverCleanupFns.push(() => item.removeEventListener('pointerenter', handler))\n })\n }\n }\n\n private _bindHoversAfterUpdate() {\n requestAnimationFrame(() => this._bindLevelHovers())\n }\n\n override render() {\n return html`\n <div class=\"dropdown-trigger\" @click=${this._onTriggerClick}>\n <slot name=\"trigger\"></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n 'open-change': CustomEvent<{ open: boolean }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-dropdown': WebUiDropdown\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAM,IAAc,sBACd,IAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GASa,IAAN,cAA4B,EAAW;;EA0WtB,aAvW6B,KAAA,OAAA,IACI,KAAA,WAAA,IAC4B,KAAA,aAAA,IACK,KAAA,eAAA,IAExD,KAAA,aAAA,gBAUd,KAAA,UAAA,GAUuB,KAAA,cAAA,CAAC,GAEb,KAAA,4BAAA,IAAI,IAAyB,GACf,KAAA,0CAAA,IAAI,IAA8B,GAE/C,KAAA,sBAAA,IAEa,KAAA,mBAAA,CAAC,GACb,KAAA,cAAA,EAAsB,GAEtB,KAAA,uBAAA,IA2SJ,KAAA,mBAAA,MAAsB;GAC3C,KAAK,aACL,KAAK,OACP,KAAK,SAAS,IAEd,KAAK,UAAU,EAAM,WAAW,CAAC;EAErC,GAE2B,KAAA,mBAAA,MAAkB;GACvC,CAAC,KAAK,UAAU,KAAK,uBACrB,KAAK,oBAAoB,CAAC,KAC9B,KAAK,SAAS;EAChB,GAEwB,KAAA,gBAAA,MAAkB;GACxC,IAAM,IAAO,EAAqB,CAAC;GACnC,IAAI,CAAC,KAAQ,EAAK,aAAa,UAAU,KAA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AK,iBAAiB,gBAAgB,GAAS,EAAE,SAAS,GAAK,CAAC,GAChE,KAAK,iBAAiB,WAAW,EAAK,oBAAoB,gBAAgB,CAAO,CAAC;GACpF,CAAC;EACH;CACF;CAEA,yBAAiC;EAC/B,4BAA4B,KAAK,iBAAiB,CAAC;CACrD;CAEA,SAAkB;EAChB,OAAO,CAAI;6CAC8B,KAAK,gBAAgB;;;;CAIhE;AAKF;AAtfG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAc,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACnE,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAiB,CAAC,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GAItE,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,IAAA,GAUxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,IAAA,GAQzB,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,eAAA,KAAA,CAAA,GA7BR,IAAA,EAAA,CAAA,EAAc,iBAAiB,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/dropdown/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{-webkit-user-select:none;user-select:none;display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}:host([disabled]) .dropdown-trigger{cursor:not-allowed;cursor:pointer;display:inline-flex}.dropdown-overlay{--wui-glass-shadow:var(--wui-shadow-pop,0 3px 9px #00000045);-webkit-user-select:none;user-select:none;z-index:var(--wui-layer-menu,100);box-sizing:border-box;background-color:var(--wui-color-surface-overlay,#f6f6f6e0);border-radius:20px;position:fixed}.dropdown-scroll{min-width:200px;max-height:320px;padding:4px;overflow-y:auto}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{-webkit-user-select:none;user-select:none;display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}:host([disabled]) .dropdown-trigger{cursor:not-allowed;display:inline-flex}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/dropdown/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n user-select: none;\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n:host([disabled]) .dropdown-trigger {\n cursor: not-allowed;\n cursor: pointer;\n display: inline-flex;\n}\n\n.dropdown-overlay {\n --wui-glass-shadow: var(--wui-shadow-pop, 0 3px 9px rgb(0 0 0 / 0.27));\n user-select: none;\n\n position: fixed;\n z-index: var(--wui-layer-menu, 100);\n\n box-sizing: border-box;\n border-radius: 20px;\n\n background-color: var(--wui-color-surface-overlay, rgb(246 246 246 / 0.88));\n}\n\n.dropdown-scroll {\n overflow-y: auto;\n min-width: 200px;\n max-height: 320px;\n padding: 4px;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/dropdown/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n user-select: none;\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n\n & .dropdown-trigger {\n cursor: not-allowed;\n display: inline-flex;\n }\n}\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/dropdown-item/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.item-inner{-webkit-user-select:none;user-select:none;height:32px;font-size:var(--wui-font-size,14px);color:inherit;white-space:nowrap;transition:color var(--wui-duration-fast,.16s) ease, background-color var(--wui-duration-fast,.16s) ease;border-radius:2147483647px;outline:none;align-items:center;gap:8px;padding:0 12px;display:flex}.item-inner:focus-visible{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}:host([active]) .item-inner{color:inherit;background:var(--wui-color-border,#0000001a)}@media (hover:hover) and (pointer:fine){:host(:hover) .item-inner{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}.item-label{min-width:0;color:inherit;text-overflow:ellipsis;flex:1;overflow:hidden}.item-suffix{opacity:.4;flex:none}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.item-inner{-webkit-user-select:none;user-select:none;height:32px;font-size:var(--wui-font-size,14px);color:inherit;white-space:nowrap;transition:color var(--wui-duration-feedback,.12s) var(--wui-ease-out,cubic-bezier(.23, 1, .32, 1)), background-color var(--wui-duration-feedback,.12s) var(--wui-ease-out,cubic-bezier(.23, 1, .32, 1));border-radius:2147483647px;outline:none;align-items:center;gap:8px;padding:0 12px;display:flex}.item-inner:focus-visible{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}:host([active]) .item-inner{color:inherit;background:var(--wui-color-border,#0000001a)}@media (hover:hover) and (pointer:fine){:host(:hover) .item-inner{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}.item-label{min-width:0;color:inherit;text-overflow:ellipsis;flex:1;overflow:hidden}.item-suffix{opacity:.4;flex:none}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/dropdown-item/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.item-inner {\n user-select: none;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 32px;\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: inherit;\n white-space: nowrap;\n\n outline: none;\n\n transition:\n color var(--wui-duration-fast, 160ms) ease,\n background-color var(--wui-duration-fast, 160ms) ease;\n}\n\n.item-inner:focus-visible {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n:host([active]) .item-inner {\n color: inherit;\n background: var(--wui-color-border, rgb(0 0 0 / 0.1));\n}\n\n@media (hover: hover) and (pointer: fine) {\n :host(:hover) .item-inner {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n.item-label {\n overflow: hidden;\n flex: 1;\n\n min-width: 0;\n\n color: inherit;\n text-overflow: ellipsis;\n}\n\n.item-suffix {\n flex: none;\n opacity: 0.4;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/dropdown-item/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.item-inner {\n user-select: none;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 32px;\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: inherit;\n white-space: nowrap;\n\n outline: none;\n\n transition:\n color var(--wui-duration-feedback, 120ms) var(--wui-ease-out, cubic-bezier(0.23, 1, 0.32, 1)),\n background-color var(--wui-duration-feedback, 120ms) var(--wui-ease-out, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.item-inner:focus-visible {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n:host([active]) .item-inner {\n color: inherit;\n background: var(--wui-color-border, rgb(0 0 0 / 0.1));\n}\n\n@media (hover: hover) and (pointer: fine) {\n :host(:hover) .item-inner {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n.item-label {\n overflow: hidden;\n flex: 1;\n\n min-width: 0;\n\n color: inherit;\n text-overflow: ellipsis;\n}\n\n.item-suffix {\n flex: none;\n opacity: 0.4;\n}\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/option/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.option-label{cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;height:32px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;transition:color var(--wui-duration-fast,.16s) ease, background-color var(--wui-duration-fast,.16s) ease;border-radius:2147483647px;align-items:center;gap:8px;padding:0 12px;display:flex;overflow:hidden}.check{flex-shrink:0}.content-wrap{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([selected])) .check{visibility:hidden}::slotted([slot=prefix]),::slotted([slot=suffix]){flex-shrink:0}.option-label:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}:host([active]) .option-label{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}@media (hover:hover) and (pointer:fine){.option-label:hover{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}:host([disabled]) .option-label{cursor:not-allowed}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.option-label{cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;height:32px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;transition:color var(--wui-duration-feedback,.12s) var(--wui-ease-out,cubic-bezier(.23, 1, .32, 1)), background-color var(--wui-duration-feedback,.12s) var(--wui-ease-out,cubic-bezier(.23, 1, .32, 1));border-radius:2147483647px;align-items:center;gap:8px;padding:0 12px;display:flex;overflow:hidden}.check{flex-shrink:0}.content-wrap{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([selected])) .check{visibility:hidden}::slotted([slot=prefix]),::slotted([slot=suffix]){flex-shrink:0}.option-label:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}:host([active]) .option-label{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}@media (hover:hover) and (pointer:fine){.option-label:hover{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}:host([disabled]) .option-label{cursor:not-allowed}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/option/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.option-label {\n cursor: pointer;\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n height: 32px;\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n\n transition:\n color var(--wui-duration-fast, 160ms) ease,\n background-color var(--wui-duration-fast, 160ms) ease;\n}\n\n.check {\n flex-shrink: 0;\n}\n\n.content-wrap {\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(:not([selected])) .check {\n visibility: hidden;\n}\n\n::slotted([slot='prefix']),\n::slotted([slot='suffix']) {\n flex-shrink: 0;\n}\n\n.option-label:focus-visible {\n outline: 3px solid var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n}\n\n:host([active]) .option-label {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .option-label:hover {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n:host([disabled]) .option-label {\n cursor: not-allowed;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/option/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.option-label {\n cursor: pointer;\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n height: 32px;\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n\n transition:\n color var(--wui-duration-feedback, 120ms) var(--wui-ease-out, cubic-bezier(0.23, 1, 0.32, 1)),\n background-color var(--wui-duration-feedback, 120ms) var(--wui-ease-out, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.check {\n flex-shrink: 0;\n}\n\n.content-wrap {\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(:not([selected])) .check {\n visibility: hidden;\n}\n\n::slotted([slot='prefix']),\n::slotted([slot='suffix']) {\n flex-shrink: 0;\n}\n\n.option-label:focus-visible {\n outline: 3px solid var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n}\n\n:host([active]) .option-label {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .option-label:hover {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n:host([disabled]) .option-label {\n cursor: not-allowed;\n}\n"],"mappings":""}
@@ -16,13 +16,12 @@ export declare class WebUiPopover extends LitElement {
16
16
  private _trigger;
17
17
  portal: boolean;
18
18
  overlayContainer?: OverlayContainer;
19
- private _overlay?;
20
19
  private _showTimer?;
21
20
  private _hideTimer?;
22
21
  private _suppressEvent;
23
- private _portal?;
24
22
  private _shouldOpenInstantly;
25
23
  private _panelId;
24
+ private readonly _panel;
26
25
  /** 当前是否打开 */
27
26
  get isOpen(): boolean;
28
27
  connectedCallback(): void;
@@ -37,11 +36,9 @@ export declare class WebUiPopover extends LitElement {
37
36
  toggle(): void;
38
37
  private _isInsideShadowRoot;
39
38
  private _syncTriggerListeners;
40
- private _initLocalOverlay;
41
39
  private _openOverlay;
42
- private _openPortal;
40
+ private _createPortal;
43
41
  private _closeOverlay;
44
- private _disposeOverlay;
45
42
  private _reconfigureOverlay;
46
43
  private _dispatchChange;
47
44
  private _focusPanel;