@greypan/web-ui 2.1.0 → 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 -38
  2. package/README.md +53 -47
  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 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport '@/components/option'\nimport glass from '@/assets/glass.css?inline'\nimport overlayMotion from '@/assets/overlay-motion.css?inline'\nimport type { WebUiOption } from '@/components/option'\nimport { lucideChevronDown } from '@/icons'\nimport { withOverlay } from '@/shared/overlay/overlay'\nimport type { OverlayApi } from '@/shared/overlay/overlay'\nimport { createOverlayPortal } from '@/shared/overlay/portal'\nimport type { OverlayContainer, OverlayPortal } from '@/shared/overlay/portal'\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\n@customElement('web-ui-select')\nexport class WebUiSelect extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(overlayMotion), unsafeCSS(style)]\n\n static formAssociated = true\n\n // ElementInternals 实例,在 connectedCallback 中初始化\n private _internals?: ElementInternals\n @state() private _formDisabled = false\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) portal = false\n @property({ reflect: true, attribute: 'lock-scroll', converter: booleanWithFalseString }) lockScroll = true\n @property({ attribute: false }) overlayContainer?: OverlayContainer\n @property({ type: String, reflect: true }) name = ''\n\n // value 使用内部状态 + 访问器模式,在变更时同步 ElementInternals\n @state() private _value = ''\n get value(): string {\n return this._value\n }\n set value(v: string) {\n const old = this._value\n this._value = v\n this._internals?.setFormValue?.(v)\n this.toggleAttribute('data-has-value', !!v)\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n @state() private _isOpen = false\n @state() private _activeIndex = -1\n @state() private _selectedLabel = ''\n @state() private _hasTriggerSlot = false\n\n private _options: WebUiOption[] = []\n private _overlay?: OverlayApi\n private _portal?: OverlayPortal\n private _hasScrollLock = false\n\n get isOpen(): boolean {\n return this._isOpen\n }\n\n get open(): boolean {\n return this._isOpen\n }\n\n private _onClickOutside = (e: MouseEvent) => {\n if (\n this._isOpen &&\n e.target instanceof Node &&\n !this.contains(e.target) &&\n !this._portal?.panel.contains(e.target)\n ) {\n this._close()\n }\n }\n\n private _onFocusOut = () => {\n requestAnimationFrame(() => {\n if (this._isOpen && !this.matches(':focus-within') && !this._portal?.panel.matches(':focus-within')) {\n this._close()\n }\n })\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this._internals = this.attachInternals()\n // 同步 HTML 属性中预设的 value,补全访问器模式不处理 attribute 反射\n const attrValue = this.getAttribute('value')\n if (attrValue !== null) {\n this._value = attrValue\n this.toggleAttribute('data-has-value', !!attrValue)\n }\n this._internals?.setFormValue?.(this._value)\n this.addEventListener('option-register', this._onOptionRegister)\n this.addEventListener('option-unregister', this._onOptionUnregister)\n this.addEventListener('keydown', this._onKeydown)\n this.addEventListener('focusout', this._onFocusOut)\n document.addEventListener('click', this._onClickOutside)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('option-register', this._onOptionRegister)\n this.removeEventListener('option-unregister', this._onOptionUnregister)\n this.removeEventListener('keydown', this._onKeydown)\n this.removeEventListener('focusout', this._onFocusOut)\n document.removeEventListener('click', this._onClickOutside)\n this._options.forEach(o => {\n o.removeEventListener('click', this._handleOptionClick)\n o.removeEventListener('pointerover', this._handleOptionPointerOver)\n o.removeEventListener('pointerdown', this._handleOptionPointerDown)\n o.removeEventListener('option-update', this._onOptionUpdate)\n })\n this._close()\n this._disposeOverlay()\n }\n\n override firstUpdated() {\n this._initLocalOverlay()\n requestAnimationFrame(() => {\n if (this.isConnected) this._onSlotChange()\n })\n }\n\n override willUpdate() {\n this._options = this._portal\n ? [...this._portal.panel.querySelectorAll<WebUiOption>('web-ui-option')]\n : [...this.querySelectorAll<WebUiOption>('web-ui-option')]\n this._ensureOptionIds()\n this._syncSelected()\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('portal') || changed.has('overlayContainer'))\n requestAnimationFrame(() => this._reconfigureOverlay())\n if (changed.has('lockScroll')) this._syncScrollLock()\n this._syncOpenAttribute()\n this._syncValidity()\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n private _syncValidity() {\n if (!this._internals || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this.value) this._internals.setValidity({})\n else this._internals.setValidity({ valueMissing: true }, '请选择一项')\n }\n\n private _syncOpenAttribute() {\n this.toggleAttribute('open', this._isOpen)\n }\n\n private _onTriggerSlotChange = (e: Event) => {\n const slot = e.target as HTMLSlotElement\n const hasContent = slot.assignedElements().length > 0\n if (this._hasTriggerSlot === hasContent) return\n this._hasTriggerSlot = hasContent\n this._reconfigureOverlay()\n }\n\n private _syncSelected() {\n this._options.forEach(o => {\n o.selected = o.value === this.value\n })\n if (!this.value) {\n this._selectedLabel = this.placeholder\n return\n }\n const option = this._options.find(o => o.value === this.value)\n this._selectedLabel = option?.label || this.placeholder\n }\n\n private _ensureOptionIds() {\n this._options.forEach((option, index) => {\n if (!option.id) option.id = `${this.localName}-option-${index}`\n })\n }\n\n private _onOptionRegister = (e: Event) => {\n if (!(e.target instanceof HTMLElement)) return\n const target = e.target as WebUiOption\n target.addEventListener('click', this._handleOptionClick)\n target.addEventListener('pointerover', this._handleOptionPointerOver)\n target.addEventListener('pointerdown', this._handleOptionPointerDown)\n target.addEventListener('option-update', this._onOptionUpdate)\n this._options.push(target)\n this._ensureOptionIds()\n this._syncSelected()\n }\n\n private _onOptionUnregister = (e: Event) => {\n if (!(e.target instanceof HTMLElement)) return\n const target = e.target as WebUiOption\n target.removeEventListener('click', this._handleOptionClick)\n target.removeEventListener('pointerover', this._handleOptionPointerOver)\n target.removeEventListener('pointerdown', this._handleOptionPointerDown)\n target.removeEventListener('option-update', this._onOptionUpdate)\n this._options = this._options.filter(o => o !== target)\n }\n\n private _onSlotChange = () => {\n const options = this._portal\n ? [...this._portal.panel.querySelectorAll<WebUiOption>('web-ui-option')]\n : [...this.querySelectorAll<WebUiOption>('web-ui-option')]\n this._options = options\n this._ensureOptionIds()\n this._syncSelected()\n }\n\n private _handleOptionClick = (e: Event) => {\n if (!(e.currentTarget instanceof HTMLElement)) return\n const option = e.currentTarget as WebUiOption\n if (option.disabled) return\n this.value = option.value\n this._close()\n this._notifyValueChange()\n }\n\n private _onOptionUpdate = () => {\n this._syncSelected()\n this._syncActiveOption()\n }\n\n private _handleOptionPointerOver = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n if (!this._isOpen || this._activeIndex < 0 || !(e.currentTarget instanceof HTMLElement)) return\n\n // 指针接管后只保留 :hover,避免键盘激活项与悬停项同时高亮。\n this._activeIndex = -1\n this._syncActiveOption()\n }\n\n private _handleOptionPointerDown = (e: PointerEvent) => {\n // 保持 trigger 焦点,避免 focusout 在 click 前关闭浮层。\n e.preventDefault()\n }\n\n private _onKeydown = (e: KeyboardEvent) => {\n if (this._isDisabled) return\n\n switch (e.key) {\n case 'Escape':\n if (this._isOpen) {\n this._close()\n e.preventDefault()\n }\n break\n case 'ArrowDown':\n e.preventDefault()\n if (!this._isOpen) {\n this._open(true)\n } else {\n this._navigateActive(1)\n }\n break\n case 'ArrowUp':\n e.preventDefault()\n if (!this._isOpen) this._open(true)\n else this._navigateActive(-1)\n break\n case 'Enter':\n if (this._isOpen && this._activeIndex >= 0) {\n const option = this._options[this._activeIndex]\n if (option && !option.disabled) {\n this.value = option.value\n this._notifyValueChange()\n }\n this._close()\n e.preventDefault()\n }\n break\n }\n }\n\n private _navigateActive(delta: number) {\n const enabled = this._options.filter(o => !o.disabled)\n if (!enabled.length) return\n\n const selectedOption = this._options.find(option => option.value === this.value && !option.disabled)\n const currentIdx =\n this._activeIndex >= 0\n ? enabled.indexOf(this._options[this._activeIndex])\n : selectedOption\n ? enabled.indexOf(selectedOption)\n : delta > 0\n ? -1\n : 0\n let nextIdx = currentIdx + delta\n if (nextIdx < 0) nextIdx = enabled.length - 1\n if (nextIdx >= enabled.length) nextIdx = 0\n\n const nextOption = enabled[nextIdx]\n this._activeIndex = this._options.indexOf(nextOption)\n\n this._syncActiveOption()\n }\n\n private _open(isKeyboardNavigation = false) {\n if (this._isDisabled || this._isOpen) return\n this._isOpen = true\n this._dispatchOpenChange()\n this._syncSelected()\n if (isKeyboardNavigation) this._setInitialActiveOption()\n else this._syncActiveOption()\n this._syncScrollLock()\n if (this.portal) {\n requestAnimationFrame(() => {\n if (this._isOpen) this._openOverlay(isKeyboardNavigation)\n })\n } else {\n this._openOverlay(isKeyboardNavigation)\n }\n }\n\n private _close() {\n if (!this._isOpen) return\n this._isOpen = false\n this._dispatchOpenChange()\n this._activeIndex = -1\n this._options.forEach(o => o.removeAttribute('active'))\n this._syncScrollLock(false)\n void this._closeOverlay()\n }\n\n private _dispatchOpenChange() {\n this.dispatchEvent(\n new CustomEvent('open-change', {\n detail: { open: this._isOpen },\n bubbles: true,\n composed: true\n })\n )\n }\n\n private _setInitialActiveOption() {\n const selectedIndex = this._options.findIndex(option => option.value === this.value && !option.disabled)\n const firstEnabledIndex = this._options.findIndex(option => !option.disabled)\n this._activeIndex = selectedIndex >= 0 ? selectedIndex : firstEnabledIndex\n this._syncActiveOption()\n }\n\n private _syncActiveOption() {\n this._options.forEach((option, index) => option.toggleAttribute('active', index === this._activeIndex))\n }\n\n private _notifyValueChange() {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private _syncScrollLock(isOpen = this._isOpen) {\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 _togglePopup() {\n if (this._isDisabled) return\n if (this._isOpen) this._close()\n else this._open()\n }\n\n private _initLocalOverlay() {\n const anchor = this.shadowRoot?.querySelector<HTMLElement>('.select-trigger')\n const panel = this.shadowRoot?.querySelector<HTMLElement>('.select-overlay')\n if (!anchor || !panel) return\n this._overlay = withOverlay.make({\n anchor,\n overlay: panel,\n placement: 'bottom-start',\n offset: 4\n })\n }\n\n private _openOverlay(isKeyboardNavigation = false) {\n if (this.portal) {\n this._openPortal(isKeyboardNavigation)\n } else {\n const panel = this.shadowRoot?.querySelector<HTMLElement>('.select-overlay')\n if (panel) panel.style.width = `${this._getDesiredWidth()}px`\n this._overlay?.open()\n if (panel) showOverlayPresence(panel, { isInstant: isKeyboardNavigation })\n }\n }\n\n private _getDesiredWidth(): number {\n const trigger = this.shadowRoot?.querySelector<HTMLElement>('.select-trigger')\n const triggerWidth = trigger?.offsetWidth || 0\n\n const options = [...this.querySelectorAll<WebUiOption>('web-ui-option')]\n let maxOptionWidth = 0\n options.forEach(opt => {\n const label = opt.shadowRoot?.querySelector<HTMLElement>('.option-label')\n const w = label?.scrollWidth || opt.scrollWidth || 0\n if (w > maxOptionWidth) maxOptionWidth = w\n })\n\n return Math.max(120, triggerWidth, maxOptionWidth)\n }\n\n private _openPortal(isKeyboardNavigation = false) {\n if (this._portal) {\n this._overlay?.open()\n showOverlayPresence(this._portal.panel, { isInstant: isKeyboardNavigation })\n return\n }\n const anchor = this.shadowRoot?.querySelector<HTMLElement>('.select-trigger')\n if (!anchor) return\n\n const desiredWidth = this._getDesiredWidth()\n\n const portal = createOverlayPortal({\n container: this.overlayContainer,\n target: this,\n style: `${glass}\\n${overlayMotion}\\n${style}`,\n className: 'wui-glass select-overlay portal wui-floating-panel'\n })\n portal.panel.style.width = `${desiredWidth}px`\n portal.panel.setAttribute('role', 'listbox')\n portal.moveContent(Array.from(this.children))\n this._portal = portal\n this._overlay = withOverlay.make({\n anchor,\n overlay: portal.panel,\n placement: 'bottom-start',\n offset: 4,\n strategy: 'fixed'\n })\n this._overlay.open()\n showOverlayPresence(portal.panel, { isInstant: isKeyboardNavigation })\n }\n\n private async _closeOverlay() {\n this._overlay?.close()\n const panel = this._portal?.panel ?? this.shadowRoot?.querySelector<HTMLElement>('.select-overlay')\n if (panel && !(await hideOverlayPresence(panel))) return\n if (!this._portal || this._isOpen) return\n this._portal.restoreContent()\n this._portal.remove()\n this._portal = undefined\n this._overlay = undefined\n }\n\n private _disposeOverlay() {\n this._overlay?.dispose()\n this._overlay = undefined\n this._portal?.restoreContent()\n this._portal?.remove()\n this._portal = undefined\n }\n\n private _reconfigureOverlay() {\n this._disposeOverlay()\n if (!this.portal) this._initLocalOverlay()\n if (this._isOpen) this._openOverlay()\n }\n\n override render() {\n return html`\n <div class=\"wui-select-inner\">\n <div\n class=\"wui-glass select-trigger\"\n ?data-custom-trigger=${this._hasTriggerSlot}\n @click=${this._togglePopup}\n tabindex=${this._isDisabled ? -1 : 0}\n role=\"combobox\"\n aria-expanded=${this._isOpen}\n aria-haspopup=\"listbox\"\n aria-disabled=${String(this._isDisabled)}\n aria-activedescendant=${this._isOpen && this._activeIndex >= 0\n ? this._options[this._activeIndex]?.id\n : nothing}\n >\n <slot name=\"trigger\" @slotchange=${this._onTriggerSlotChange}></slot>\n ${!this._hasTriggerSlot ? html`<span class=\"label\">${this._selectedLabel}</span>` : nothing}\n <web-ui-icon class=\"arrow\" .icon=${lucideChevronDown}></web-ui-icon>\n </div>\n <div class=\"wui-glass select-overlay wui-floating-panel\" hidden role=\"listbox\">\n <slot @slotchange=${this._onSlotChange}></slot>\n </div>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n 'open-change': CustomEvent<{ open: boolean }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-select': WebUiSelect\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBO,IAAM,IAAN,cAA0B,EAAW;;EAuOpB,aAhOW,KAA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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,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,SAAS;CAAM,WAAW;CAAe,WAAW;AAAuB,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACvF,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,oBAAA,KAAA,CAAA,GAC7B,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAGxC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GAgBN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,mBAAA,KAAA,CAAA,GAtCR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport '@/components/option'\nimport glass from '@/assets/glass.css?inline'\nimport overlayMotion from '@/assets/overlay-motion.css?inline'\nimport type { WebUiOption } from '@/components/option'\nimport { lucideChevronDown } from '@/icons'\nimport { defineAnchoredPanel } from '@/shared/overlay/anchored-panel'\nimport { createOverlayPortal } from '@/shared/overlay/portal'\nimport type { OverlayContainer, OverlayPortal } from '@/shared/overlay/portal'\nimport { createScrollLockLease } from '@/shared/scroll-lock/scroll-lock'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-select')\nexport class WebUiSelect extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(overlayMotion), unsafeCSS(style)]\n\n static formAssociated = true\n\n // ElementInternals 实例,在 connectedCallback 中初始化\n private _internals?: ElementInternals\n @state() private _formDisabled = false\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) portal = false\n @property({ type: Boolean, reflect: true, attribute: 'no-scroll-lock' }) noScrollLock = false\n @property({ attribute: false }) overlayContainer?: OverlayContainer\n @property({ type: String, reflect: true }) name = ''\n\n // value 使用内部状态 + 访问器模式,在变更时同步 ElementInternals\n @state() private _value = ''\n get value(): string {\n return this._value\n }\n set value(v: string) {\n const old = this._value\n this._value = v\n this._internals?.setFormValue?.(v)\n this.toggleAttribute('data-has-value', !!v)\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n @state() private _isOpen = false\n @state() private _activeIndex = -1\n @state() private _selectedLabel = ''\n @state() private _hasTriggerSlot = false\n\n private _options: WebUiOption[] = []\n private readonly _scrollLock = createScrollLockLease()\n private readonly _panel = defineAnchoredPanel().make({\n getAnchor: () => this.shadowRoot?.querySelector<HTMLElement>('.select-trigger') ?? null,\n getLocalPanel: () => this.shadowRoot?.querySelector<HTMLElement>('.select-overlay') ?? null,\n getPositioning: () => ({ placement: 'bottom-start', offset: 4, strategy: this.portal ? 'fixed' : 'absolute' }),\n isPortal: () => this.portal,\n createPortal: () => this._createPortal()\n })\n\n get isOpen(): boolean {\n return this._isOpen\n }\n\n get open(): boolean {\n return this._isOpen\n }\n\n private _onClickOutside = (e: MouseEvent) => {\n if (\n this._isOpen &&\n e.target instanceof Node &&\n !this.contains(e.target) &&\n !this._panel.getPanel()?.contains(e.target)\n ) {\n this._close()\n }\n }\n\n private _onFocusOut = () => {\n requestAnimationFrame(() => {\n if (this._isOpen && !this.matches(':focus-within') && !this._panel.getPanel()?.matches(':focus-within')) {\n this._close()\n }\n })\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this._internals = this.attachInternals()\n // 同步 HTML 属性中预设的 value,补全访问器模式不处理 attribute 反射\n const attrValue = this.getAttribute('value')\n if (attrValue !== null) {\n this._value = attrValue\n this.toggleAttribute('data-has-value', !!attrValue)\n }\n this._internals?.setFormValue?.(this._value)\n this.addEventListener('option-register', this._onOptionRegister)\n this.addEventListener('option-unregister', this._onOptionUnregister)\n this.addEventListener('keydown', this._onKeydown)\n this.addEventListener('focusout', this._onFocusOut)\n document.addEventListener('click', this._onClickOutside)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('option-register', this._onOptionRegister)\n this.removeEventListener('option-unregister', this._onOptionUnregister)\n this.removeEventListener('keydown', this._onKeydown)\n this.removeEventListener('focusout', this._onFocusOut)\n document.removeEventListener('click', this._onClickOutside)\n this._options.forEach(o => {\n o.removeEventListener('click', this._handleOptionClick)\n o.removeEventListener('pointerover', this._handleOptionPointerOver)\n o.removeEventListener('pointerdown', this._handleOptionPointerDown)\n o.removeEventListener('option-update', this._onOptionUpdate)\n })\n this._close()\n this._panel.dispose()\n this._scrollLock.release()\n }\n\n override firstUpdated() {\n requestAnimationFrame(() => {\n if (this.isConnected) this._onSlotChange()\n })\n }\n\n override willUpdate() {\n this._options =\n this.portal && this._panel.getPanel()\n ? [...this._panel.getPanel()!.querySelectorAll<WebUiOption>('web-ui-option')]\n : [...this.querySelectorAll<WebUiOption>('web-ui-option')]\n this._ensureOptionIds()\n this._syncSelected()\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('portal') || changed.has('overlayContainer'))\n requestAnimationFrame(() => this._reconfigureOverlay())\n if (changed.has('noScrollLock')) this._syncScrollLock()\n this._syncOpenAttribute()\n this._syncValidity()\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n private _syncValidity() {\n if (!this._internals || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this.value) this._internals.setValidity({})\n else this._internals.setValidity({ valueMissing: true }, '请选择一项')\n }\n\n private _syncOpenAttribute() {\n this.toggleAttribute('open', this._isOpen)\n }\n\n private _onTriggerSlotChange = (e: Event) => {\n const slot = e.target as HTMLSlotElement\n const hasContent = slot.assignedElements().length > 0\n if (this._hasTriggerSlot === hasContent) return\n this._hasTriggerSlot = hasContent\n this._reconfigureOverlay()\n }\n\n private _syncSelected() {\n this._options.forEach(o => {\n o.selected = o.value === this.value\n })\n if (!this.value) {\n this._selectedLabel = this.placeholder\n return\n }\n const option = this._options.find(o => o.value === this.value)\n this._selectedLabel = option?.label || this.placeholder\n }\n\n private _ensureOptionIds() {\n this._options.forEach((option, index) => {\n if (!option.id) option.id = `${this.localName}-option-${index}`\n })\n }\n\n private _onOptionRegister = (e: Event) => {\n if (!(e.target instanceof HTMLElement)) return\n const target = e.target as WebUiOption\n target.addEventListener('click', this._handleOptionClick)\n target.addEventListener('pointerover', this._handleOptionPointerOver)\n target.addEventListener('pointerdown', this._handleOptionPointerDown)\n target.addEventListener('option-update', this._onOptionUpdate)\n this._options.push(target)\n this._ensureOptionIds()\n this._syncSelected()\n }\n\n private _onOptionUnregister = (e: Event) => {\n if (!(e.target instanceof HTMLElement)) return\n const target = e.target as WebUiOption\n target.removeEventListener('click', this._handleOptionClick)\n target.removeEventListener('pointerover', this._handleOptionPointerOver)\n target.removeEventListener('pointerdown', this._handleOptionPointerDown)\n target.removeEventListener('option-update', this._onOptionUpdate)\n this._options = this._options.filter(o => o !== target)\n }\n\n private _onSlotChange = () => {\n const options =\n this.portal && this._panel.getPanel()\n ? [...this._panel.getPanel()!.querySelectorAll<WebUiOption>('web-ui-option')]\n : [...this.querySelectorAll<WebUiOption>('web-ui-option')]\n this._options = options\n this._ensureOptionIds()\n this._syncSelected()\n }\n\n private _handleOptionClick = (e: Event) => {\n if (!(e.currentTarget instanceof HTMLElement)) return\n const option = e.currentTarget as WebUiOption\n if (option.disabled) return\n this.value = option.value\n this._close()\n this._notifyValueChange()\n }\n\n private _onOptionUpdate = () => {\n this._syncSelected()\n this._syncActiveOption()\n }\n\n private _handleOptionPointerOver = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n if (!this._isOpen || this._activeIndex < 0 || !(e.currentTarget instanceof HTMLElement)) return\n\n // 指针接管后只保留 :hover,避免键盘激活项与悬停项同时高亮。\n this._activeIndex = -1\n this._syncActiveOption()\n }\n\n private _handleOptionPointerDown = (e: PointerEvent) => {\n // 保持 trigger 焦点,避免 focusout 在 click 前关闭浮层。\n e.preventDefault()\n }\n\n private _onKeydown = (e: KeyboardEvent) => {\n if (this._isDisabled) return\n\n switch (e.key) {\n case 'Escape':\n if (this._isOpen) {\n this._close()\n e.preventDefault()\n }\n break\n case 'ArrowDown':\n e.preventDefault()\n if (!this._isOpen) {\n this._open(true)\n } else {\n this._navigateActive(1)\n }\n break\n case 'ArrowUp':\n e.preventDefault()\n if (!this._isOpen) this._open(true)\n else this._navigateActive(-1)\n break\n case 'Enter':\n if (this._isOpen && this._activeIndex >= 0) {\n const option = this._options[this._activeIndex]\n if (option && !option.disabled) {\n this.value = option.value\n this._notifyValueChange()\n }\n this._close()\n e.preventDefault()\n }\n break\n }\n }\n\n private _navigateActive(delta: number) {\n const enabled = this._options.filter(o => !o.disabled)\n if (!enabled.length) return\n\n const selectedOption = this._options.find(option => option.value === this.value && !option.disabled)\n const currentIdx =\n this._activeIndex >= 0\n ? enabled.indexOf(this._options[this._activeIndex])\n : selectedOption\n ? enabled.indexOf(selectedOption)\n : delta > 0\n ? -1\n : 0\n let nextIdx = currentIdx + delta\n if (nextIdx < 0) nextIdx = enabled.length - 1\n if (nextIdx >= enabled.length) nextIdx = 0\n\n const nextOption = enabled[nextIdx]\n this._activeIndex = this._options.indexOf(nextOption)\n\n this._syncActiveOption()\n }\n\n private _open(isKeyboardNavigation = false) {\n if (this._isDisabled || this._isOpen) return\n this._isOpen = true\n this._dispatchOpenChange()\n this._syncSelected()\n if (isKeyboardNavigation) this._setInitialActiveOption()\n else this._syncActiveOption()\n this._syncScrollLock()\n if (this.portal) {\n requestAnimationFrame(() => {\n if (this._isOpen) this._openOverlay(isKeyboardNavigation)\n })\n } else {\n this._openOverlay(isKeyboardNavigation)\n }\n }\n\n private _close() {\n if (!this._isOpen) return\n this._isOpen = false\n this._dispatchOpenChange()\n this._activeIndex = -1\n this._options.forEach(o => o.removeAttribute('active'))\n this._syncScrollLock(false)\n void this._closeOverlay()\n }\n\n private _dispatchOpenChange() {\n this.dispatchEvent(\n new CustomEvent('open-change', {\n detail: { open: this._isOpen },\n bubbles: true,\n composed: true\n })\n )\n }\n\n private _setInitialActiveOption() {\n const selectedIndex = this._options.findIndex(option => option.value === this.value && !option.disabled)\n const firstEnabledIndex = this._options.findIndex(option => !option.disabled)\n this._activeIndex = selectedIndex >= 0 ? selectedIndex : firstEnabledIndex\n this._syncActiveOption()\n }\n\n private _syncActiveOption() {\n this._options.forEach((option, index) => option.toggleAttribute('active', index === this._activeIndex))\n }\n\n private _notifyValueChange() {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private _syncScrollLock(isOpen = this._isOpen) {\n this._scrollLock.sync(isOpen && !this.noScrollLock)\n }\n\n private _togglePopup() {\n if (this._isDisabled) return\n if (this._isOpen) this._close()\n else this._open()\n }\n\n private _openOverlay(isKeyboardNavigation = false) {\n const panel = !this.portal ? this._panel.getPanel() : null\n if (panel) panel.style.width = `${this._getDesiredWidth()}px`\n this._panel.open(isKeyboardNavigation)\n }\n\n private _getDesiredWidth(): number {\n const trigger = this.shadowRoot?.querySelector<HTMLElement>('.select-trigger')\n const triggerWidth = trigger?.offsetWidth || 0\n\n const options = [...this.querySelectorAll<WebUiOption>('web-ui-option')]\n let maxOptionWidth = 0\n options.forEach(opt => {\n const label = opt.shadowRoot?.querySelector<HTMLElement>('.option-label')\n const w = label?.scrollWidth || opt.scrollWidth || 0\n if (w > maxOptionWidth) maxOptionWidth = w\n })\n\n return Math.max(120, triggerWidth, maxOptionWidth)\n }\n\n private _createPortal(): OverlayPortal {\n const desiredWidth = this._getDesiredWidth()\n\n const portal = createOverlayPortal({\n container: this.overlayContainer,\n target: this,\n style: `${glass}\\n${overlayMotion}\\n${style}`,\n className: 'wui-glass select-overlay portal wui-floating-panel'\n })\n portal.panel.style.width = `${desiredWidth}px`\n portal.panel.setAttribute('role', 'listbox')\n const scroll = document.createElement('div')\n scroll.className = 'select-scroll'\n const content = document.createElement('div')\n content.className = 'select-content'\n scroll.append(content)\n portal.panel.append(scroll)\n portal.moveContent(Array.from(this.children), content)\n return portal\n }\n\n private async _closeOverlay() {\n await this._panel.close(() => this._isOpen)\n }\n\n private _reconfigureOverlay() {\n if (!this.portal) {\n const panel = this._panel.getPanel()\n if (panel) panel.style.width = `${this._getDesiredWidth()}px`\n }\n this._panel.reconfigure(this._isOpen)\n }\n\n override render() {\n return html`\n <div class=\"wui-select-inner\">\n <div\n class=\"wui-glass select-trigger\"\n ?data-custom-trigger=${this._hasTriggerSlot}\n @click=${this._togglePopup}\n tabindex=${this._isDisabled ? -1 : 0}\n role=\"combobox\"\n aria-expanded=${this._isOpen}\n aria-haspopup=\"listbox\"\n aria-disabled=${String(this._isDisabled)}\n aria-activedescendant=${this._isOpen && this._activeIndex >= 0\n ? this._options[this._activeIndex]?.id\n : nothing}\n >\n <slot name=\"trigger\" @slotchange=${this._onTriggerSlotChange}></slot>\n ${!this._hasTriggerSlot ? html`<span class=\"label\">${this._selectedLabel}</span>` : nothing}\n <web-ui-icon class=\"arrow\" .icon=${lucideChevronDown}></web-ui-icon>\n </div>\n <div class=\"wui-glass select-overlay wui-floating-panel\" hidden role=\"listbox\">\n <div class=\"select-scroll\">\n <div class=\"select-content\">\n <slot @slotchange=${this._onSlotChange}></slot>\n </div>\n </div>\n </div>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n 'open-change': CustomEvent<{ open: boolean }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-select': WebUiSelect\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAiBO,IAAM,IAAN,cAA0B,EAAW;;EA8OpB,aAvOW,KAAA,gBAAA,IAEwB,KAAA,cAAA,IACF,KAAA,WAAA,IACA,KAAA,WAAA,IACF,KAAA,SAAA,IACmC,KAAA,eAAA,IAEtC,KAAA,OAAA,IAGxB,KAAA,SAAA,IAgBC,KAAA,UAAA,IACK,KAAA,eAAA,IACE,KAAA,iBAAA,IACC,KAAA,kBAAA,IAED,KAAA,WAAA,CAAC,GACJ,KAAA,cAAA,EAAsB,GAC3B,KAAA,SAAA,EAAoB,CAAC,CAAC,KAAK;GACnD,iBAAiB,KAAK,YAAY,cAA2B,iBAAiB,KAAK;GACnF,qBAAqB,KAAK,YAAY,cAA2B,iBAAiB,KAAK;GACvF,uBAAuB;IAAE,WAAW;IAAgB,QAAQ;IAAG,UAAU,KAAK,SAAS,UAAU;GAAW;GAC5G,gBAAgB,KAAK;GACrB,oBAAoB,KAAK,cAAc;EACzC,CAAC,GAU0B,KAAA,mBAAA,MAAkB;GAC3C,AACE,KAAK,WACL,EAAE,kBAAkB,QACpB,CAAC,KAAK,SAAS,EAAE,MAAM,KACvB,CAAC,KAAK,OAAO,SAAS,CAAC,EAAE,SAAS,EAAE,MAAM,KAE1C,KAAK,OAAO;EAEhB,GAE4B,KAAA,oBAAA;GAC1B,4BAA4B;IAC1B,AAAI,KAAK,WAAW,CAAC,KAAK,Q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AS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,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,UAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAiB,CAAC,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GACtE,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,oBAAA,KAAA,CAAA,GAC7B,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAGxC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GAgBN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,mBAAA,KAAA,CAAA,GAtCR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/select/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}.wui-select-inner{flex-direction:column;display:flex;position:relative}.select-trigger{cursor:pointer;box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);border-radius:2147483647px;align-items:center;gap:8px;padding:0 16px;display:flex}.select-trigger:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}.select-trigger[data-custom-trigger]{width:auto}:host([disabled]) .select-trigger{cursor:not-allowed}.label{font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([data-has-value])) .label{color:var(--wui-color-text-muted,#6a6a6a)}::slotted([slot=trigger]){font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.arrow{color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0}:host([open]) .arrow{transform:rotate(180deg)}.select-overlay{--wui-glass-shadow:var(--wui-shadow-pop,0 3px 9px #00000045);z-index:var(--wui-layer-local-overlay,1);box-sizing:border-box;min-width:200px;max-width:var(--wui-select-max-width,500px);background-color:var(--wui-color-surface-overlay,#f6f6f6e0);border-radius:20px;max-height:320px;padding:4px;position:absolute;overflow-y:auto}:host([portal]) .select-overlay{display:none}.select-overlay.portal{z-index:var(--wui-layer-menu,100);position:fixed}.select-overlay.hidden{display:none}";
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}.wui-select-inner{flex-direction:column;display:flex;position:relative}.select-trigger{cursor:pointer;box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);border-radius:2147483647px;align-items:center;gap:8px;padding:0 16px;display:flex}.select-trigger:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}.select-trigger[data-custom-trigger]{width:auto}:host([disabled]) .select-trigger{cursor:not-allowed}.label{font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([data-has-value])) .label{color:var(--wui-color-text-muted,#6a6a6a)}::slotted([slot=trigger]){font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.arrow{color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0}:host([open]) .arrow{transform:rotate(180deg)}.select-overlay{--wui-glass-shadow:var(--wui-shadow-pop,0 3px 9px #00000045);--wui-duration-overlay-enter:var(--wui-duration-menu-enter,.14s);--wui-duration-overlay-exit:var(--wui-duration-menu-exit,.1s);z-index:var(--wui-layer-local-overlay,1);box-sizing:border-box;min-width:200px;max-width:var(--wui-select-max-width,500px);background-color:var(--wui-color-surface-overlay,#f6f6f6e0);border-radius:20px;position:absolute;overflow:hidden}.select-overlay.portal{z-index:var(--wui-layer-menu,100);position:fixed}.select-overlay.hidden{display:none}.select-scroll{max-height:320px;overflow-y:auto}.select-content{padding:4px}:host([portal]) .select-overlay{display:none}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/select/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.wui-select-inner {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.select-trigger {\n cursor: pointer;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-button-size, 40px);\n height: var(--wui-button-size, 40px);\n padding: 0 16px;\n border-radius: calc(infinity * 1px);\n\n &:focus-visible {\n outline: 3px solid var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n }\n}\n\n.select-trigger[data-custom-trigger] {\n width: auto;\n}\n\n:host([disabled]) .select-trigger {\n cursor: not-allowed;\n}\n\n.label {\n overflow: hidden;\n flex: 1;\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\n:host(:not([data-has-value])) .label {\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n::slotted([slot='trigger']) {\n overflow: hidden;\n flex: 1;\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\n.arrow {\n flex-shrink: 0;\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n:host([open]) .arrow {\n transform: rotate(180deg);\n}\n\n/* ===== 浮层(glass 样式参考 dialog) ===== */\n\n.select-overlay {\n --wui-glass-shadow: var(--wui-shadow-pop, 0 3px 9px rgb(0 0 0 / 0.27));\n position: absolute;\n z-index: var(--wui-layer-local-overlay, 1);\n\n overflow-y: auto;\n\n box-sizing: border-box;\n min-width: 200px;\n max-width: var(--wui-select-max-width, 500px);\n max-height: 320px;\n padding: 4px;\n border-radius: 20px;\n\n background-color: var(--wui-color-surface-overlay, rgb(246 246 246 / 0.88));\n}\n\n:host([portal]) .select-overlay {\n display: none;\n}\n\n.select-overlay.portal {\n position: fixed;\n z-index: var(--wui-layer-menu, 100);\n}\n\n.select-overlay.hidden {\n display: none;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/select/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.wui-select-inner {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.select-trigger {\n cursor: pointer;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-button-size, 40px);\n height: var(--wui-button-size, 40px);\n padding: 0 16px;\n border-radius: calc(infinity * 1px);\n\n &:focus-visible {\n outline: 3px solid var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n }\n}\n\n.select-trigger[data-custom-trigger] {\n width: auto;\n}\n\n:host([disabled]) .select-trigger {\n cursor: not-allowed;\n}\n\n.label {\n overflow: hidden;\n flex: 1;\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\n:host(:not([data-has-value])) .label {\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n::slotted([slot='trigger']) {\n overflow: hidden;\n flex: 1;\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\n.arrow {\n flex-shrink: 0;\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n:host([open]) .arrow {\n transform: rotate(180deg);\n}\n\n/* ===== 浮层(glass 样式参考 dialog) ===== */\n\n.select-overlay {\n --wui-glass-shadow: var(--wui-shadow-pop, 0 3px 9px rgb(0 0 0 / 0.27));\n --wui-duration-overlay-enter: var(--wui-duration-menu-enter, 140ms);\n --wui-duration-overlay-exit: var(--wui-duration-menu-exit, 100ms);\n position: absolute;\n z-index: var(--wui-layer-local-overlay, 1);\n\n overflow: hidden;\n\n box-sizing: border-box;\n min-width: 200px;\n max-width: var(--wui-select-max-width, 500px);\n border-radius: 20px;\n\n background-color: var(--wui-color-surface-overlay, rgb(246 246 246 / 0.88));\n\n &.portal {\n position: fixed;\n z-index: var(--wui-layer-menu, 100);\n }\n\n &.hidden {\n display: none;\n }\n}\n\n.select-scroll {\n overflow-y: auto;\n max-height: 320px;\n}\n\n.select-content {\n padding: 4px;\n}\n\n:host([portal]) .select-overlay {\n display: none;\n}\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/switch/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed}.sr-only{white-space:nowrap;clip-path:inset(50%);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.wui-switch-track{cursor:pointer;-webkit-user-select:none;user-select:none;background-color:var(--wui-color-surface-raised-deep,#e5e5ea);outline-offset:2px;border-radius:2147483647px;outline:3px solid #0000;justify-content:space-between;align-items:center;width:48px;height:24px;transition:background-color .25s;display:flex;position:relative}.wui-switch-track:focus-visible{outline-color:var(--wui-focus-ring,#08f6)}.wui-switch-track.is-open{background-color:var(--wui-color-accent,#08f)}.wui-switch-track.is-disabled{cursor:not-allowed;opacity:.4}.wui-switch-thumb{border-radius:2147483647px;width:20px;height:20px;transition:width .15s cubic-bezier(.4,0,.2,1),transform .25s cubic-bezier(.4,0,.2,1),border-radius .15s cubic-bezier(.4,0,.2,1),background-color .15s;position:absolute;top:2px;left:2px;overflow:hidden}.wui-switch-thumb.is-pressed{background-color:#0000;border-radius:2147483647px;width:32px}.wui-switch-thumb:not(.is-pressed){background-color:var(--wui-color-surface,#fff);box-shadow:1px 2px 6px #0003}.wui-switch-track.is-open .wui-switch-thumb{transform:translate(24px)}.wui-switch-track.is-open .wui-switch-thumb.is-pressed{transform:translate(12px)}.wui-switch-loading{pointer-events:none;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed}.sr-only{white-space:nowrap;clip-path:inset(50%);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.wui-switch-track{cursor:pointer;-webkit-user-select:none;user-select:none;background-color:var(--wui-color-surface-raised-deep,#e5e5ea);outline-offset:2px;width:48px;height:24px;transition:background-color var(--wui-duration-fast,.16s) ease;border-radius:2147483647px;outline:3px solid #0000;justify-content:space-between;align-items:center;display:flex;position:relative}.wui-switch-track:focus-visible{outline-color:var(--wui-focus-ring,#08f6)}.wui-switch-track.is-open{background-color:var(--wui-color-accent,#08f)}.wui-switch-track.is-disabled{cursor:not-allowed;opacity:.4}.wui-switch-thumb{width:20px;height:20px;transition:width var(--wui-duration-press,.12s) cubic-bezier(.4, 0, .2, 1), transform var(--wui-duration-fast,.16s) cubic-bezier(.4, 0, .2, 1), border-radius var(--wui-duration-press,.12s) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,.12s) ease;border-radius:2147483647px;position:absolute;top:2px;left:2px;overflow:hidden}.wui-switch-thumb.is-pressed{background-color:#0000;border-radius:2147483647px;width:32px}.wui-switch-thumb:not(.is-pressed){background-color:var(--wui-color-surface,#fff);box-shadow:1px 2px 6px #0003}.wui-switch-track.is-open .wui-switch-thumb{transform:translate(24px)}.wui-switch-track.is-open .wui-switch-thumb.is-pressed{transform:translate(12px)}.wui-switch-loading{pointer-events:none;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/switch/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n/*\n标准视觉隐藏技术(sr-only):\n业内标准的“屏幕阅读器专用”隐藏方案。\n把复选框缩放到 1x1 像素,但保留在 dom 中,\n既让肉眼看不见,又能让读屏软件识别,并允许键盘用户通过空格键切换状态。\n*/\n.sr-only {\n position: absolute;\n\n overflow: hidden;\n\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n\n white-space: nowrap;\n\n clip-path: inset(50%);\n}\n\n.wui-switch-track {\n cursor: pointer;\n user-select: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n width: 48px;\n height: 24px;\n border-radius: calc(infinity * 1px);\n\n background-color: var(--wui-color-surface-raised-deep, #e5e5ea);\n outline: 3px solid transparent;\n outline-offset: 2px;\n\n transition: background-color 0.25s ease;\n\n &:focus-visible {\n outline-color: var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n }\n\n &.is-open {\n background-color: var(--wui-color-accent, #08f);\n }\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n.wui-switch-thumb {\n position: absolute;\n top: 2px;\n left: 2px;\n\n overflow: hidden;\n\n width: 20px;\n height: 20px;\n border-radius: calc(infinity * 1px);\n\n transition:\n width 0.15s cubic-bezier(0.4, 0, 0.2, 1),\n transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),\n border-radius 0.15s cubic-bezier(0.4, 0, 0.2, 1),\n background-color 0.15s ease;\n\n &.is-pressed {\n width: 32px;\n border-radius: calc(infinity * 1px);\n background-color: transparent;\n }\n\n &:not(.is-pressed) {\n background-color: var(--wui-color-surface, #fff);\n box-shadow: 1px 2px 6px rgb(0 0 0 / 0.2);\n }\n}\n\n.wui-switch-track.is-open .wui-switch-thumb {\n transform: translateX(24px);\n\n &.is-pressed {\n transform: translateX(12px);\n }\n}\n\n.wui-switch-loading {\n pointer-events: none;\n\n position: absolute;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/switch/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n/*\n标准视觉隐藏技术(sr-only):\n业内标准的“屏幕阅读器专用”隐藏方案。\n把复选框缩放到 1x1 像素,但保留在 dom 中,\n既让肉眼看不见,又能让读屏软件识别,并允许键盘用户通过空格键切换状态。\n*/\n.sr-only {\n position: absolute;\n\n overflow: hidden;\n\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n\n white-space: nowrap;\n\n clip-path: inset(50%);\n}\n\n.wui-switch-track {\n cursor: pointer;\n user-select: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n width: 48px;\n height: 24px;\n border-radius: calc(infinity * 1px);\n\n background-color: var(--wui-color-surface-raised-deep, #e5e5ea);\n outline: 3px solid transparent;\n outline-offset: 2px;\n\n transition: background-color var(--wui-duration-fast, 160ms) ease;\n\n &:focus-visible {\n outline-color: var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n }\n\n &.is-open {\n background-color: var(--wui-color-accent, #08f);\n }\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n.wui-switch-thumb {\n position: absolute;\n top: 2px;\n left: 2px;\n\n overflow: hidden;\n\n width: 20px;\n height: 20px;\n border-radius: calc(infinity * 1px);\n\n transition:\n width var(--wui-duration-press, 120ms) cubic-bezier(0.4, 0, 0.2, 1),\n transform var(--wui-duration-fast, 160ms) cubic-bezier(0.4, 0, 0.2, 1),\n border-radius var(--wui-duration-press, 120ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 120ms) ease;\n\n &.is-pressed {\n width: 32px;\n border-radius: calc(infinity * 1px);\n background-color: transparent;\n }\n\n &:not(.is-pressed) {\n background-color: var(--wui-color-surface, #fff);\n box-shadow: 1px 2px 6px rgb(0 0 0 / 0.2);\n }\n}\n\n.wui-switch-track.is-open .wui-switch-thumb {\n transform: translateX(24px);\n\n &.is-pressed {\n transform: translateX(12px);\n }\n}\n\n.wui-switch-loading {\n pointer-events: none;\n\n position: absolute;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n}\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/theme/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{--wui-layer-base:0;--wui-layer-header:10;--wui-layer-auxiliary:20;--wui-layer-local-overlay:1;--wui-layer-menu:100;--wui-layer-menu-submenu:110;--wui-layer-toast:200;--wui-layer-loading:300;--wui-duration-press:.12s;--wui-duration-fast:.16s;--wui-duration-overlay-enter:.18s;--wui-duration-overlay-exit:.14s;--wui-duration-drawer:.28s;--wui-ease-out:cubic-bezier(.23, 1, .32, 1);--wui-ease-standard:cubic-bezier(.77, 0, .175, 1);--wui-scale-press:.97;--wui-scale-enter:.97;display:contents}:host([motion=reduced]){--wui-duration-press:0s;--wui-duration-fast:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer:0s;--wui-scale-press:1;--wui-scale-enter:1}@media (prefers-reduced-motion:reduce){:host([motion=system]){--wui-duration-press:0s;--wui-duration-fast:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer:0s;--wui-scale-press:1;--wui-scale-enter:1}}:host([appearance=light]),:host([appearance=system]){--wui-color-page:#fff;--wui-color-surface:#fff;--wui-color-surface-raised:#f2f2f7;--wui-color-surface-raised-mid:#dfdfdf;--wui-color-surface-raised-deep:#e5e5ea;--wui-color-surface-glass:#fafafa8c;--wui-color-surface-overlay:#f6f6f6e0;--wui-color-text:#1b1b1b;--wui-color-text-muted:#6a6a6a;--wui-color-border:#0000001a;--wui-color-border-strong:#006ee680;--wui-color-glass-border:#33333314;--wui-color-glass-highlight:#ffffffe6;--wui-color-accent:#08f;--wui-color-on-accent:#fff;--wui-color-success:#16a34a;--wui-color-warning:#d97706;--wui-color-danger:#dc2626;--wui-color-info:#2563eb;--wui-color-backdrop:#0000001f;--wui-shadow-overlay:2px 16px 40px #0006;--wui-shadow-pop:0 3px 9px #00000045;--wui-shadow-glass:0 2px 16px #0000000f;--wui-focus-ring:#08f6;--lightningcss-light:initial;--lightningcss-dark: ;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:host([appearance=dark]){--wui-color-page:#18181a;--wui-color-surface:#2c2c2e;--wui-color-surface-raised:#2c2c2e;--wui-color-surface-raised-mid:#3a3a3c;--wui-color-surface-raised-deep:#444446;--wui-color-surface-glass:#2c2c2ea6;--wui-color-surface-overlay:#2c2c2ed1;--wui-color-text:#f5f5f7;--wui-color-text-muted:#a1a1a6;--wui-color-border:#ffffff24;--wui-color-border-strong:#0a84ffb8;--wui-color-glass-border:#ffffff29;--wui-color-glass-highlight:#ffffff38;--wui-color-accent:#0a84ff;--wui-color-on-accent:#fff;--wui-color-success:#30d158;--wui-color-warning:#ff9f0a;--wui-color-danger:#ff453a;--wui-color-info:#64d2ff;--wui-color-backdrop:#0000007a;--wui-shadow-overlay:0 18px 48px #0000008a;--wui-shadow-pop:0 4px 16px #00000059;--wui-shadow-glass:0 8px 24px #00000057;--wui-focus-ring:#0a84ff9e;--lightningcss-light: ;--lightningcss-dark:initial;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}@media (prefers-color-scheme:dark){:host([appearance=system]){--wui-color-page:#18181a;--wui-color-surface:#2c2c2e;--wui-color-surface-raised:#2c2c2e;--wui-color-surface-raised-mid:#3a3a3c;--wui-color-surface-raised-deep:#444446;--wui-color-surface-glass:#2c2c2ea6;--wui-color-surface-overlay:#2c2c2ed1;--wui-color-text:#f5f5f7;--wui-color-text-muted:#a1a1a6;--wui-color-border:#ffffff24;--wui-color-border-strong:#0a84ffb8;--wui-color-glass-border:#ffffff29;--wui-color-glass-highlight:#ffffff38;--wui-color-accent:#0a84ff;--wui-color-on-accent:#fff;--wui-color-success:#30d158;--wui-color-warning:#ff9f0a;--wui-color-danger:#ff453a;--wui-color-info:#64d2ff;--wui-color-backdrop:#0000007a;--wui-shadow-overlay:0 18px 48px #0000008a;--wui-shadow-pop:0 4px 16px #00000059;--wui-shadow-glass:0 8px 24px #00000057;--wui-focus-ring:#0a84ff9e;--lightningcss-light: ;--lightningcss-dark:initial;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{--wui-layer-base:0;--wui-layer-header:10;--wui-layer-auxiliary:20;--wui-layer-local-overlay:1;--wui-layer-menu:100;--wui-layer-menu-submenu:110;--wui-layer-toast:200;--wui-layer-loading:300;--wui-duration-press:.12s;--wui-duration-feedback:.12s;--wui-duration-fast:.16s;--wui-duration-menu-enter:.14s;--wui-duration-menu-exit:.1s;--wui-duration-overlay-enter:.18s;--wui-duration-overlay-exit:.14s;--wui-duration-drawer:.28s;--wui-ease-out:cubic-bezier(.23, 1, .32, 1);--wui-ease-standard:cubic-bezier(.77, 0, .175, 1);--wui-scale-press:.97;--wui-scale-enter:.97;display:contents}:host([motion=reduced]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-fast:0s;--wui-duration-menu-enter:0s;--wui-duration-menu-exit:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer:0s;--wui-scale-press:1;--wui-scale-enter:1}@media (prefers-reduced-motion:reduce){:host([motion=system]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-fast:0s;--wui-duration-menu-enter:0s;--wui-duration-menu-exit:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer:0s;--wui-scale-press:1;--wui-scale-enter:1}}:host([appearance=light]),:host([appearance=system]){--wui-color-page:#fff;--wui-color-surface:#fff;--wui-color-surface-raised:#f2f2f7;--wui-color-surface-raised-mid:#dfdfdf;--wui-color-surface-raised-deep:#e5e5ea;--wui-color-surface-glass:#fafafa8c;--wui-color-surface-overlay:#f6f6f6e0;--wui-color-text:#1b1b1b;--wui-color-text-muted:#6a6a6a;--wui-color-border:#0000001a;--wui-color-border-strong:#006ee680;--wui-color-glass-border:#33333314;--wui-color-glass-highlight:#ffffffe6;--wui-color-accent:#08f;--wui-color-on-accent:#fff;--wui-color-success:#16a34a;--wui-color-warning:#d97706;--wui-color-danger:#dc2626;--wui-color-info:#2563eb;--wui-color-backdrop:#0000001f;--wui-shadow-overlay:2px 16px 40px #0006;--wui-shadow-pop:0 3px 9px #00000045;--wui-shadow-glass:0 2px 16px #0000000f;--wui-focus-ring:#08f6;--lightningcss-light:initial;--lightningcss-dark: ;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:host([appearance=dark]){--wui-color-page:#18181a;--wui-color-surface:#2c2c2e;--wui-color-surface-raised:#2c2c2e;--wui-color-surface-raised-mid:#3a3a3c;--wui-color-surface-raised-deep:#444446;--wui-color-surface-glass:#2c2c2ea6;--wui-color-surface-overlay:#2c2c2ed1;--wui-color-text:#f5f5f7;--wui-color-text-muted:#a1a1a6;--wui-color-border:#ffffff24;--wui-color-border-strong:#0a84ffb8;--wui-color-glass-border:#ffffff29;--wui-color-glass-highlight:#ffffff38;--wui-color-accent:#0a84ff;--wui-color-on-accent:#fff;--wui-color-success:#30d158;--wui-color-warning:#ff9f0a;--wui-color-danger:#ff453a;--wui-color-info:#64d2ff;--wui-color-backdrop:#0000007a;--wui-shadow-overlay:0 18px 48px #0000008a;--wui-shadow-pop:0 4px 16px #00000059;--wui-shadow-glass:0 8px 24px #00000057;--wui-focus-ring:#0a84ff9e;--lightningcss-light: ;--lightningcss-dark:initial;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}@media (prefers-color-scheme:dark){:host([appearance=system]){--wui-color-page:#18181a;--wui-color-surface:#2c2c2e;--wui-color-surface-raised:#2c2c2e;--wui-color-surface-raised-mid:#3a3a3c;--wui-color-surface-raised-deep:#444446;--wui-color-surface-glass:#2c2c2ea6;--wui-color-surface-overlay:#2c2c2ed1;--wui-color-text:#f5f5f7;--wui-color-text-muted:#a1a1a6;--wui-color-border:#ffffff24;--wui-color-border-strong:#0a84ffb8;--wui-color-glass-border:#ffffff29;--wui-color-glass-highlight:#ffffff38;--wui-color-accent:#0a84ff;--wui-color-on-accent:#fff;--wui-color-success:#30d158;--wui-color-warning:#ff9f0a;--wui-color-danger:#ff453a;--wui-color-info:#64d2ff;--wui-color-backdrop:#0000007a;--wui-shadow-overlay:0 18px 48px #0000008a;--wui-shadow-pop:0 4px 16px #00000059;--wui-shadow-glass:0 8px 24px #00000057;--wui-focus-ring:#0a84ff9e;--lightningcss-light: ;--lightningcss-dark:initial;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/theme/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-layer-base: 0;\n --wui-layer-header: 10;\n --wui-layer-auxiliary: 20;\n --wui-layer-local-overlay: 1;\n --wui-layer-menu: 100;\n --wui-layer-menu-submenu: 110;\n --wui-layer-toast: 200;\n --wui-layer-loading: 300;\n --wui-duration-press: 120ms;\n --wui-duration-fast: 160ms;\n --wui-duration-overlay-enter: 180ms;\n --wui-duration-overlay-exit: 140ms;\n --wui-duration-drawer: 280ms;\n --wui-ease-out: cubic-bezier(0.23, 1, 0.32, 1);\n --wui-ease-standard: cubic-bezier(0.77, 0, 0.175, 1);\n --wui-scale-press: 0.97;\n --wui-scale-enter: 0.97;\n display: contents;\n}\n\n:host([motion='reduced']) {\n --wui-duration-press: 0ms;\n --wui-duration-fast: 0ms;\n --wui-duration-overlay-enter: 0ms;\n --wui-duration-overlay-exit: 0ms;\n --wui-duration-drawer: 0ms;\n --wui-scale-press: 1;\n --wui-scale-enter: 1;\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host([motion='system']) {\n --wui-duration-press: 0ms;\n --wui-duration-fast: 0ms;\n --wui-duration-overlay-enter: 0ms;\n --wui-duration-overlay-exit: 0ms;\n --wui-duration-drawer: 0ms;\n --wui-scale-press: 1;\n --wui-scale-enter: 1;\n }\n}\n\n:host([appearance='light']),\n:host([appearance='system']) {\n --wui-color-page: #fff;\n --wui-color-surface: #fff;\n --wui-color-surface-raised: #f2f2f7;\n --wui-color-surface-raised-mid: #dfdfdf;\n --wui-color-surface-raised-deep: #e5e5ea;\n --wui-color-surface-glass: rgb(250 250 250 / 0.55);\n --wui-color-surface-overlay: rgb(246 246 246 / 0.88);\n --wui-color-text: #1b1b1b;\n --wui-color-text-muted: #6a6a6a;\n --wui-color-border: rgb(0 0 0 / 0.1);\n --wui-color-border-strong: rgb(0 110 230 / 0.5);\n --wui-color-glass-border: rgb(51 51 51 / 0.08);\n --wui-color-glass-highlight: rgb(255 255 255 / 0.9);\n --wui-color-accent: #08f;\n --wui-color-on-accent: #fff;\n --wui-color-success: #16a34a;\n --wui-color-warning: #d97706;\n --wui-color-danger: #dc2626;\n --wui-color-info: #2563eb;\n --wui-color-backdrop: rgb(0 0 0 / 0.12);\n --wui-shadow-overlay: 2px 16px 40px rgb(0 0 0 / 0.4);\n --wui-shadow-pop: 0 3px 9px rgb(0 0 0 / 0.27);\n --wui-shadow-glass: 0 2px 16px rgb(0 0 0 / 0.06);\n --wui-focus-ring: rgb(0 136 255 / 0.4);\n color-scheme: light;\n}\n\n:host([appearance='dark']) {\n --wui-color-page: #18181a;\n --wui-color-surface: #2c2c2e;\n --wui-color-surface-raised: #2c2c2e;\n --wui-color-surface-raised-mid: #3a3a3c;\n --wui-color-surface-raised-deep: #444446;\n --wui-color-surface-glass: rgb(44 44 46 / 0.65);\n --wui-color-surface-overlay: rgb(44 44 46 / 0.82);\n --wui-color-text: #f5f5f7;\n --wui-color-text-muted: #a1a1a6;\n --wui-color-border: rgb(255 255 255 / 0.14);\n --wui-color-border-strong: rgb(10 132 255 / 0.72);\n --wui-color-glass-border: rgb(255 255 255 / 0.16);\n --wui-color-glass-highlight: rgb(255 255 255 / 0.22);\n --wui-color-accent: #0a84ff;\n --wui-color-on-accent: #fff;\n --wui-color-success: #30d158;\n --wui-color-warning: #ff9f0a;\n --wui-color-danger: #ff453a;\n --wui-color-info: #64d2ff;\n --wui-color-backdrop: rgb(0 0 0 / 0.48);\n --wui-shadow-overlay: 0 18px 48px rgb(0 0 0 / 0.54);\n --wui-shadow-pop: 0 4px 16px rgb(0 0 0 / 0.35);\n --wui-shadow-glass: 0 8px 24px rgb(0 0 0 / 0.34);\n --wui-focus-ring: rgb(10 132 255 / 0.62);\n color-scheme: dark;\n}\n\n@media (prefers-color-scheme: dark) {\n :host([appearance='system']) {\n --wui-color-page: #18181a;\n --wui-color-surface: #2c2c2e;\n --wui-color-surface-raised: #2c2c2e;\n --wui-color-surface-raised-mid: #3a3a3c;\n --wui-color-surface-raised-deep: #444446;\n --wui-color-surface-glass: rgb(44 44 46 / 0.65);\n --wui-color-surface-overlay: rgb(44 44 46 / 0.82);\n --wui-color-text: #f5f5f7;\n --wui-color-text-muted: #a1a1a6;\n --wui-color-border: rgb(255 255 255 / 0.14);\n --wui-color-border-strong: rgb(10 132 255 / 0.72);\n --wui-color-glass-border: rgb(255 255 255 / 0.16);\n --wui-color-glass-highlight: rgb(255 255 255 / 0.22);\n --wui-color-accent: #0a84ff;\n --wui-color-on-accent: #fff;\n --wui-color-success: #30d158;\n --wui-color-warning: #ff9f0a;\n --wui-color-danger: #ff453a;\n --wui-color-info: #64d2ff;\n --wui-color-backdrop: rgb(0 0 0 / 0.48);\n --wui-shadow-overlay: 0 18px 48px rgb(0 0 0 / 0.54);\n --wui-shadow-pop: 0 4px 16px rgb(0 0 0 / 0.35);\n --wui-shadow-glass: 0 8px 24px rgb(0 0 0 / 0.34);\n --wui-focus-ring: rgb(10 132 255 / 0.62);\n color-scheme: dark;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/theme/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-layer-base: 0;\n --wui-layer-header: 10;\n --wui-layer-auxiliary: 20;\n --wui-layer-local-overlay: 1;\n --wui-layer-menu: 100;\n --wui-layer-menu-submenu: 110;\n --wui-layer-toast: 200;\n --wui-layer-loading: 300;\n --wui-duration-press: 120ms;\n --wui-duration-feedback: 120ms;\n --wui-duration-fast: 160ms;\n --wui-duration-menu-enter: 140ms;\n --wui-duration-menu-exit: 100ms;\n --wui-duration-overlay-enter: 180ms;\n --wui-duration-overlay-exit: 140ms;\n --wui-duration-drawer: 280ms;\n --wui-ease-out: cubic-bezier(0.23, 1, 0.32, 1);\n --wui-ease-standard: cubic-bezier(0.77, 0, 0.175, 1);\n --wui-scale-press: 0.97;\n --wui-scale-enter: 0.97;\n display: contents;\n}\n\n:host([motion='reduced']) {\n --wui-duration-press: 0ms;\n --wui-duration-feedback: 0ms;\n --wui-duration-fast: 0ms;\n --wui-duration-menu-enter: 0ms;\n --wui-duration-menu-exit: 0ms;\n --wui-duration-overlay-enter: 0ms;\n --wui-duration-overlay-exit: 0ms;\n --wui-duration-drawer: 0ms;\n --wui-scale-press: 1;\n --wui-scale-enter: 1;\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host([motion='system']) {\n --wui-duration-press: 0ms;\n --wui-duration-feedback: 0ms;\n --wui-duration-fast: 0ms;\n --wui-duration-menu-enter: 0ms;\n --wui-duration-menu-exit: 0ms;\n --wui-duration-overlay-enter: 0ms;\n --wui-duration-overlay-exit: 0ms;\n --wui-duration-drawer: 0ms;\n --wui-scale-press: 1;\n --wui-scale-enter: 1;\n }\n}\n\n:host([appearance='light']),\n:host([appearance='system']) {\n --wui-color-page: #fff;\n --wui-color-surface: #fff;\n --wui-color-surface-raised: #f2f2f7;\n --wui-color-surface-raised-mid: #dfdfdf;\n --wui-color-surface-raised-deep: #e5e5ea;\n --wui-color-surface-glass: rgb(250 250 250 / 0.55);\n --wui-color-surface-overlay: rgb(246 246 246 / 0.88);\n --wui-color-text: #1b1b1b;\n --wui-color-text-muted: #6a6a6a;\n --wui-color-border: rgb(0 0 0 / 0.1);\n --wui-color-border-strong: rgb(0 110 230 / 0.5);\n --wui-color-glass-border: rgb(51 51 51 / 0.08);\n --wui-color-glass-highlight: rgb(255 255 255 / 0.9);\n --wui-color-accent: #08f;\n --wui-color-on-accent: #fff;\n --wui-color-success: #16a34a;\n --wui-color-warning: #d97706;\n --wui-color-danger: #dc2626;\n --wui-color-info: #2563eb;\n --wui-color-backdrop: rgb(0 0 0 / 0.12);\n --wui-shadow-overlay: 2px 16px 40px rgb(0 0 0 / 0.4);\n --wui-shadow-pop: 0 3px 9px rgb(0 0 0 / 0.27);\n --wui-shadow-glass: 0 2px 16px rgb(0 0 0 / 0.06);\n --wui-focus-ring: rgb(0 136 255 / 0.4);\n color-scheme: light;\n}\n\n:host([appearance='dark']) {\n --wui-color-page: #18181a;\n --wui-color-surface: #2c2c2e;\n --wui-color-surface-raised: #2c2c2e;\n --wui-color-surface-raised-mid: #3a3a3c;\n --wui-color-surface-raised-deep: #444446;\n --wui-color-surface-glass: rgb(44 44 46 / 0.65);\n --wui-color-surface-overlay: rgb(44 44 46 / 0.82);\n --wui-color-text: #f5f5f7;\n --wui-color-text-muted: #a1a1a6;\n --wui-color-border: rgb(255 255 255 / 0.14);\n --wui-color-border-strong: rgb(10 132 255 / 0.72);\n --wui-color-glass-border: rgb(255 255 255 / 0.16);\n --wui-color-glass-highlight: rgb(255 255 255 / 0.22);\n --wui-color-accent: #0a84ff;\n --wui-color-on-accent: #fff;\n --wui-color-success: #30d158;\n --wui-color-warning: #ff9f0a;\n --wui-color-danger: #ff453a;\n --wui-color-info: #64d2ff;\n --wui-color-backdrop: rgb(0 0 0 / 0.48);\n --wui-shadow-overlay: 0 18px 48px rgb(0 0 0 / 0.54);\n --wui-shadow-pop: 0 4px 16px rgb(0 0 0 / 0.35);\n --wui-shadow-glass: 0 8px 24px rgb(0 0 0 / 0.34);\n --wui-focus-ring: rgb(10 132 255 / 0.62);\n color-scheme: dark;\n}\n\n@media (prefers-color-scheme: dark) {\n :host([appearance='system']) {\n --wui-color-page: #18181a;\n --wui-color-surface: #2c2c2e;\n --wui-color-surface-raised: #2c2c2e;\n --wui-color-surface-raised-mid: #3a3a3c;\n --wui-color-surface-raised-deep: #444446;\n --wui-color-surface-glass: rgb(44 44 46 / 0.65);\n --wui-color-surface-overlay: rgb(44 44 46 / 0.82);\n --wui-color-text: #f5f5f7;\n --wui-color-text-muted: #a1a1a6;\n --wui-color-border: rgb(255 255 255 / 0.14);\n --wui-color-border-strong: rgb(10 132 255 / 0.72);\n --wui-color-glass-border: rgb(255 255 255 / 0.16);\n --wui-color-glass-highlight: rgb(255 255 255 / 0.22);\n --wui-color-accent: #0a84ff;\n --wui-color-on-accent: #fff;\n --wui-color-success: #30d158;\n --wui-color-warning: #ff9f0a;\n --wui-color-danger: #ff453a;\n --wui-color-info: #64d2ff;\n --wui-color-backdrop: rgb(0 0 0 / 0.48);\n --wui-shadow-overlay: 0 18px 48px rgb(0 0 0 / 0.54);\n --wui-shadow-pop: 0 4px 16px rgb(0 0 0 / 0.35);\n --wui-shadow-glass: 0 8px 24px rgb(0 0 0 / 0.34);\n --wui-focus-ring: rgb(10 132 255 / 0.62);\n color-scheme: dark;\n }\n}\n"],"mappings":""}
@@ -41,7 +41,7 @@ function p(r) {
41
41
  }
42
42
  function m(e, t, n) {
43
43
  let r = document.createElement("web-ui-toast");
44
- r.toastId = e, r.type = t.type || "info", r.position = t.position || "top-right", r.heading = t.heading || "", r.message = t.message, r.duration = t.duration ?? 3e3, r.closable = t.closable ?? !0, r.addEventListener("toast-close", (e) => {
44
+ r.toastId = e, r.type = t.type || "info", r.position = t.position || "top-right", r.heading = t.heading || "", r.message = t.message, r.duration = t.duration ?? 3e3, r.noCloseButton = t.closable === !1, r.addEventListener("toast-close", (e) => {
45
45
  let t = e.detail;
46
46
  h(t.id);
47
47
  }), n.appendChild(r), a.set(e, r), requestAnimationFrame(() => r.show());
@@ -1 +1 @@
1
- {"version":3,"file":"manager.js","names":[],"sources":["../../../src/components/toast/manager.ts"],"sourcesContent":["import { getFallbackOverlayRoot } from '@/shared/theme/overlay-root'\nimport { findNearestTheme, findRootTheme } from '@/shared/theme/theme-scope'\n\nimport type { WebUiToast } from './toast'\nimport type {\n ToastCloseReason,\n ToastInstanceOptions,\n ToastMessageUpdateOptions,\n ToastOptions,\n ToastPosition\n} from './types'\n\nlet toastIdCounter = 0\n\nconst toastContainers = new Set<HTMLElement>()\nconst visibleToasts = new Map<string, WebUiToast>()\n\nlet pendingBatch: Array<{ id: string; options: ToastInstanceOptions; container: HTMLElement }> | undefined\nlet isBatchScheduled = false\n\ntype ToastShortcutOptions = Omit<ToastOptions, 'message' | 'type'> & Pick<ToastInstanceOptions, 'position'>\n\nfunction generateId(): string {\n return `toast-${++toastIdCounter}`\n}\n\nfunction ensureContainer(position: ToastPosition, root: HTMLElement): HTMLElement {\n const existing = Array.from(root.children).find(\n (child): child is HTMLElement => child instanceof HTMLElement && child.dataset.wuiToastPosition === position\n )\n if (existing) return existing\n\n const container = document.createElement('div')\n container.className = `wui-toast-container wui-toast-${position}`\n container.dataset.wuiToastPosition = position\n container.setAttribute('role', 'log')\n container.setAttribute('aria-live', 'polite')\n container.setAttribute('aria-relevant', 'additions')\n root.appendChild(container)\n toastContainers.add(container)\n\n container.addEventListener('pointerenter', () => (container.dataset.hovered = 'true'))\n container.addEventListener('pointerleave', () => {\n delete container.dataset.hovered\n scrollToBottom(container)\n })\n return container\n}\n\nfunction scrollToBottom(container: HTMLElement) {\n if (container.dataset.hovered === 'true') return\n requestAnimationFrame(() => {\n container.scrollTop = container.scrollHeight\n })\n}\n\nfunction scheduleBatchFlush() {\n if (isBatchScheduled) return\n isBatchScheduled = true\n void Promise.resolve().then(flushBatch)\n}\n\nfunction flushBatch() {\n isBatchScheduled = false\n const batch = pendingBatch\n pendingBatch = undefined\n if (!batch) return\n\n const containersToScroll = new Set<HTMLElement>()\n for (const item of batch) {\n mountToast(item.id, item.options, item.container)\n containersToScroll.add(item.container)\n }\n for (const container of containersToScroll) scrollToBottom(container)\n}\n\nfunction createToast(options: ToastInstanceOptions): string {\n const id = options.id || generateId()\n if (visibleToasts.has(id)) return id\n\n const position = options.position || 'top-right'\n const targetTheme = options.target ? findNearestTheme(options.target) : findRootTheme()\n const root = options.container ?? targetTheme?.getOverlayRoot() ?? getFallbackOverlayRoot()\n const container = ensureContainer(position, root)\n\n if (!pendingBatch) pendingBatch = []\n pendingBatch.push({ id, options, container })\n scheduleBatchFlush()\n return id\n}\n\nfunction mountToast(id: string, options: ToastInstanceOptions, container: HTMLElement) {\n const el = document.createElement('web-ui-toast')\n el.toastId = id\n el.type = options.type || 'info'\n el.position = options.position || 'top-right'\n el.heading = options.heading || ''\n el.message = options.message\n el.duration = options.duration ?? 3000\n el.closable = options.closable ?? true\n\n el.addEventListener('toast-close', (e: Event) => {\n const detail = (e as CustomEvent<{ id: string; reason: ToastCloseReason }>).detail\n removeToast(detail.id)\n })\n\n container.appendChild(el)\n visibleToasts.set(id, el)\n requestAnimationFrame(() => el.show())\n}\n\nfunction removeToast(id: string) {\n const el = visibleToasts.get(id)\n if (!el) return\n el.remove()\n visibleToasts.delete(id)\n}\n\nfunction close(id: string) {\n visibleToasts.get(id)?.dismiss('programmatic')\n}\n\nfunction clear() {\n for (const el of visibleToasts.values()) el.dismiss('clear')\n}\n\n/**\n * 更新指定 Toast 的消息与可选标题,不影响其自动关闭倒计时。\n * 尚未完成批量挂载的 Toast 也会更新其初始内容。\n */\nfunction updateMessage(id: string, options: ToastMessageUpdateOptions) {\n const visibleToast = visibleToasts.get(id)\n if (visibleToast) {\n visibleToast.message = options.message\n if (options.heading !== undefined) visibleToast.heading = options.heading\n return\n }\n\n const pendingToast = pendingBatch?.find(item => item.id === id)\n if (!pendingToast) return\n pendingToast.options.message = options.message\n if (options.heading !== undefined) pendingToast.options.heading = options.heading\n}\n\nfunction toast(options: ToastInstanceOptions): string {\n return createToast(options)\n}\n\ntoast.success = (message: string, options?: ToastShortcutOptions) =>\n createToast({ ...options, message, type: 'success' })\ntoast.info = (message: string, options?: ToastShortcutOptions) => createToast({ ...options, message, type: 'info' })\ntoast.warning = (message: string, options?: ToastShortcutOptions) =>\n createToast({ ...options, message, type: 'warning' })\ntoast.error = (message: string, options?: ToastShortcutOptions) =>\n createToast({ ...options, message, type: 'error', duration: options?.duration ?? 5000 })\ntoast.close = close\ntoast.clear = clear\ntoast.updateMessage = updateMessage\n\n/** 获取当前可见 toast 数量(测试用) */\ntoast._visibleCount = () => visibleToasts.size\n\n/** 重置全部状态(测试用) */\ntoast._reset = () => {\n pendingBatch = undefined\n isBatchScheduled = false\n for (const el of visibleToasts.values()) el.remove()\n visibleToasts.clear()\n for (const container of toastContainers) container.remove()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,EAAa,UAAU,EAAQ,SAC3B,EAAQ,YAAY,KAAA,MAAW,EAAa,UAAU,EAAQ;EAClE;CACF;CAEA,IAAM,IAAe,GAAc,MAAK,MAAQ,EAAK,OAAO,CAAE;CACzD,MACL,EAAa,QAAQ,UAAU,EAAQ,SACnC,EAAQ,YAAY,KAAA,MAAW,EAAa,QAAQ,UAAU,EAAQ;AAC5E;AAEA,SAAS,EAAM,GAAuC;CACpD,OAAO,EAAY,CAAO;AAC5B;AAEA,EAAM,WAAW,GAAiB,MAChC,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;AAAU,CAAC,GACtD,EAAM,QAAQ,GAAiB,MAAmC,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;AAAO,CAAC,GACnH,EAAM,WAAW,GAAiB,MAChC,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;AAAU,CAAC,GACtD,EAAM,SAAS,GAAiB,MAC9B,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;CAAS,UAAU,GAAS,YAAY;AAAK,CAAC,GACzF,EAAM,QAAQ,GACd,EAAM,QAAQ,GACd,EAAM,gBAAgB,GAGtB,EAAM,sBAAsB,EAAc,MAG1C,EAAM,eAAe;CAEnB,AADA,IAAe,KAAA,GACf,IAAmB;CACnB,KAAK,IAAM,KAAM,EAAc,OAAO,GAAG,EAAG,OAAO;CACnD,EAAc,MAAM;CACpB,KAAK,IAAM,KAAa,GAAiB,EAAU,OAAO;CAC1D,EAAgB,MAAM;AACxB"}
1
+ {"version":3,"file":"manager.js","names":[],"sources":["../../../src/components/toast/manager.ts"],"sourcesContent":["import { getFallbackOverlayRoot } from '@/shared/theme/overlay-root'\nimport { findNearestTheme, findRootTheme } from '@/shared/theme/theme-scope'\n\nimport type { WebUiToast } from './toast'\nimport type {\n ToastCloseReason,\n ToastInstanceOptions,\n ToastMessageUpdateOptions,\n ToastOptions,\n ToastPosition\n} from './types'\n\nlet toastIdCounter = 0\n\nconst toastContainers = new Set<HTMLElement>()\nconst visibleToasts = new Map<string, WebUiToast>()\n\nlet pendingBatch: Array<{ id: string; options: ToastInstanceOptions; container: HTMLElement }> | undefined\nlet isBatchScheduled = false\n\ntype ToastShortcutOptions = Omit<ToastOptions, 'message' | 'type'> & Pick<ToastInstanceOptions, 'position'>\n\nfunction generateId(): string {\n return `toast-${++toastIdCounter}`\n}\n\nfunction ensureContainer(position: ToastPosition, root: HTMLElement): HTMLElement {\n const existing = Array.from(root.children).find(\n (child): child is HTMLElement => child instanceof HTMLElement && child.dataset.wuiToastPosition === position\n )\n if (existing) return existing\n\n const container = document.createElement('div')\n container.className = `wui-toast-container wui-toast-${position}`\n container.dataset.wuiToastPosition = position\n container.setAttribute('role', 'log')\n container.setAttribute('aria-live', 'polite')\n container.setAttribute('aria-relevant', 'additions')\n root.appendChild(container)\n toastContainers.add(container)\n\n container.addEventListener('pointerenter', () => (container.dataset.hovered = 'true'))\n container.addEventListener('pointerleave', () => {\n delete container.dataset.hovered\n scrollToBottom(container)\n })\n return container\n}\n\nfunction scrollToBottom(container: HTMLElement) {\n if (container.dataset.hovered === 'true') return\n requestAnimationFrame(() => {\n container.scrollTop = container.scrollHeight\n })\n}\n\nfunction scheduleBatchFlush() {\n if (isBatchScheduled) return\n isBatchScheduled = true\n void Promise.resolve().then(flushBatch)\n}\n\nfunction flushBatch() {\n isBatchScheduled = false\n const batch = pendingBatch\n pendingBatch = undefined\n if (!batch) return\n\n const containersToScroll = new Set<HTMLElement>()\n for (const item of batch) {\n mountToast(item.id, item.options, item.container)\n containersToScroll.add(item.container)\n }\n for (const container of containersToScroll) scrollToBottom(container)\n}\n\nfunction createToast(options: ToastInstanceOptions): string {\n const id = options.id || generateId()\n if (visibleToasts.has(id)) return id\n\n const position = options.position || 'top-right'\n const targetTheme = options.target ? findNearestTheme(options.target) : findRootTheme()\n const root = options.container ?? targetTheme?.getOverlayRoot() ?? getFallbackOverlayRoot()\n const container = ensureContainer(position, root)\n\n if (!pendingBatch) pendingBatch = []\n pendingBatch.push({ id, options, container })\n scheduleBatchFlush()\n return id\n}\n\nfunction mountToast(id: string, options: ToastInstanceOptions, container: HTMLElement) {\n const el = document.createElement('web-ui-toast')\n el.toastId = id\n el.type = options.type || 'info'\n el.position = options.position || 'top-right'\n el.heading = options.heading || ''\n el.message = options.message\n el.duration = options.duration ?? 3000\n el.noCloseButton = options.closable === false\n\n el.addEventListener('toast-close', (e: Event) => {\n const detail = (e as CustomEvent<{ id: string; reason: ToastCloseReason }>).detail\n removeToast(detail.id)\n })\n\n container.appendChild(el)\n visibleToasts.set(id, el)\n requestAnimationFrame(() => el.show())\n}\n\nfunction removeToast(id: string) {\n const el = visibleToasts.get(id)\n if (!el) return\n el.remove()\n visibleToasts.delete(id)\n}\n\nfunction close(id: string) {\n visibleToasts.get(id)?.dismiss('programmatic')\n}\n\nfunction clear() {\n for (const el of visibleToasts.values()) el.dismiss('clear')\n}\n\n/**\n * 更新指定 Toast 的消息与可选标题,不影响其自动关闭倒计时。\n * 尚未完成批量挂载的 Toast 也会更新其初始内容。\n */\nfunction updateMessage(id: string, options: ToastMessageUpdateOptions) {\n const visibleToast = visibleToasts.get(id)\n if (visibleToast) {\n visibleToast.message = options.message\n if (options.heading !== undefined) visibleToast.heading = options.heading\n return\n }\n\n const pendingToast = pendingBatch?.find(item => item.id === id)\n if (!pendingToast) return\n pendingToast.options.message = options.message\n if (options.heading !== undefined) pendingToast.options.heading = options.heading\n}\n\nfunction toast(options: ToastInstanceOptions): string {\n return createToast(options)\n}\n\ntoast.success = (message: string, options?: ToastShortcutOptions) =>\n createToast({ ...options, message, type: 'success' })\ntoast.info = (message: string, options?: ToastShortcutOptions) => createToast({ ...options, message, type: 'info' })\ntoast.warning = (message: string, options?: ToastShortcutOptions) =>\n createToast({ ...options, message, type: 'warning' })\ntoast.error = (message: string, options?: ToastShortcutOptions) =>\n createToast({ ...options, message, type: 'error', duration: options?.duration ?? 5000 })\ntoast.close = close\ntoast.clear = clear\ntoast.updateMessage = updateMessage\n\n/** 获取当前可见 toast 数量(测试用) */\ntoast._visibleCount = () => visibleToasts.size\n\n/** 重置全部状态(测试用) */\ntoast._reset = () => {\n pendingBatch = undefined\n isBatchScheduled = false\n for (const el of visibleToasts.values()) el.remove()\n visibleToasts.clear()\n for (const container of toastContainers) container.remove()\n toastContainers.clear()\n}\n\nexport { toast }\n"],"mappings":";;;AAYA,IAAI,IAAiB,GAEf,oBAAkB,IAAI,IAAiB,GACvC,oBAAgB,IAAI,IAAwB,GAE9C,GACA,IAAmB;AAIvB,SAAS,IAAqB;CAC5B,OAAO,SAAS,EAAE;AACpB;AAEA,SAAS,EAAgB,GAAyB,GAAgC;CAChF,IAAM,IAAW,MAAM,KAAK,EAAK,QAAQ,CAAC,CAAC,MACxC,MAAgC,aAAiB,eAAe,EAAM,QAAQ,qBAAqB,CACtG;CACA,IAAI,GAAU,OAAO;CAErB,IAAM,IAAY,SAAS,cAAc,KAAK;CAc9C,OAbA,EAAU,YAAY,iCAAiC,KACvD,EAAU,QAAQ,mBAAmB,GACrC,EAAU,aAAa,QAAQ,KAAK,GACpC,EAAU,aAAa,aAAa,QAAQ,GAC5C,EAAU,aAAa,iBAAiB,WAAW,GACnD,EAAK,YAAY,CAAS,GAC1B,EAAgB,IAAI,CAAS,GAE7B,EAAU,iBAAiB,sBAAuB,EAAU,QAAQ,UAAU,MAAO,GACrF,EAAU,iBAAiB,sBAAsB;EAE/C,AADA,OAAO,EAAU,QAAQ,SACzB,EAAe,CAAS;CAC1B,CAAC,GACM;AACT;AAEA,SAAS,EAAe,GAAwB;CAC1C,EAAU,QAAQ,YAAY,UAClC,4BAA4B;EAC1B,EAAU,YAAY,EAAU;CAClC,CAAC;AACH;AAEA,SAAS,IAAqB;CACxB,MACJ,IAAmB,IACnB,QAAa,QAAQ,CAAC,CAAC,KAAK,CAAU;AACxC;AAEA,SAAS,IAAa;CACpB,IAAmB;CACnB,IAAM,IAAQ;CAEd,IADA,IAAe,KAAA,GACX,CAAC,GAAO;CAEZ,IAAM,o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,SAAS,IAAQ;CACf,KAAK,IAAM,KAAM,EAAc,OAAO,GAAG,EAAG,QAAQ,OAAO;AAC7D;AAMA,SAAS,EAAc,GAAY,GAAoC;CACrE,IAAM,IAAe,EAAc,IAAI,CAAE;CACzC,IAAI,GAAc;EAEhB,AADA,EAAa,UAAU,EAAQ,SAC3B,EAAQ,YAAY,KAAA,MAAW,EAAa,UAAU,EAAQ;EAClE;CACF;CAEA,IAAM,IAAe,GAAc,MAAK,MAAQ,EAAK,OAAO,CAAE;CACzD,MACL,EAAa,QAAQ,UAAU,EAAQ,SACnC,EAAQ,YAAY,KAAA,MAAW,EAAa,QAAQ,UAAU,EAAQ;AAC5E;AAEA,SAAS,EAAM,GAAuC;CACpD,OAAO,EAAY,CAAO;AAC5B;AAEA,EAAM,WAAW,GAAiB,MAChC,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;AAAU,CAAC,GACtD,EAAM,QAAQ,GAAiB,MAAmC,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;AAAO,CAAC,GACnH,EAAM,WAAW,GAAiB,MAChC,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;AAAU,CAAC,GACtD,EAAM,SAAS,GAAiB,MAC9B,EAAY;CAAE,GAAG;CAAS;CAAS,MAAM;CAAS,UAAU,GAAS,YAAY;AAAK,CAAC,GACzF,EAAM,QAAQ,GACd,EAAM,QAAQ,GACd,EAAM,gBAAgB,GAGtB,EAAM,sBAAsB,EAAc,MAG1C,EAAM,eAAe;CAEnB,AADA,IAAe,KAAA,GACf,IAAmB;CACnB,KAAK,IAAM,KAAM,EAAc,OAAO,GAAG,EAAG,OAAO;CACnD,EAAc,MAAM;CACpB,KAAK,IAAM,KAAa,GAAiB,EAAU,OAAO;CAC1D,EAAgB,MAAM;AACxB"}
@@ -8,7 +8,7 @@ export declare class WebUiToast extends LitElement {
8
8
  heading: string;
9
9
  message: string;
10
10
  duration: number;
11
- closable: boolean;
11
+ noCloseButton: boolean;
12
12
  visible: boolean;
13
13
  private _closeTimer?;
14
14
  connectedCallback(): void;
@@ -6,25 +6,24 @@ import r from "../../icons/generated/lucide-info.js";
6
6
  import i from "../../icons/generated/lucide-triangle-alert.js";
7
7
  import a from "../../icons/generated/lucide-circle-alert.js";
8
8
  import o from "../../icons/generated/heroicons-x-mark-16-solid.js";
9
- import { booleanWithFalseString as s } from "../../shared/property-converters/boolean-with-false-string.js";
10
- import { getTransitionDuration as c } from "../../shared/overlay/presence.js";
11
- import l from "./style.js";
12
- import { LitElement as u, html as d, nothing as f, unsafeCSS as p } from "lit";
13
- import { customElement as m, property as h } from "lit/decorators.js";
9
+ import { getTransitionDuration as s } from "../../shared/overlay/presence.js";
10
+ import c from "./style.js";
11
+ import { LitElement as l, html as u, nothing as d, unsafeCSS as f } from "lit";
12
+ import { customElement as p, property as m } from "lit/decorators.js";
14
13
  //#region src/components/toast/toast.ts
15
- var g = {
14
+ var h = {
16
15
  success: n,
17
16
  info: r,
18
17
  warning: i,
19
18
  error: a
20
19
  };
21
- function _() {
20
+ function g() {
22
21
  let e = /* @__PURE__ */ new Date();
23
22
  return `${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}`;
24
23
  }
25
- var v = class extends u {
24
+ var _ = class extends l {
26
25
  constructor(...e) {
27
- super(...e), this.toastId = "", this.type = "info", this.position = "top-right", this.heading = "", this.message = "", this.duration = 3e3, this.closable = !0, this.visible = !1, this._onPointerEnter = (e) => {
26
+ super(...e), this.toastId = "", this.type = "info", this.position = "top-right", this.heading = "", this.message = "", this.duration = 3e3, this.noCloseButton = !1, this.visible = !1, this._onPointerEnter = (e) => {
28
27
  e.pointerType !== "touch" && this._clearTimer();
29
28
  }, this._onPointerLeave = (e) => {
30
29
  e.pointerType !== "touch" && this.startAutoClose();
@@ -33,7 +32,7 @@ var v = class extends u {
33
32
  };
34
33
  }
35
34
  static {
36
- this.styles = [p(t), p(l)];
35
+ this.styles = [f(t), f(c)];
37
36
  }
38
37
  connectedCallback() {
39
38
  super.connectedCallback(), this.addEventListener("pointerenter", this._onPointerEnter), this.addEventListener("pointerleave", this._onPointerLeave);
@@ -64,7 +63,7 @@ var v = class extends u {
64
63
  };
65
64
  this.addEventListener("transitionend", t);
66
65
  let n = this.shadowRoot?.querySelector(".toast");
67
- setTimeout(t, c(n ?? this) + 80);
66
+ setTimeout(t, s(n ?? this) + 80);
68
67
  }
69
68
  _clearTimer() {
70
69
  this._closeTimer !== void 0 && (clearTimeout(this._closeTimer), this._closeTimer = void 0);
@@ -80,43 +79,44 @@ var v = class extends u {
80
79
  }));
81
80
  }
82
81
  render() {
83
- let e = g[this.type], t = this.type === "error" ? "assertive" : "polite";
84
- return d`
82
+ let e = h[this.type], t = this.type === "error" ? "assertive" : "polite";
83
+ return u`
85
84
  <div class="toast wui-glass ${this.type}" role="alert" aria-live=${t} aria-atomic="true">
86
85
  <span class="toast-icon" aria-hidden="true">
87
86
  <web-ui-icon .icon=${e} :size="18"></web-ui-icon>
88
87
  </span>
89
88
  <div class="toast-body">
90
- ${this.heading ? d`<div class="toast-heading">${this.heading}</div>` : f}
89
+ ${this.heading ? u`<div class="toast-heading">${this.heading}</div>` : d}
91
90
  <div class="toast-message">${this.message}</div>
92
91
  </div>
93
- <span class="toast-time">${_()}</span>
94
- ${this.closable ? d`
92
+ <span class="toast-time">${g()}</span>
93
+ ${this.noCloseButton ? d : u`
95
94
  <button class="toast-close-btn wui-glass" aria-label="关闭" @click=${this._onCloseClick}>
96
95
  <web-ui-icon .icon=${o} :size="10"></web-ui-icon>
97
96
  </button>
98
- ` : f}
97
+ `}
99
98
  </div>
100
99
  `;
101
100
  }
102
101
  };
103
- e([h({
102
+ e([m({
104
103
  type: String,
105
- reflect: !0
106
- })], v.prototype, "toastId", void 0), e([h({
104
+ attribute: !1
105
+ })], _.prototype, "toastId", void 0), e([m({
107
106
  type: String,
108
107
  reflect: !0
109
- })], v.prototype, "type", void 0), e([h({
108
+ })], _.prototype, "type", void 0), e([m({
110
109
  type: String,
111
110
  reflect: !0
112
- })], v.prototype, "position", void 0), e([h({ type: String })], v.prototype, "heading", void 0), e([h({ type: String })], v.prototype, "message", void 0), e([h({ type: Number })], v.prototype, "duration", void 0), e([h({
111
+ })], _.prototype, "position", void 0), e([m({ type: String })], _.prototype, "heading", void 0), e([m({ type: String })], _.prototype, "message", void 0), e([m({ type: Number })], _.prototype, "duration", void 0), e([m({
112
+ type: Boolean,
113
113
  reflect: !0,
114
- converter: s
115
- })], v.prototype, "closable", void 0), e([h({
114
+ attribute: "no-close-button"
115
+ })], _.prototype, "noCloseButton", void 0), e([m({
116
116
  type: Boolean,
117
117
  reflect: !0
118
- })], v.prototype, "visible", void 0), v = e([m("web-ui-toast")], v);
118
+ })], _.prototype, "visible", void 0), _ = e([p("web-ui-toast")], _);
119
119
  //#endregion
120
- export { v as WebUiToast };
120
+ export { _ as WebUiToast };
121
121
 
122
122
  //# sourceMappingURL=toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":[],"sources":["../../../src/components/toast/toast.ts"],"sourcesContent":["import type { IconifyIcon } from '@iconify/types'\nimport { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\n\nimport '@/components/icon'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport glass from '@/assets/glass.css?inline'\nimport { lucideCheck, lucideInfo, lucideTriangleAlert, lucideCircleAlert, heroiconsXMark16Solid } from '@/icons'\nimport { getTransitionDuration } from '@/shared/overlay/presence'\nimport { booleanWithFalseString } from '@/shared/property-converters/boolean-with-false-string'\n\nimport style from './style.css?inline'\nimport type { ToastCloseReason, ToastPosition, ToastType } from './types'\n\nconst TYPE_ICONS: Record<ToastType, IconifyIcon> = {\n success: lucideCheck,\n info: lucideInfo,\n warning: lucideTriangleAlert,\n error: lucideCircleAlert\n}\n\nfunction _formatTime(): string {\n const now = new Date()\n const h = now.getHours().toString().padStart(2, '0')\n const m = now.getMinutes().toString().padStart(2, '0')\n return `${h}:${m}`\n}\n\n@customElement('web-ui-toast')\nexport class WebUiToast extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) toastId = ''\n @property({ type: String, reflect: true }) type: ToastType = 'info'\n @property({ type: String, reflect: true }) position: ToastPosition = 'top-right'\n @property({ type: String }) heading = ''\n @property({ type: String }) message = ''\n @property({ type: Number }) duration = 3000\n @property({ reflect: true, converter: booleanWithFalseString }) closable = true\n @property({ type: Boolean, reflect: true }) visible = false\n\n private _closeTimer?: ReturnType<typeof setTimeout>\n\n override connectedCallback() {\n super.connectedCallback()\n this.addEventListener('pointerenter', this._onPointerEnter)\n this.addEventListener('pointerleave', this._onPointerLeave)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('pointerenter', this._onPointerEnter)\n this.removeEventListener('pointerleave', this._onPointerLeave)\n this._clearTimer()\n }\n\n protected override updated(changed: PropertyValues) {\n if (changed.has('position')) {\n this._applySlideDirection()\n }\n }\n\n /** 根据 position 设置入场/退场滑动方向 */\n private _applySlideDirection() {\n const SLIDE_OFFSET = 20\n let x = 0\n let y = 0\n\n if (this.position.includes('left')) x = -SLIDE_OFFSET\n else if (this.position.includes('right')) x = SLIDE_OFFSET\n\n if (this.position.startsWith('top')) y = -SLIDE_OFFSET\n else if (this.position.startsWith('bottom')) y = SLIDE_OFFSET\n\n this.style.setProperty('--toast-slide-x', `${x}px`)\n this.style.setProperty('--toast-slide-y', `${y}px`)\n }\n\n /** 启动自动关闭计时器 */\n startAutoClose() {\n this._clearTimer()\n if (this.duration > 0) {\n this._closeTimer = setTimeout(() => {\n this.dismiss('auto')\n }, this.duration)\n }\n }\n\n /** 由 manager 调用:播放入场动画后自动开始计时 */\n show() {\n this.visible = true\n this.startAutoClose()\n }\n\n /** 关闭(含退场动画) */\n dismiss(reason: ToastCloseReason = 'programmatic') {\n if (!this.visible) return\n this.visible = false\n this._clearTimer()\n const onEnd = () => {\n this.removeEventListener('transitionend', onEnd)\n this._dispatchClose(reason)\n }\n this.addEventListener('transitionend', onEnd)\n // fallback: transitionend 不触发时(display:none 等)\n const toast = this.shadowRoot?.querySelector<HTMLElement>('.toast')\n setTimeout(onEnd, getTransitionDuration(toast ?? this) + 80)\n }\n\n private _clearTimer() {\n if (this._closeTimer !== undefined) {\n clearTimeout(this._closeTimer)\n this._closeTimer = undefined\n }\n }\n\n private _onPointerEnter = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n this._clearTimer()\n }\n\n private _onPointerLeave = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n this.startAutoClose()\n }\n\n private _onCloseClick = () => {\n this.dismiss('manual')\n }\n\n private _dispatchClose(reason: ToastCloseReason) {\n this.dispatchEvent(\n new CustomEvent('toast-close', {\n detail: { id: this.toastId, reason },\n bubbles: true,\n composed: true\n })\n )\n }\n\n override render() {\n const icon = TYPE_ICONS[this.type]\n const ariaLive = this.type === 'error' ? 'assertive' : 'polite'\n\n return html`\n <div class=\"toast wui-glass ${this.type}\" role=\"alert\" aria-live=${ariaLive} aria-atomic=\"true\">\n <span class=\"toast-icon\" aria-hidden=\"true\">\n <web-ui-icon .icon=${icon} :size=\"18\"></web-ui-icon>\n </span>\n <div class=\"toast-body\">\n ${this.heading ? html`<div class=\"toast-heading\">${this.heading}</div>` : nothing}\n <div class=\"toast-message\">${this.message}</div>\n </div>\n <span class=\"toast-time\">${_formatTime()}</span>\n ${this.closable\n ? html`\n <button class=\"toast-close-btn wui-glass\" aria-label=\"关闭\" @click=${this._onCloseClick}>\n <web-ui-icon .icon=${heroiconsXMark16Solid} :size=\"10\"></web-ui-icon>\n </button>\n `\n : nothing}\n </div>\n `\n }\n\n declare readonly $events: {\n 'toast-close': CustomEvent<{ id: string; reason: ToastCloseReason }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-toast': WebUiToast\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAM,IAA6C;CACjD,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;AACT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;AAKF;AAxIG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzB,EAAA,CAAA,EAAS;CAAE,SAAS;CAAM,WAAW;AAAuB,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAC7D,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GAX3C,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"toast.js","names":[],"sources":["../../../src/components/toast/toast.ts"],"sourcesContent":["import type { IconifyIcon } from '@iconify/types'\nimport { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\n\nimport '@/components/icon'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport glass from '@/assets/glass.css?inline'\nimport { lucideCheck, lucideInfo, lucideTriangleAlert, lucideCircleAlert, heroiconsXMark16Solid } from '@/icons'\nimport { getTransitionDuration } from '@/shared/overlay/presence'\n\nimport style from './style.css?inline'\nimport type { ToastCloseReason, ToastPosition, ToastType } from './types'\n\nconst TYPE_ICONS: Record<ToastType, IconifyIcon> = {\n success: lucideCheck,\n info: lucideInfo,\n warning: lucideTriangleAlert,\n error: lucideCircleAlert\n}\n\nfunction _formatTime(): string {\n const now = new Date()\n const h = now.getHours().toString().padStart(2, '0')\n const m = now.getMinutes().toString().padStart(2, '0')\n return `${h}:${m}`\n}\n\n@customElement('web-ui-toast')\nexport class WebUiToast extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, attribute: false }) toastId = ''\n @property({ type: String, reflect: true }) type: ToastType = 'info'\n @property({ type: String, reflect: true }) position: ToastPosition = 'top-right'\n @property({ type: String }) heading = ''\n @property({ type: String }) message = ''\n @property({ type: Number }) duration = 3000\n @property({ type: Boolean, reflect: true, attribute: 'no-close-button' }) noCloseButton = false\n @property({ type: Boolean, reflect: true }) visible = false\n\n private _closeTimer?: ReturnType<typeof setTimeout>\n\n override connectedCallback() {\n super.connectedCallback()\n this.addEventListener('pointerenter', this._onPointerEnter)\n this.addEventListener('pointerleave', this._onPointerLeave)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('pointerenter', this._onPointerEnter)\n this.removeEventListener('pointerleave', this._onPointerLeave)\n this._clearTimer()\n }\n\n protected override updated(changed: PropertyValues) {\n if (changed.has('position')) {\n this._applySlideDirection()\n }\n }\n\n /** 根据 position 设置入场/退场滑动方向 */\n private _applySlideDirection() {\n const SLIDE_OFFSET = 20\n let x = 0\n let y = 0\n\n if (this.position.includes('left')) x = -SLIDE_OFFSET\n else if (this.position.includes('right')) x = SLIDE_OFFSET\n\n if (this.position.startsWith('top')) y = -SLIDE_OFFSET\n else if (this.position.startsWith('bottom')) y = SLIDE_OFFSET\n\n this.style.setProperty('--toast-slide-x', `${x}px`)\n this.style.setProperty('--toast-slide-y', `${y}px`)\n }\n\n /** 启动自动关闭计时器 */\n startAutoClose() {\n this._clearTimer()\n if (this.duration > 0) {\n this._closeTimer = setTimeout(() => {\n this.dismiss('auto')\n }, this.duration)\n }\n }\n\n /** 由 manager 调用:播放入场动画后自动开始计时 */\n show() {\n this.visible = true\n this.startAutoClose()\n }\n\n /** 关闭(含退场动画) */\n dismiss(reason: ToastCloseReason = 'programmatic') {\n if (!this.visible) return\n this.visible = false\n this._clearTimer()\n const onEnd = () => {\n this.removeEventListener('transitionend', onEnd)\n this._dispatchClose(reason)\n }\n this.addEventListener('transitionend', onEnd)\n // fallback: transitionend 不触发时(display:none 等)\n const toast = this.shadowRoot?.querySelector<HTMLElement>('.toast')\n setTimeout(onEnd, getTransitionDuration(toast ?? this) + 80)\n }\n\n private _clearTimer() {\n if (this._closeTimer !== undefined) {\n clearTimeout(this._closeTimer)\n this._closeTimer = undefined\n }\n }\n\n private _onPointerEnter = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n this._clearTimer()\n }\n\n private _onPointerLeave = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n this.startAutoClose()\n }\n\n private _onCloseClick = () => {\n this.dismiss('manual')\n }\n\n private _dispatchClose(reason: ToastCloseReason) {\n this.dispatchEvent(\n new CustomEvent('toast-close', {\n detail: { id: this.toastId, reason },\n bubbles: true,\n composed: true\n })\n )\n }\n\n override render() {\n const icon = TYPE_ICONS[this.type]\n const ariaLive = this.type === 'error' ? 'assertive' : 'polite'\n\n return html`\n <div class=\"toast wui-glass ${this.type}\" role=\"alert\" aria-live=${ariaLive} aria-atomic=\"true\">\n <span class=\"toast-icon\" aria-hidden=\"true\">\n <web-ui-icon .icon=${icon} :size=\"18\"></web-ui-icon>\n </span>\n <div class=\"toast-body\">\n ${this.heading ? html`<div class=\"toast-heading\">${this.heading}</div>` : nothing}\n <div class=\"toast-message\">${this.message}</div>\n </div>\n <span class=\"toast-time\">${_formatTime()}</span>\n ${!this.noCloseButton\n ? html`\n <button class=\"toast-close-btn wui-glass\" aria-label=\"关闭\" @click=${this._onCloseClick}>\n <web-ui-icon .icon=${heroiconsXMark16Solid} :size=\"10\"></web-ui-icon>\n </button>\n `\n : nothing}\n </div>\n `\n }\n\n declare readonly $events: {\n 'toast-close': CustomEvent<{ id: string; reason: ToastCloseReason }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-toast': WebUiToast\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,IAAM,IAA6C;CACjD,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;AACT;AAEA,SAAS,IAAsB;CAC7B,IAAM,oBAAM,IAAI,KAAK;CAGrB,OAAO,GAFG,EAAI,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,GAAG,GAEtC,EAAE,GADF,EAAI,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,GAAG,GACnC;AACjB;AAGO,IAAM,IAAN,cAAyB,EAAW;;EAiGX,aA9F0B,KAAA,UAAA,IACK,KAAA,OAAA,QACQ,KAAA,WAAA,aAC/B,KAAA,UAAA,IACA,KAAA,UAAA,IACC,KAAA,WAAA,KACmD,KAAA,gBAAA,IACpC,KAAA,UAAA,IA6E3B,KAAA,mBAAA,MAAoB;GACzC,EAAE,gBAAgB,WACtB,KAAK,YAAY;EACnB,GAE2B,KAAA,mBAAA,MAAoB;GACzC,EAAE,gBAAgB,WACtB,KAAK,eAAe;EACtB,GAE8B,KAAA,sBAAA;GAC5B,KAAK,QAAQ,QAAQ;EACvB;;;EAlGyB,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAa5D,oBAA6B;EAG3B,AAFA,MAAM,kBAAkB,GACxB,KAAK,iBAAiB,gBAAgB,KAAK,eAAe,GAC1D,KAAK,iBAAiB,gBAAgB,KAAK,eAAe;CAC5D;CAEA,uBAAgC;EAI9B,AAHA,MAAM,qBAAqB,GAC3B,KAAK,oBAAoB,gBAAgB,KAAK,eAAe,GAC7D,KAAK,oBAAoB,gBAAgB,KAAK,eAAe,GAC7D,KAAK,YAAY;CACnB;CAEA,QAA2B,GAAyB;EAClD,AAAI,EAAQ,IAA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AAI;oCACqB,KAAK,KAAK,2BAA2B,EAAS;;+BAEnD,EAAK;;;YAGxB,KAAK,UAAU,CAAI,8BAA8B,KAAK,QAAQ,UAAU,EAAQ;uCACrD,KAAK,QAAQ;;mCAEjB,EAAY,EAAE;UACtC,KAAK,gBAMJ,IALA,CAAI;iFACiE,KAAK,cAAc;qCAC/D,EAAsB;;cAGvC;;;CAGlB;AAKF;AAxIG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAM,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GAC3C,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzB,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAkB,CAAC,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GACvE,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GAX3C,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
@@ -20,12 +20,11 @@ export declare class WebUiTooltip extends LitElement {
20
20
  open: boolean;
21
21
  portal: boolean;
22
22
  overlayContainer?: OverlayContainer;
23
- private _overlay?;
24
23
  private _showTimer?;
25
24
  private _hideTimer?;
26
- private _portal?;
27
25
  private _isCountedVisible;
28
26
  private _shouldOpenInstantly;
27
+ private readonly _panel;
29
28
  get isOpen(): boolean;
30
29
  connectedCallback(): void;
31
30
  disconnectedCallback(): void;
@@ -37,12 +36,11 @@ export declare class WebUiTooltip extends LitElement {
37
36
  private _onFocusOut;
38
37
  private _show;
39
38
  private _hide;
40
- private _initLocalOverlay;
41
39
  private _openOverlay;
42
- private _openPortal;
40
+ private _createPortal;
43
41
  private _closeOverlay;
44
- private _disposeOverlay;
45
42
  private _reconfigureOverlay;
43
+ private _syncPortalContent;
46
44
  private _dispatchChange;
47
45
  private _syncVisibleTooltipCount;
48
46
  render(): import('lit').TemplateResult<1>;