@greypan/web-ui 2.1.7 → 3.0.0

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 (147) hide show
  1. package/README.CN.md +95 -41
  2. package/README.md +100 -42
  3. package/dist/assets/glass.js.map +1 -1
  4. package/dist/assets/menu-portal.js +1 -1
  5. package/dist/assets/menu-portal.js.map +1 -1
  6. package/dist/components/autocomplete/index.d.ts +121 -0
  7. package/dist/components/autocomplete/index.js +414 -0
  8. package/dist/components/autocomplete/index.js.map +1 -0
  9. package/dist/components/autocomplete/style.js +6 -0
  10. package/dist/components/autocomplete/style.js.map +1 -0
  11. package/dist/components/avatar/index.d.ts +0 -1
  12. package/dist/components/avatar/index.js +9 -9
  13. package/dist/components/avatar/index.js.map +1 -1
  14. package/dist/components/back-top/index.d.ts +0 -1
  15. package/dist/components/back-top/index.js +1 -1
  16. package/dist/components/back-top/index.js.map +1 -1
  17. package/dist/components/badge/index.d.ts +0 -1
  18. package/dist/components/badge/index.js +5 -5
  19. package/dist/components/badge/index.js.map +1 -1
  20. package/dist/components/button/index.d.ts +6 -2
  21. package/dist/components/button/index.js +40 -19
  22. package/dist/components/button/index.js.map +1 -1
  23. package/dist/components/button/style.js +1 -1
  24. package/dist/components/button/style.js.map +1 -1
  25. package/dist/components/button-group/index.d.ts +0 -1
  26. package/dist/components/button-group/index.js.map +1 -1
  27. package/dist/components/checkbox/index.d.ts +0 -3
  28. package/dist/components/checkbox/index.js +7 -5
  29. package/dist/components/checkbox/index.js.map +1 -1
  30. package/dist/components/checkbox-group/index.js +2 -2
  31. package/dist/components/checkbox-group/index.js.map +1 -1
  32. package/dist/components/context-menu/index.d.ts +4 -3
  33. package/dist/components/context-menu/index.js +47 -50
  34. package/dist/components/context-menu/index.js.map +1 -1
  35. package/dist/components/dialog/index.d.ts +1 -1
  36. package/dist/components/dialog/index.js +20 -19
  37. package/dist/components/dialog/index.js.map +1 -1
  38. package/dist/components/drawer/index.d.ts +2 -3
  39. package/dist/components/drawer/index.js +43 -33
  40. package/dist/components/drawer/index.js.map +1 -1
  41. package/dist/components/drawer/style.js +1 -1
  42. package/dist/components/drawer/style.js.map +1 -1
  43. package/dist/components/dropdown/index.d.ts +2 -9
  44. package/dist/components/dropdown/index.js +58 -53
  45. package/dist/components/dropdown/index.js.map +1 -1
  46. package/dist/components/dropdown-divider/index.d.ts +0 -1
  47. package/dist/components/dropdown-divider/index.js.map +1 -1
  48. package/dist/components/dropdown-header/index.d.ts +0 -1
  49. package/dist/components/dropdown-header/index.js.map +1 -1
  50. package/dist/components/dropdown-item/index.d.ts +0 -2
  51. package/dist/components/dropdown-item/index.js.map +1 -1
  52. package/dist/components/dropdown-item/style.js +1 -1
  53. package/dist/components/dropdown-item/style.js.map +1 -1
  54. package/dist/components/empty/index.d.ts +0 -1
  55. package/dist/components/empty/index.js +6 -6
  56. package/dist/components/empty/index.js.map +1 -1
  57. package/dist/components/icon/index.d.ts +0 -1
  58. package/dist/components/icon/index.js.map +1 -1
  59. package/dist/components/index.d.ts +5 -0
  60. package/dist/components/index.js +36 -35
  61. package/dist/components/input/index.d.ts +3 -0
  62. package/dist/components/input/index.js +48 -24
  63. package/dist/components/input/index.js.map +1 -1
  64. package/dist/components/input/style.js +1 -1
  65. package/dist/components/input/style.js.map +1 -1
  66. package/dist/components/input-number/index.d.ts +2 -0
  67. package/dist/components/input-number/index.js +25 -12
  68. package/dist/components/input-number/index.js.map +1 -1
  69. package/dist/components/input-number/style.js +1 -1
  70. package/dist/components/input-number/style.js.map +1 -1
  71. package/dist/components/layout/index.d.ts +0 -1
  72. package/dist/components/layout/index.js +4 -4
  73. package/dist/components/layout/index.js.map +1 -1
  74. package/dist/components/option/index.d.ts +0 -11
  75. package/dist/components/option/index.js +1 -1
  76. package/dist/components/option/index.js.map +1 -1
  77. package/dist/components/option/style.js +1 -1
  78. package/dist/components/option/style.js.map +1 -1
  79. package/dist/components/popover/index.d.ts +1 -5
  80. package/dist/components/popover/index.js +42 -37
  81. package/dist/components/popover/index.js.map +1 -1
  82. package/dist/components/radio/index.d.ts +0 -3
  83. package/dist/components/radio/index.js +8 -5
  84. package/dist/components/radio/index.js.map +1 -1
  85. package/dist/components/radio-group/index.js +2 -2
  86. package/dist/components/radio-group/index.js.map +1 -1
  87. package/dist/components/segmented/index.js +8 -4
  88. package/dist/components/segmented/index.js.map +1 -1
  89. package/dist/components/segmented-trigger/index.d.ts +1 -0
  90. package/dist/components/segmented-trigger/index.js +12 -3
  91. package/dist/components/segmented-trigger/index.js.map +1 -1
  92. package/dist/components/segmented-trigger/style.js +1 -1
  93. package/dist/components/segmented-trigger/style.js.map +1 -1
  94. package/dist/components/select/index.d.ts +0 -1
  95. package/dist/components/select/index.js +22 -31
  96. package/dist/components/select/index.js.map +1 -1
  97. package/dist/components/select/style.js +1 -1
  98. package/dist/components/select/style.js.map +1 -1
  99. package/dist/components/slider/index.d.ts +0 -2
  100. package/dist/components/slider/index.js +1 -1
  101. package/dist/components/slider/index.js.map +1 -1
  102. package/dist/components/spinner/index.d.ts +0 -3
  103. package/dist/components/spinner/index.js.map +1 -1
  104. package/dist/components/svg-draw-lines/index.d.ts +0 -3
  105. package/dist/components/svg-draw-lines/index.js.map +1 -1
  106. package/dist/components/switch/index.d.ts +0 -1
  107. package/dist/components/switch/index.js +6 -6
  108. package/dist/components/switch/index.js.map +1 -1
  109. package/dist/components/switch/style.js +1 -1
  110. package/dist/components/switch/style.js.map +1 -1
  111. package/dist/components/textarea/index.d.ts +1 -0
  112. package/dist/components/textarea/index.js +51 -34
  113. package/dist/components/textarea/index.js.map +1 -1
  114. package/dist/components/textarea/style.js +1 -1
  115. package/dist/components/textarea/style.js.map +1 -1
  116. package/dist/components/theme/index.d.ts +0 -3
  117. package/dist/components/theme/index.js.map +1 -1
  118. package/dist/components/toast/manager.js.map +1 -1
  119. package/dist/components/toast/style.js +1 -1
  120. package/dist/components/toast/style.js.map +1 -1
  121. package/dist/components/toast/toast.d.ts +0 -4
  122. package/dist/components/toast/toast.js +25 -17
  123. package/dist/components/toast/toast.js.map +1 -1
  124. package/dist/components/toast/types.d.ts +0 -3
  125. package/dist/components/tooltip/index.d.ts +1 -0
  126. package/dist/components/tooltip/index.js +34 -33
  127. package/dist/components/tooltip/index.js.map +1 -1
  128. package/dist/shared/events/user-change.js +17 -0
  129. package/dist/shared/events/user-change.js.map +1 -0
  130. package/dist/shared/menu-portal/menu-portal.js +10 -11
  131. package/dist/shared/menu-portal/menu-portal.js.map +1 -1
  132. package/dist/shared/normalize/index.js.map +1 -1
  133. package/dist/shared/overlay/anchored-panel.js +12 -12
  134. package/dist/shared/overlay/native-dialog-presence.js +8 -3
  135. package/dist/shared/overlay/native-dialog-presence.js.map +1 -1
  136. package/dist/shared/overlay/overlay.js +55 -33
  137. package/dist/shared/overlay/overlay.js.map +1 -1
  138. package/dist/shared/overlay/portal.js +27 -13
  139. package/dist/shared/overlay/portal.js.map +1 -1
  140. package/dist/shared/overlay/presence.js.map +1 -1
  141. package/dist/shared/scroll-lock/scroll-lock.js +13 -12
  142. package/dist/shared/scroll-lock/scroll-lock.js.map +1 -1
  143. package/dist/shared/theme/overlay-root.js +3 -3
  144. package/dist/types/react.d.ts +15 -41
  145. package/dist/types/utils.d.ts +33 -4
  146. package/dist/types/vue.d.ts +17 -49
  147. package/package.json +11 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\n// web-ui-icon 必须注册(Rolldown tree-shake 副作用 import,引用类名阻止删除)\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { jamCloseCircleF } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input')\nexport class WebUiInput extends LitElement {\n static formAssociated = true\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) type = 'text'\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) clearable = false\n @property({ type: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) borderless = false\n\n @state() private _value = ''\n @state() private _focused = false\n @state() private _formDisabled = false\n @state() private _hasPrefix = false\n @state() private _hasSuffix = false\n\n private _internals?: ElementInternals\n\n @property({ type: String, reflect: true })\n get value(): string {\n return this._value\n }\n\n set value(v: string) {\n const old = this._value\n this._value = v\n this._internals?.setFormValue?.(v)\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this._internals) {\n this._internals = this.attachInternals()\n }\n this._internals.setFormValue?.(this._value)\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_value')) {\n const input = this.shadowRoot?.querySelector('input')\n if (input && input.value !== this._value) {\n input.value = this._value\n }\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = state\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n if (!this._internals || !input || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || input.validity.valid) {\n this._internals.setValidity({})\n return\n }\n\n const flags: ValidityStateFlags = {}\n if (input.validity.valueMissing) flags.valueMissing = true\n if (input.validity.typeMismatch) flags.typeMismatch = true\n if (input.validity.patternMismatch) flags.patternMismatch = true\n if (input.validity.tooLong) flags.tooLong = true\n if (input.validity.tooShort) flags.tooShort = true\n this._internals.setValidity(flags, input.validationMessage, input)\n }\n\n private _onSlotChange(e: Event) {\n if (!(e.target instanceof HTMLSlotElement)) return\n const slot = e.target\n const hasContent = slot.assignedElements().length > 0\n if (slot.name === 'prefix') this._hasPrefix = hasContent\n if (slot.name === 'suffix') this._hasSuffix = hasContent\n }\n\n private handleInput(e: Event) {\n if (!(e.target instanceof HTMLInputElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n private handleClear() {\n if (this._isDisabled) return\n this._value = ''\n this._internals?.setFormValue?.('')\n this._syncValidity()\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private preventMouseDownBlur(e: Event) {\n e.preventDefault()\n }\n\n private focusInput() {\n if (this._isDisabled) return\n this.shadowRoot?.querySelector('input')?.focus()\n }\n\n override render() {\n const showClear = this.clearable && this._value\n\n return html`\n <div class=\"wui-glass wui-input-inner\" @click=${this.focusInput}>\n <slot name=\"prefix\" class=${classMap({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>\n <input\n type=${this.type}\n placeholder=${this.placeholder}\n name=${this.name}\n ?disabled=${this._isDisabled}\n ?required=${this.required}\n .value=${this._value}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n ${showClear\n ? html`<span class=\"clear\" @pointerdown=${this.preventMouseDownBlur} @click=${this.handleClear}>\n <web-ui-icon .icon=${jamCloseCircleF}></web-ui-icon>\n </span>`\n : ''}\n <slot name=\"suffix\" class=${classMap({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n focus: FocusEvent\n blur: FocusEvent\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input': WebUiInput\n }\n}\n"],"mappings":";;;;;;;;;AAYO,IAAM,IAAN,cAAyB,EAAW;;EAiBX,aAboB,KAAA,OAAA,QACO,KAAA,cAAA,IACP,K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AA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAtB1C,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport '@/components/icon'\nimport '@/components/button'\nimport glass from '@/assets/glass.css?inline'\nimport { jamCloseCircleF } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input')\nexport class WebUiInput extends LitElement {\n static formAssociated = true\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) type = 'text'\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) readonly = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) clearable = false\n @property({ type: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) borderless = false\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n\n @state() private _value = ''\n @state() private _focused = false\n @state() private _formDisabled = false\n @state() private _hasPrefix = false\n @state() private _hasSuffix = false\n\n private _internals?: ElementInternals\n\n @property({ type: String, reflect: true })\n get value(): string {\n return this._value\n }\n\n set value(v: string) {\n const old = this._value\n this._value = v\n this._internals?.setFormValue?.(v)\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this._internals) {\n this._internals = this.attachInternals()\n }\n this._internals.setFormValue?.(this._value)\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_value')) {\n const input = this.shadowRoot?.querySelector('input')\n if (input && input.value !== this._value) {\n input.value = this._value\n }\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = state\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n if (!this._internals || !input || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || input.validity.valid) {\n this._internals.setValidity({})\n return\n }\n\n const flags: ValidityStateFlags = {}\n if (input.validity.valueMissing) flags.valueMissing = true\n if (input.validity.typeMismatch) flags.typeMismatch = true\n if (input.validity.patternMismatch) flags.patternMismatch = true\n if (input.validity.tooLong) flags.tooLong = true\n if (input.validity.tooShort) flags.tooShort = true\n this._internals.setValidity(flags, input.validationMessage, input)\n }\n\n private _onSlotChange(e: Event) {\n if (!(e.target instanceof HTMLSlotElement)) return\n const slot = e.target\n const hasContent = slot.assignedElements().length > 0\n if (slot.name === 'prefix') this._hasPrefix = hasContent\n if (slot.name === 'suffix') this._hasSuffix = hasContent\n }\n\n private handleInput(e: Event) {\n if (this._isDisabled || this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;这里补发 composed 事件,\n // 兑现 $events/README 声明的公共 change 契约。\n private handleNativeChange(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n private handleClear() {\n if (this._isDisabled || this.readonly) return\n this._value = ''\n this._internals?.setFormValue?.('')\n this._syncValidity()\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private preventMouseDownBlur(e: Event) {\n e.preventDefault()\n }\n\n private focusInput() {\n if (this._isDisabled) return\n this.shadowRoot?.querySelector('input')?.focus()\n }\n\n override render() {\n // readonly 下不可清除:清空按钮会修改值,与只读语义冲突\n const showClear = this.clearable && this._value && !this.readonly\n\n return html`\n <div class=\"wui-glass wui-input-inner\" @click=${this.focusInput}>\n <slot name=\"prefix\" class=${classMap({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>\n <input\n type=${this.type}\n placeholder=${this.placeholder}\n name=${this.name}\n aria-label=${ifDefined(this.ariaLabel)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this._value}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n ${showClear\n ? html`<web-ui-button\n icon\n variant=\"ghost\"\n size=\"24\"\n aria-label=\"清除\"\n @pointerdown=${this.preventMouseDownBlur}\n @click=${this.handleClear}\n >\n <web-ui-icon .icon=${jamCloseCircleF}></web-ui-icon>\n </web-ui-button>`\n : ''}\n <slot name=\"suffix\" class=${classMap({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n focus: FocusEvent\n blur: FocusEvent\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input': WebUiInput\n }\n}\n"],"mappings":";;;;;;;;;;;AAa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A,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,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAElD,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAxB1C,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/input/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:2147483647px;align-items:center;gap:8px;padding:0 16px;display:flex;position:relative}:host([full]){display:block}:host([full]) .wui-input-inner{width:100%}:host([borderless]) .wui-input-inner{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;background:0 0;border:none;padding:0}:host([focused]) .wui-input-inner{--wui-glass-shadow:var(--wui-shadow-glass,0 2px 16px #0000000f), 0 0 0 3px var(--wui-focus-ring,#08f6);border-color:var(--wui-color-border-strong,#006ee680)}:host([borderless][focused]) .wui-input-inner{box-shadow:none;border-color:#0000}input{min-width:0;height:100%;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);background:0 0;border:none;outline:none;flex:1}input::placeholder{color:var(--wui-color-text-muted,#6a6a6a)}input:disabled{cursor:not-allowed;opacity:.4}slot{font-size:var(--wui-font-size,14px);color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0;align-items:center;display:flex}slot.empty{display:none}.clear{cursor:pointer;color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0;justify-content:center;align-self:stretch;align-items:center;display:flex}.clear:hover{color:var(--wui-color-text-muted,#6a6a6a)}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:2147483647px;align-items:center;gap:8px;padding:0 12px;display:flex;position:relative}:host([full]){display:block}:host([full]) .wui-input-inner{width:100%}:host([borderless]) .wui-input-inner{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;background:0 0;border:none;padding:0}:host([focused]) .wui-input-inner{--wui-glass-shadow:var(--wui-shadow-glass,0 2px 16px #0000000f), 0 0 0 3px var(--wui-focus-ring,#08f6);border-color:var(--wui-color-border-strong,#006ee680)}:host([borderless][focused]) .wui-input-inner{box-shadow:none;border-color:#0000}input{min-width:0;height:100%;font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);background:0 0;border:none;outline:none;flex:1;margin:0;padding:0}input::placeholder{color:var(--wui-color-text-muted,#6a6a6a)}input:disabled{cursor:not-allowed;opacity:.4}slot{font-size:var(--wui-font-size,14px);color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0;align-items:center;display:flex}slot.empty{display:none}.wui-input-inner web-ui-button[variant=ghost]{--wui-button-color:var(--wui-color-text-muted,#6a6a6a);margin-left:-8px}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input/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 opacity: 0.4;\n}\n\n.wui-input-inner {\n position: relative;\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 transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([full]) {\n display: block;\n}\n\n:host([full]) .wui-input-inner {\n width: 100%;\n}\n\n/* ===== Borderless ===== */\n\n:host([borderless]) .wui-input-inner {\n padding: 0;\n border: none;\n\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n:host([focused]) .wui-input-inner {\n --wui-glass-shadow:\n var(--wui-shadow-glass, 0 2px 16px rgb(0 0 0 / 0.06)), 0 0 0 3px var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n border-color: var(--wui-color-border-strong, rgb(0 110 230 / 0.5));\n}\n\n:host([borderless][focused]) .wui-input-inner {\n border-color: transparent;\n box-shadow: none;\n}\n\n/* ===== Input ===== */\n\ninput {\n flex: 1;\n\n min-width: 0;\n height: 100%;\n border: none;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-muted, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n/* ===== Prefix / Suffix ===== */\n\nslot {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n/* slot 无 slotted 内容时折叠 */\nslot.empty {\n display: none;\n}\n\n/* ===== Clear button ===== */\n\n.clear {\n cursor: pointer;\n\n display: flex;\n flex-shrink: 0;\n align-items: center;\n align-self: stretch;\n justify-content: center;\n\n color: var(--wui-color-text-muted, #6a6a6a);\n\n &:hover {\n color: var(--wui-color-text-muted, #6a6a6a);\n }\n}\n\n/* ===== Disabled ===== */\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input/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 opacity: 0.4;\n}\n\n.wui-input-inner {\n position: relative;\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 12px;\n border-radius: calc(infinity * 1px);\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([full]) {\n display: block;\n}\n\n:host([full]) .wui-input-inner {\n width: 100%;\n}\n\n/* ===== Borderless ===== */\n\n:host([borderless]) .wui-input-inner {\n padding: 0;\n border: none;\n\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n:host([focused]) .wui-input-inner {\n --wui-glass-shadow:\n var(--wui-shadow-glass, 0 2px 16px rgb(0 0 0 / 0.06)), 0 0 0 3px var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n border-color: var(--wui-color-border-strong, rgb(0 110 230 / 0.5));\n}\n\n:host([borderless][focused]) .wui-input-inner {\n border-color: transparent;\n box-shadow: none;\n}\n\n/* ===== Input ===== */\n\ninput {\n flex: 1;\n\n min-width: 0;\n height: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-muted, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n/* ===== Prefix / Suffix ===== */\n\nslot {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n/* slot 无 slotted 内容时折叠 */\nslot.empty {\n display: none;\n}\n\n/* ===== Clear button ===== */\n\n/* 复用 web-ui-button icon ghost:仅覆盖颜色为 muted,保持原清除图标观感;\n 负 margin-left 抵消容器 8px flex gap,让清除按钮紧贴输入文本 */\n.wui-input-inner web-ui-button[variant='ghost'] {\n --wui-button-color: var(--wui-color-text-muted, #6a6a6a);\n margin-left: -8px;\n}\n\n/* ===== Disabled ===== */\n"],"mappings":""}
@@ -5,6 +5,7 @@ export declare class WebUiInputNumber extends LitElement {
5
5
  placeholder: string;
6
6
  name: string;
7
7
  disabled: boolean;
8
+ readonly: boolean;
8
9
  required: boolean;
9
10
  get precision(): number;
10
11
  set precision(v: number);
@@ -39,6 +40,7 @@ export declare class WebUiInputNumber extends LitElement {
39
40
  private setValueAndNotify;
40
41
  private handleStep;
41
42
  private handleInput;
43
+ private handleNativeChange;
42
44
  private handleKeydown;
43
45
  private handleFocus;
44
46
  private handleBlur;
@@ -1,8 +1,8 @@
1
1
  import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
2
2
  import "../icon/index.js";
3
- import t from "../../assets/glass.js";
4
- import n from "../../icons/generated/lucide-plus.js";
5
- import r from "../../icons/generated/lucide-minus.js";
3
+ import t from "../../icons/generated/lucide-plus.js";
4
+ import n from "../../icons/generated/lucide-minus.js";
5
+ import r from "../../assets/glass.js";
6
6
  import { normalizeNumber as i } from "../../shared/normalize/index.js";
7
7
  import a from "./style.js";
8
8
  import { LitElement as o, html as s, unsafeCSS as c } from "lit";
@@ -10,13 +10,13 @@ import { customElement as l, property as u, state as d } from "lit/decorators.js
10
10
  //#region src/components/input-number/index.ts
11
11
  var f = class extends o {
12
12
  constructor(...e) {
13
- super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.required = !1, this._value = 0, this._min = 0, this._max = Infinity, this._step = 1, this._focused = !1, this._formDisabled = !1, this._precision = 0;
13
+ super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this._value = 0, this._min = 0, this._max = Infinity, this._step = 1, this._focused = !1, this._formDisabled = !1, this._precision = 0;
14
14
  }
15
15
  static {
16
16
  this.formAssociated = !0;
17
17
  }
18
18
  static {
19
- this.styles = [c(t), c(a)];
19
+ this.styles = [c(r), c(a)];
20
20
  }
21
21
  get precision() {
22
22
  return this._precision;
@@ -104,15 +104,23 @@ var f = class extends o {
104
104
  }));
105
105
  }
106
106
  handleStep(e) {
107
- this._isDisabled || this.setValueAndNotify(this._value + e * this._effectiveStep);
107
+ this._isDisabled || this.readonly || this.setValueAndNotify(this._value + e * this._effectiveStep);
108
108
  }
109
109
  handleInput(e) {
110
- if (!(e.target instanceof HTMLInputElement)) return;
110
+ if (this.readonly || !(e.target instanceof HTMLInputElement)) return;
111
111
  let t = e.target.value;
112
112
  t !== "" && t !== "-" && (this._value = this.clamp(this.round(Number(t))), this._internals?.setFormValue?.(String(this._value)), this._syncValidity());
113
113
  }
114
+ handleNativeChange(e) {
115
+ if (this.readonly || !(e.target instanceof HTMLInputElement)) return;
116
+ let t = e.target.value;
117
+ t !== "" && t !== "-" && (this._value = this.clamp(this.round(Number(t))), this._internals?.setFormValue?.(String(this._value)), this._syncValidity(), this.dispatchEvent(new Event("change", {
118
+ bubbles: !0,
119
+ composed: !0
120
+ })));
121
+ }
114
122
  handleKeydown(e) {
115
- this._isDisabled || (e.key === "ArrowUp" ? (e.preventDefault(), this.setValueAndNotify(this._value + this._effectiveStep), this.dispatchEvent(new Event("change", {
123
+ this._isDisabled || this.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), this.setValueAndNotify(this._value + this._effectiveStep), this.dispatchEvent(new Event("change", {
116
124
  bubbles: !0,
117
125
  composed: !0
118
126
  }))) : e.key === "ArrowDown" && (e.preventDefault(), this.setValueAndNotify(this._value - this._effectiveStep), this.dispatchEvent(new Event("change", {
@@ -132,10 +140,10 @@ var f = class extends o {
132
140
  <button
133
141
  class="num-btn"
134
142
  aria-label="Decrease"
135
- ?disabled=${this._isDisabled || this.atMin}
143
+ ?disabled=${this._isDisabled || this.readonly || this.atMin}
136
144
  @click=${() => this.handleStep(-1)}
137
145
  >
138
- <web-ui-icon .icon=${r}></web-ui-icon>
146
+ <web-ui-icon .icon=${n}></web-ui-icon>
139
147
  </button>
140
148
  <input
141
149
  type="number"
@@ -143,8 +151,10 @@ var f = class extends o {
143
151
  name=${this.name}
144
152
  .value=${String(this._value)}
145
153
  ?disabled=${this._isDisabled}
154
+ ?readonly=${this.readonly}
146
155
  ?required=${this.required}
147
156
  @input=${this.handleInput}
157
+ @change=${this.handleNativeChange}
148
158
  @keydown=${this.handleKeydown}
149
159
  @focus=${this.handleFocus}
150
160
  @blur=${this.handleBlur}
@@ -152,10 +162,10 @@ var f = class extends o {
152
162
  <button
153
163
  class="num-btn"
154
164
  aria-label="Increase"
155
- ?disabled=${this._isDisabled || this.atMax}
165
+ ?disabled=${this._isDisabled || this.readonly || this.atMax}
156
166
  @click=${() => this.handleStep(1)}
157
167
  >
158
- <web-ui-icon .icon=${n}></web-ui-icon>
168
+ <web-ui-icon .icon=${t}></web-ui-icon>
159
169
  </button>
160
170
  </div>
161
171
  `;
@@ -173,6 +183,9 @@ e([u({
173
183
  })], f.prototype, "disabled", void 0), e([u({
174
184
  type: Boolean,
175
185
  reflect: !0
186
+ })], f.prototype, "readonly", void 0), e([u({
187
+ type: Boolean,
188
+ reflect: !0
176
189
  })], f.prototype, "required", void 0), e([u({
177
190
  type: Number,
178
191
  reflect: !0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input-number/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\n// web-ui-icon 必须注册(Rolldown tree-shake 副作用 import,引用类名阻止删除)\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideMinus, lucidePlus } from '@/icons'\nimport { normalizeNumber } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input-number')\nexport class WebUiInputNumber extends LitElement {\n static formAssociated = true\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Number, reflect: true })\n get precision(): number {\n return this._precision\n }\n // 精度变化时重算现有值,避免浮点累积误差\n set precision(v: number) {\n const old = this._precision\n this._precision = v\n const current = this.clamp(this.round(this._value))\n if (current !== this._value) {\n this._value = current\n this._internals?.setFormValue?.(String(current))\n }\n this.requestUpdate('precision', old)\n }\n\n @state() private _value = 0\n @state() private _min = 0\n @state() private _max = Infinity\n @state() private _step = 1\n @state() private _focused = false\n @state() private _formDisabled = false\n private _precision = 0\n\n private _internals?: ElementInternals\n\n @property({ type: Number, reflect: true })\n get value(): number {\n return this._value\n }\n\n set value(v: number) {\n const clamped = this.clamp(this.round(v))\n const old = this._value\n this._value = clamped\n this._internals?.setFormValue?.(String(clamped))\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n @property({ type: Number })\n get min(): number {\n return this._min\n }\n\n set min(v: unknown) {\n this._min = normalizeNumber(v, -Infinity, Infinity, 0)\n }\n\n @property({ type: Number })\n get max(): number {\n return this._max\n }\n\n set max(v: unknown) {\n this._max = normalizeNumber(v, -Infinity, Infinity, Infinity)\n }\n\n @property({ type: Number })\n get step(): number {\n return this._step\n }\n\n // 步进值,默认 1;若声明了 precision 则以 precision 退化步进\n set step(v: unknown) {\n this._step = normalizeNumber(v, 0, Infinity, 1)\n }\n\n private get _effectiveStep(): number {\n return this._step\n }\n\n private get atMin(): boolean {\n return this._value <= this._min\n }\n\n private get atMax(): boolean {\n return this._value >= this._max\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this._internals) {\n this._internals = this.attachInternals()\n }\n this._internals.setFormValue?.(String(this._value))\n }\n\n formResetCallback() {\n const attr = this.getAttribute('value')\n this.value = attr !== null ? Number(attr) : 0\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = Number(state)\n }\n\n override updated() {\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n if (!this._internals || !input || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || input.validity.valid) {\n this._internals.setValidity({})\n return\n }\n const flags: ValidityStateFlags = {}\n if (input.validity.valueMissing) flags.valueMissing = true\n if (input.validity.rangeUnderflow) flags.rangeUnderflow = true\n if (input.validity.rangeOverflow) flags.rangeOverflow = true\n if (input.validity.stepMismatch) flags.stepMismatch = true\n this._internals.setValidity(flags, input.validationMessage, input)\n }\n\n private clamp(v: number): number {\n return Math.min(this._max, Math.max(this._min, v))\n }\n\n private round(v: number): number {\n const f = 10 ** this.precision\n return Math.round(v * f) / f\n }\n\n private setValueAndNotify(v: number) {\n this.value = this.clamp(this.round(v))\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private handleStep(direction: 1 | -1) {\n if (this._isDisabled) return\n this.setValueAndNotify(this._value + direction * this._effectiveStep)\n }\n\n private handleInput(e: Event) {\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n if (raw === '' || raw === '-') return\n this._value = this.clamp(this.round(Number(raw)))\n this._internals?.setFormValue?.(String(this._value))\n this._syncValidity()\n }\n\n private handleKeydown(e: KeyboardEvent) {\n if (this._isDisabled) return\n if (e.key === 'ArrowUp') {\n e.preventDefault()\n this.setValueAndNotify(this._value + this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n } else if (e.key === 'ArrowDown') {\n e.preventDefault()\n this.setValueAndNotify(this._value - this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n override render() {\n return html`\n <div class=\"wui-glass wui-input-inner\">\n <button\n class=\"num-btn\"\n aria-label=\"Decrease\"\n ?disabled=${this._isDisabled || this.atMin}\n @click=${() => this.handleStep(-1)}\n >\n <web-ui-icon .icon=${lucideMinus}></web-ui-icon>\n </button>\n <input\n type=\"number\"\n placeholder=${this.placeholder}\n name=${this.name}\n .value=${String(this._value)}\n ?disabled=${this._isDisabled}\n ?required=${this.required}\n @input=${this.handleInput}\n @keydown=${this.handleKeydown}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n <button\n class=\"num-btn\"\n aria-label=\"Increase\"\n ?disabled=${this._isDisabled || this.atMax}\n @click=${() => this.handleStep(1)}\n >\n <web-ui-icon .icon=${lucidePlus}></web-ui-icon>\n </button>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input-number': WebUiInputNumber\n }\n}\n"],"mappings":";;;;;;;;;;AAYO,IAAM,IAAN,cAA+B,EAAW;;EA8B1B,aA1BoC,KAAA,cAAA,IACP,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IAiB7B,KAAA,SAAA,GACF,KAAA,OAAA,GACA,KAAA,OAAA,UACC,KAAA,QAAA,GACG,KAAA,WAAA,IACK,KAAA,gBAAA,IACZ,KAAA,aAAA;;;EA7BG,KAAA,iBAAA;;;EACC,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAM5D,IACI,YAAoB;EACtB,OAAO,KAAK;CACd;CAEA,IAAI,UAAU,GAAW;EACvB,IAAM,IAAM,KAAK;EACjB,KAAK,aAAa;EAClB,IAAM,IAAU,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC;EAKlD,AAJI,MAAY,KAAK,WACnB,KAAK,SAAS,GACd,KAAK,YAAY,eAAe,OAAO,CAAO,CAAC,IAEjD,KAAK,cAAc,aAAa,CAAG;CACrC;CAYA,IACI,QAAgB;EAClB,OAAO,KAAK;CACd;CAEA,IAAI,MAAM,GAAW;EACnB,IAAM,IAAU,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC,GAClC,IAAM,KAAK;EAGjB,AAFA,KAAK,SAAS,GACd,KAAK,YAAY,eAAe,OAAO,CAAO,CAAC,GAC/C,KAAK,cAAc,SAAS,CAAG;CACjC;CAEA,IAAY,cAAuB;EACjC,OAAO,KAAK,YAAY,KAAK;CAC/B;CAEA,IACI,MAAc;EAChB,OAAO,KAAK;CACd;CAEA,IAAI,IAAI,GAAY;EAClB,KAAK,OAAO,EAAgB,GAAG,WAAW,UAAU,CAAC;CACvD;CAEA,IACI,MAAc;EAChB,OAAO,KAAK;CAC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,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GAKN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAiBxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,IAAA,GAtE3B,IAAA,EAAA,CAAA,EAAc,qBAAqB,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input-number/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideMinus, lucidePlus } from '@/icons'\nimport { normalizeNumber } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input-number')\nexport class WebUiInputNumber extends LitElement {\n static formAssociated = true\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) readonly = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Number, reflect: true })\n get precision(): number {\n return this._precision\n }\n // 精度变化时重算现有值,避免浮点累积误差\n set precision(v: number) {\n const old = this._precision\n this._precision = v\n const current = this.clamp(this.round(this._value))\n if (current !== this._value) {\n this._value = current\n this._internals?.setFormValue?.(String(current))\n }\n this.requestUpdate('precision', old)\n }\n\n @state() private _value = 0\n @state() private _min = 0\n @state() private _max = Infinity\n @state() private _step = 1\n @state() private _focused = false\n @state() private _formDisabled = false\n private _precision = 0\n\n private _internals?: ElementInternals\n\n @property({ type: Number, reflect: true })\n get value(): number {\n return this._value\n }\n\n set value(v: number) {\n const clamped = this.clamp(this.round(v))\n const old = this._value\n this._value = clamped\n this._internals?.setFormValue?.(String(clamped))\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n @property({ type: Number })\n get min(): number {\n return this._min\n }\n\n set min(v: unknown) {\n this._min = normalizeNumber(v, -Infinity, Infinity, 0)\n }\n\n @property({ type: Number })\n get max(): number {\n return this._max\n }\n\n set max(v: unknown) {\n this._max = normalizeNumber(v, -Infinity, Infinity, Infinity)\n }\n\n @property({ type: Number })\n get step(): number {\n return this._step\n }\n\n // 步进值,默认 1;若声明了 precision 则以 precision 退化步进\n set step(v: unknown) {\n this._step = normalizeNumber(v, 0, Infinity, 1)\n }\n\n private get _effectiveStep(): number {\n return this._step\n }\n\n private get atMin(): boolean {\n return this._value <= this._min\n }\n\n private get atMax(): boolean {\n return this._value >= this._max\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this._internals) {\n this._internals = this.attachInternals()\n }\n this._internals.setFormValue?.(String(this._value))\n }\n\n formResetCallback() {\n const attr = this.getAttribute('value')\n this.value = attr !== null ? Number(attr) : 0\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = Number(state)\n }\n\n override updated() {\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n if (!this._internals || !input || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || input.validity.valid) {\n this._internals.setValidity({})\n return\n }\n const flags: ValidityStateFlags = {}\n if (input.validity.valueMissing) flags.valueMissing = true\n if (input.validity.rangeUnderflow) flags.rangeUnderflow = true\n if (input.validity.rangeOverflow) flags.rangeOverflow = true\n if (input.validity.stepMismatch) flags.stepMismatch = true\n this._internals.setValidity(flags, input.validationMessage, input)\n }\n\n private clamp(v: number): number {\n return Math.min(this._max, Math.max(this._min, v))\n }\n\n private round(v: number): number {\n const f = 10 ** this.precision\n return Math.round(v * f) / f\n }\n\n private setValueAndNotify(v: number) {\n this.value = this.clamp(this.round(v))\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private handleStep(direction: 1 | -1) {\n if (this._isDisabled || this.readonly) return\n this.setValueAndNotify(this._value + direction * this._effectiveStep)\n }\n\n private handleInput(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n if (raw === '' || raw === '-') return\n this._value = this.clamp(this.round(Number(raw)))\n this._internals?.setFormValue?.(String(this._value))\n this._syncValidity()\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;文本失焦提交时补发 composed 事件,\n // 与 ArrowUp/ArrowDown 的 change 行为对齐。\n private handleNativeChange(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n const raw = e.target.value\n if (raw === '' || raw === '-') return\n this._value = this.clamp(this.round(Number(raw)))\n this._internals?.setFormValue?.(String(this._value))\n this._syncValidity()\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handleKeydown(e: KeyboardEvent) {\n if (this._isDisabled || this.readonly) return\n if (e.key === 'ArrowUp') {\n e.preventDefault()\n this.setValueAndNotify(this._value + this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n } else if (e.key === 'ArrowDown') {\n e.preventDefault()\n this.setValueAndNotify(this._value - this._effectiveStep)\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n override render() {\n return html`\n <div class=\"wui-glass wui-input-inner\">\n <button\n class=\"num-btn\"\n aria-label=\"Decrease\"\n ?disabled=${this._isDisabled || this.readonly || this.atMin}\n @click=${() => this.handleStep(-1)}\n >\n <web-ui-icon .icon=${lucideMinus}></web-ui-icon>\n </button>\n <input\n type=\"number\"\n placeholder=${this.placeholder}\n name=${this.name}\n .value=${String(this._value)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @keydown=${this.handleKeydown}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n <button\n class=\"num-btn\"\n aria-label=\"Increase\"\n ?disabled=${this._isDisabled || this.readonly || this.atMax}\n @click=${() => this.handleStep(1)}\n >\n <web-ui-icon .icon=${lucidePlus}></web-ui-icon>\n </button>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input-number': WebUiInputNumber\n }\n}\n"],"mappings":";;;;;;;;;;AAWO,IAAM,IAAN,cAA+B,EAAW;;EA+B1B,aA3BoC,KAAA,cAAA,IACP,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IACA,KAAA,WAAA,IAiB7B,KAAA,SAAA,GACF,KAAA,OAAA,GACA,KAAA,OAAA,UACC,KAAA,QAAA,GACG,KAAA,WAAA,IACK,KAAA,gBAAA,IACZ,KAAA,aAAA;;;EA9BG,KAAA,iBAAA;;;EACC,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAO5D,IACI,YAAoB;EACtB,OAAO,KAAK;CACd;CAEA,IAAI,UAAU,GAAW;EACvB,IAAM,IAAM,KAAK;EACjB,KAAK,aAAa;EAClB,IAAM,IAAU,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC;EAKlD,AAJI,MAAY,KAAK,WACnB,KAAK,SAAS,GACd,KAAK,YAAY,eAAe,OAAO,CAAO,CAAC,IAEjD,KAAK,cAAc,aAAa,CAAG;CACrC;CAYA,IACI,QAAgB;EAClB,OAAO,K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EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,IAAA,GASzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,IAAA,GAvE3B,IAAA,EAAA,CAAA,EAAc,qBAAqB,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/input-number/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:2147483647px;align-items:center;gap:4px;padding:0 4px;display:flex;position:relative}:host([focused]) .wui-input-inner{--wui-glass-shadow:var(--wui-shadow-glass,0 2px 16px #0000000f), 0 0 0 3px var(--wui-focus-ring,#08f6);border-color:var(--wui-color-border-strong,#006ee680)}input{min-width:48px;height:100%;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-align:center;background:0 0;border:none;outline:none;flex:1}input::-webkit-inner-spin-button{appearance:none;margin:0}input::-webkit-outer-spin-button{appearance:none;margin:0}input[type=number]{appearance:textfield}input:disabled{cursor:not-allowed;opacity:.4}.num-btn{cursor:pointer;width:32px;height:32px;color:var(--wui-color-text-muted,#6a6a6a);transition:background-color var(--wui-duration-trigger,.16s) ease;background:0 0;border:none;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}.num-btn:disabled{cursor:not-allowed;opacity:.4}.num-btn:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}@media (hover:hover) and (pointer:fine){.num-btn:hover:not(:disabled){background:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 12%, transparent)}}.num-btn:active:not(:disabled){background:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 18%, transparent)}@media (prefers-reduced-motion:reduce){.num-btn{transition:background-color var(--wui-duration-trigger,.16s) ease}}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:2147483647px;align-items:center;gap:4px;padding:0 4px;display:flex;position:relative}:host([focused]) .wui-input-inner{--wui-glass-shadow:var(--wui-shadow-glass,0 2px 16px #0000000f), 0 0 0 3px var(--wui-focus-ring,#08f6);border-color:var(--wui-color-border-strong,#006ee680)}input{min-width:48px;height:100%;font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-align:center;background:0 0;border:none;outline:none;flex:1;margin:0;padding:0}input::-webkit-inner-spin-button{appearance:none;margin:0}input::-webkit-outer-spin-button{appearance:none;margin:0}input[type=number]{appearance:textfield}input:disabled{cursor:not-allowed;opacity:.4}.num-btn{cursor:pointer;width:32px;height:32px;color:var(--wui-color-text-muted,#6a6a6a);transition:background-color var(--wui-duration-trigger,.16s) ease;background:0 0;border:none;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex}.num-btn:disabled{cursor:not-allowed;opacity:.4}.num-btn:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}@media (hover:hover) and (pointer:fine){.num-btn:hover:not(:disabled){background:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 12%, transparent)}}.num-btn:active:not(:disabled){background:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 18%, transparent)}@media (prefers-reduced-motion:reduce){.num-btn{transition:background-color var(--wui-duration-trigger,.16s) ease}}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input-number/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 opacity: 0.4;\n}\n\n.wui-input-inner {\n position: relative;\n\n display: flex;\n gap: 4px;\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 4px;\n border-radius: calc(infinity * 1px);\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([focused]) .wui-input-inner {\n --wui-glass-shadow:\n var(--wui-shadow-glass, 0 2px 16px rgb(0 0 0 / 0.06)), 0 0 0 3px var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n border-color: var(--wui-color-border-strong, rgb(0 110 230 / 0.5));\n}\n\ninput {\n flex: 1;\n\n min-width: 48px;\n height: 100%;\n border: none;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-align: center;\n\n background: transparent;\n outline: none;\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n margin: 0;\n appearance: none;\n }\n\n &[type='number'] {\n appearance: textfield;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n.num-btn {\n cursor: pointer;\n\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 32px;\n height: 32px;\n border: none;\n border-radius: calc(infinity * 1px);\n\n color: var(--wui-color-text-muted, #6a6a6a);\n\n background: transparent;\n\n transition: background-color var(--wui-duration-trigger, 160ms) ease;\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\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@media (hover: hover) and (pointer: fine) {\n .num-btn:hover:not(:disabled) {\n background: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 12%, transparent);\n }\n}\n\n.num-btn:active:not(:disabled) {\n background: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 18%, transparent);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .num-btn {\n transition: background-color var(--wui-duration-trigger, 160ms) ease;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input-number/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 opacity: 0.4;\n}\n\n.wui-input-inner {\n position: relative;\n\n display: flex;\n gap: 4px;\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 4px;\n border-radius: calc(infinity * 1px);\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([focused]) .wui-input-inner {\n --wui-glass-shadow:\n var(--wui-shadow-glass, 0 2px 16px rgb(0 0 0 / 0.06)), 0 0 0 3px var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n border-color: var(--wui-color-border-strong, rgb(0 110 230 / 0.5));\n}\n\ninput {\n flex: 1;\n\n min-width: 48px;\n height: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-align: center;\n\n background: transparent;\n outline: none;\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n margin: 0;\n appearance: none;\n }\n\n &[type='number'] {\n appearance: textfield;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n.num-btn {\n cursor: pointer;\n\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: calc(infinity * 1px);\n\n color: var(--wui-color-text-muted, #6a6a6a);\n\n background: transparent;\n\n transition: background-color var(--wui-duration-trigger, 160ms) ease;\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\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@media (hover: hover) and (pointer: fine) {\n .num-btn:hover:not(:disabled) {\n background: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 12%, transparent);\n }\n}\n\n.num-btn:active:not(:disabled) {\n background: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 18%, transparent);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .num-btn {\n transition: background-color var(--wui-duration-trigger, 160ms) ease;\n }\n}\n"],"mappings":""}
@@ -6,7 +6,6 @@ export declare class WebUiLayout extends LitElement {
6
6
  private _closeSidebar;
7
7
  private _onSidebarClick;
8
8
  render(): import('lit').TemplateResult<1>;
9
- readonly $events: Record<string, never>;
10
9
  }
11
10
  declare global {
12
11
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
2
2
  import "../icon/index.js";
3
- import t from "../../assets/glass.js";
4
- import n from "../../icons/generated/radix-icons-panel-left-minimized.js";
3
+ import t from "../../icons/generated/radix-icons-panel-left-minimized.js";
4
+ import n from "../../assets/glass.js";
5
5
  import "../button/index.js";
6
6
  import r from "./style.js";
7
7
  import { LitElement as i, html as a, unsafeCSS as o } from "lit";
@@ -13,7 +13,7 @@ var u = class extends i {
13
13
  super(...e), this._sidebarOpen = !1;
14
14
  }
15
15
  static {
16
- this.styles = [o(t), o(r)];
16
+ this.styles = [o(n), o(r)];
17
17
  }
18
18
  _toggleSidebar() {
19
19
  this._sidebarOpen = !this._sidebarOpen;
@@ -53,7 +53,7 @@ var u = class extends i {
53
53
  @click="${this._toggleSidebar}"
54
54
  aria-label="打开导航菜单"
55
55
  >
56
- <web-ui-icon .icon=${n}></web-ui-icon>
56
+ <web-ui-icon .icon=${t}></web-ui-icon>
57
57
  </web-ui-button>
58
58
  `;
59
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/layout/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\nimport glass from '@/assets/glass.css?inline'\nimport '@/components/icon'\nimport '@/components/button'\nimport { radixIconsPanelLeftMinimized } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-layout')\nexport class WebUiLayout extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @state() private _sidebarOpen = false\n\n private _toggleSidebar() {\n this._sidebarOpen = !this._sidebarOpen\n }\n\n private _closeSidebar() {\n this._sidebarOpen = false\n }\n\n private _onSidebarClick(e: MouseEvent) {\n const target = e.target as HTMLElement\n if (target.closest('a, button, [role=\"button\"]')) {\n this._closeSidebar()\n }\n }\n\n override render() {\n return html`\n <div class=\"layout-grid\">\n <header>\n <slot name=\"header\"></slot>\n </header>\n <main>\n <slot></slot>\n </main>\n <aside class=\"${classMap({ open: this._sidebarOpen })}\" @click=\"${this._onSidebarClick}\">\n <div class=\"menu wui-glass\"><slot name=\"sidebar\"></slot></div>\n </aside>\n <footer>\n <slot name=\"tabbar\"></slot>\n </footer>\n </div>\n\n <div class=\"${classMap({ backdrop: true, open: this._sidebarOpen })}\" @click=\"${this._closeSidebar}\"></div>\n\n <web-ui-button\n class=\"mobile-toggle\"\n icon\n variant=\"glass\"\n @click=\"${this._toggleSidebar}\"\n aria-label=\"打开导航菜单\"\n >\n <web-ui-icon .icon=${radixIconsPanelLeftMinimized}></web-ui-icon>\n </web-ui-button>\n `\n }\n\n declare readonly $events: Record<string, never>\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-layout': WebUiLayout\n }\n}\n"],"mappings":";;;;;;;;;;AAYO,IAAM,IAAN,cAA0B,EAAW;;EAGV,aAAA,KAAA,eAAA;;;EAFP,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAI5D,iBAAyB;EACvB,KAAK,eAAe,CAAC,KAAK;CAC5B;CAEA,gBAAwB;EACtB,KAAK,eAAe;CACtB;CAEA,gBAAwB,GAAe;EAErC,AADe,EAAE,OACN,QAAQ,8BAA4B,KAC7C,KAAK,cAAc;CAEvB;CAEA,SAAkB;EAChB,OAAO,CAAI;;;;;;;;wBAQS,EAAS,EAAE,MAAM,KAAK,aAAa,CAAC,EAAE,YAAY,KAAK,gBAAgB;;;;;;;;oBAQ3E,EAAS;GAAE,UAAU;GAAM,MAAM,KAAK;EAAa,CAAC,EAAE,YAAY,KAAK,cAAc;;;;;;kBAMvF,KAAK,eAAe;;;6BAGT,EAA6B;;;CAGxD;AAGF;AAjDG,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GAJR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/layout/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\nimport glass from '@/assets/glass.css?inline'\nimport '@/components/icon'\nimport '@/components/button'\nimport { radixIconsPanelLeftMinimized } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-layout')\nexport class WebUiLayout extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @state() private _sidebarOpen = false\n\n private _toggleSidebar() {\n this._sidebarOpen = !this._sidebarOpen\n }\n\n private _closeSidebar() {\n this._sidebarOpen = false\n }\n\n private _onSidebarClick(e: MouseEvent) {\n const target = e.target as HTMLElement\n if (target.closest('a, button, [role=\"button\"]')) {\n this._closeSidebar()\n }\n }\n\n override render() {\n return html`\n <div class=\"layout-grid\">\n <header>\n <slot name=\"header\"></slot>\n </header>\n <main>\n <slot></slot>\n </main>\n <aside class=\"${classMap({ open: this._sidebarOpen })}\" @click=\"${this._onSidebarClick}\">\n <div class=\"menu wui-glass\"><slot name=\"sidebar\"></slot></div>\n </aside>\n <footer>\n <slot name=\"tabbar\"></slot>\n </footer>\n </div>\n\n <div class=\"${classMap({ backdrop: true, open: this._sidebarOpen })}\" @click=\"${this._closeSidebar}\"></div>\n\n <web-ui-button\n class=\"mobile-toggle\"\n icon\n variant=\"glass\"\n @click=\"${this._toggleSidebar}\"\n aria-label=\"打开导航菜单\"\n >\n <web-ui-icon .icon=${radixIconsPanelLeftMinimized}></web-ui-icon>\n </web-ui-button>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-layout': WebUiLayout\n }\n}\n"],"mappings":";;;;;;;;;;AAYO,IAAM,IAAN,cAA0B,EAAW;;EAGV,aAAA,KAAA,eAAA;;;EAFP,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAI5D,iBAAyB;EACvB,KAAK,eAAe,CAAC,KAAK;CAC5B;CAEA,gBAAwB;EACtB,KAAK,eAAe;CACtB;CAEA,gBAAwB,GAAe;EAErC,AADe,EAAE,OACN,QAAQ,8BAA4B,KAC7C,KAAK,cAAc;CAEvB;CAEA,SAAkB;EAChB,OAAO,CAAI;;;;;;;;wBAQS,EAAS,EAAE,MAAM,KAAK,aAAa,CAAC,EAAE,YAAY,KAAK,gBAAgB;;;;;;;;oBAQ3E,EAAS;GAAE,UAAU;GAAM,MAAM,KAAK;EAAa,CAAC,EAAE,YAAY,KAAK,cAAc;;;;;;kBAMvF,KAAK,eAAe;;;6BAGT,EAA6B;;;CAGxD;AACF;AA/CG,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GAJR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
@@ -14,17 +14,6 @@ export declare class WebUiOption extends LitElement {
14
14
  private _onLabelSlotChange;
15
15
  private _getSlottedLabel;
16
16
  render(): import('lit').TemplateResult<1>;
17
- readonly $events: {
18
- 'option-register': CustomEvent<{
19
- value: string;
20
- label: string;
21
- disabled: boolean;
22
- }>;
23
- 'option-unregister': CustomEvent<{
24
- value: string;
25
- }>;
26
- 'option-update': CustomEvent<void>;
27
- };
28
17
  }
29
18
  declare global {
30
19
  interface HTMLElementTagNameMap {
@@ -54,7 +54,7 @@ var c = class extends r {
54
54
  render() {
55
55
  return i`
56
56
  <div class="option-label">
57
- <web-ui-icon class="check" .size=${16} .icon=${t}></web-ui-icon>
57
+ <web-ui-icon class="check" size="16" .icon=${t}></web-ui-icon>
58
58
  <slot name="prefix"></slot>
59
59
  <span class="content-wrap">${this._label || i`<slot @slotchange=${this._onLabelSlotChange}></slot>`}</span>
60
60
  <slot name="suffix"></slot>
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/option/index.ts"],"sourcesContent":["import { html, LitElement, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport { heroiconsCheck16Solid } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-option')\nexport class WebUiOption extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: String, reflect: true }) value = ''\n @property({ type: String })\n get label(): string {\n return this._label || this._getSlottedLabel()\n }\n set label(value: string) {\n const old = this.label\n this._label = value\n this.requestUpdate('label', old)\n }\n private _label = ''\n private _slottedLabel = ''\n\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) selected = false\n\n override connectedCallback() {\n super.connectedCallback()\n this.dispatchEvent(\n new CustomEvent('option-register', {\n bubbles: true,\n composed: true,\n detail: { value: this.value, label: this.label, disabled: this.disabled }\n })\n )\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.dispatchEvent(\n new CustomEvent('option-unregister', {\n bubbles: true,\n composed: true,\n detail: { value: this.value }\n })\n )\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('value') || changed.has('label') || changed.has('disabled')) {\n this.dispatchEvent(\n new CustomEvent('option-update', {\n bubbles: true,\n composed: true\n })\n )\n }\n }\n\n private _onLabelSlotChange = () => {\n const label = this._getSlottedLabel()\n if (label === this._slottedLabel) return\n\n const old = this._label || this._slottedLabel\n this._slottedLabel = label\n this.requestUpdate('label', old)\n }\n\n private _getSlottedLabel(): string {\n return [...this.childNodes]\n .filter(node => !(node instanceof HTMLElement && node.slot))\n .map(node => node.textContent)\n .join('')\n .trim()\n }\n\n override render() {\n return html`\n <div class=\"option-label\">\n <web-ui-icon class=\"check\" .size=${16} .icon=${heroiconsCheck16Solid}></web-ui-icon>\n <slot name=\"prefix\"></slot>\n <span class=\"content-wrap\">${this._label || html`<slot @slotchange=${this._onLabelSlotChange}></slot>`}</span>\n <slot name=\"suffix\"></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n 'option-register': CustomEvent<{ value: string; label: string; disabled: boolean }>\n 'option-unregister': CustomEvent<{ value: string }>\n 'option-update': CustomEvent<void>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-option': WebUiOption\n }\n}\n"],"mappings":";;;;;;;AASO,IAAM,IAAN,cAA0B,EAAW;;EAoDP,aAjDgB,KAAA,QAAA,IAUlC,KAAA,SAAA,IACO,KAAA,gBAAA,IAE+B,KAAA,WAAA,IACA,KAAA,WAAA,IAmCpB,KAAA,2BAAA;GACjC,IAAM,IAAQ,KAAK,iBAAiB;GACpC,IAAI,MAAU,KAAK,eAAe;GAElC,IAAM,IAAM,KAAK,UAAU,KAAK;GAEhC,AADA,KAAK,gBAAgB,GACrB,KAAK,cAAc,SAAS,CAAG;EACjC;;;EA1DyB,KAAA,SAAA,EAAU,CAAK;;CAGxC,IACI,QAAgB;EAClB,OAAO,KAAK,UAAU,KA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;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,GAlB3C,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/option/index.ts"],"sourcesContent":["import { html, LitElement, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport { heroiconsCheck16Solid } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-option')\nexport class WebUiOption extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: String, reflect: true }) value = ''\n @property({ type: String })\n get label(): string {\n return this._label || this._getSlottedLabel()\n }\n set label(value: string) {\n const old = this.label\n this._label = value\n this.requestUpdate('label', old)\n }\n private _label = ''\n private _slottedLabel = ''\n\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) selected = false\n\n override connectedCallback() {\n super.connectedCallback()\n this.dispatchEvent(\n new CustomEvent('option-register', {\n bubbles: true,\n composed: true,\n detail: { value: this.value, label: this.label, disabled: this.disabled }\n })\n )\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this.dispatchEvent(\n new CustomEvent('option-unregister', {\n bubbles: true,\n composed: true,\n detail: { value: this.value }\n })\n )\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('value') || changed.has('label') || changed.has('disabled')) {\n this.dispatchEvent(\n new CustomEvent('option-update', {\n bubbles: true,\n composed: true\n })\n )\n }\n }\n\n private _onLabelSlotChange = () => {\n const label = this._getSlottedLabel()\n if (label === this._slottedLabel) return\n\n const old = this._label || this._slottedLabel\n this._slottedLabel = label\n this.requestUpdate('label', old)\n }\n\n private _getSlottedLabel(): string {\n return [...this.childNodes]\n .filter(node => !(node instanceof HTMLElement && node.slot))\n .map(node => node.textContent)\n .join('')\n .trim()\n }\n\n override render() {\n return html`\n <div class=\"option-label\">\n <web-ui-icon class=\"check\" size=\"16\" .icon=${heroiconsCheck16Solid}></web-ui-icon>\n <slot name=\"prefix\"></slot>\n <span class=\"content-wrap\">${this._label || html`<slot @slotchange=${this._onLabelSlotChange}></slot>`}</span>\n <slot name=\"suffix\"></slot>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-option': WebUiOption\n }\n}\n"],"mappings":";;;;;;;AASO,IAAM,IAAN,cAA0B,EAAW;;EAoDP,aAjDgB,KAAA,QAAA,IAUlC,KAAA,SAAA,IACO,KAAA,gBAAA,IAE+B,KAAA,WAAA,IACA,KAAA,WAAA,IAmCpB,KAAA,2BAAA;GACjC,IAAM,IAAQ,KAAK,iBAAiB;GACpC,IAAI,MAAU,KAAK,eAAe;GAElC,IAAM,IAAM,KAAK,UAAU,KAAK;GAEhC,AADA,KAAK,gBAAgB,GACrB,KAAK,cAAc,SAAS,CAAG;EACjC;;;EA1DyB,KAAA,SAAA,EAAU,CAAK;;CAGxC,IACI,QAAgB;EAClB,OAAO,KAAK,UAAU,KAAK,iBAAiB;CAC9C;CACA,IAAI,MAAM,GAAe;EACvB,IAAM,IAAM,KAAK;EAEjB,AADA,KAAK,SAAS,GACd,KAAK,cAAc,SAAS,CAAG;CACjC;CAOA,oBAA6B;EAE3B,AADA,MAAM,kBAAkB,GACxB,KAAK,cACH,IAAI,YAAY,mBAAmB;GACjC,SAAS;GACT,UAAU;GACV,QAAQ;IAAE,OAAO,KAAK;IAAO,OAAO,KAAK;IAAO,UAAU,KAAK;GAAS;EAC1E,CAAC,CACH;CACF;CAEA,uBAAgC;EAE9B,AADA,MAAM,qBAAqB,GAC3B,KAAK,cACH,IAAI,YAAY,qBAAqB;GACnC,SAAS;GACT,UAAU;GACV,QAAQ,EAAE,OAAO,KAAK,MAAM;EAC9B,CAAC,CACH;CACF;CAEA,QAAiB,GAAyB;EACxC,CAAI,EAAQ,IAAI,OAAO,KAAK,EAAQ,IAAI,OAAO,KAAK,EAAQ,IAAI,UAAU,MACxE,KAAK,cACH,IAAI,YAAY,iBAAiB;GAC/B,SAAS;GACT,UAAU;EACZ,CAAC,CACH;CAEJ;CAWA,mBAAmC;EACjC,OAAO,CAAC,GAAG,KAAK,UAAU,CAAC,CACxB,QAAO,MAAQ,EAAE,aAAgB,eAAe,EAAK,KAAK,CAAC,CAC3D,KAAI,MAAQ,EAAK,WAAW,CAAC,CAC7B,KAAK,EAAE,CAAC,CACR,KAAK;CACV;CAEA,SAAkB;EAChB,OAAO,CAAI;;qDAEsC,EAAsB;;qCAEtC,KAAK,UAAU,CAAI,qBAAqB,KAAK,mBAAmB,UAAU;;;;CAI7G;AACF;AA5EG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAYzB,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,YAAA,KAAA,CAAA,GAlB3C,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/option/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.option-label{cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;height:32px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;transition:color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1)), background-color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));border-radius:2147483647px;align-items:center;gap:8px;padding:0 12px;display:flex;overflow:hidden}.check{flex-shrink:0}.content-wrap{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([selected])) .check{visibility:hidden}::slotted([slot=prefix]),::slotted([slot=suffix]){flex-shrink:0}.option-label:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}:host([active]) .option-label{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}@media (hover:hover) and (pointer:fine){.option-label:hover{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}:host([disabled]) .option-label{cursor:not-allowed}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.option-label{cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;height:32px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;transition:color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1)), background-color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));border-radius:2147483647px;align-items:center;gap:8px;padding:0 8px;display:flex;overflow:hidden}.check{flex-shrink:0}.content-wrap{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([selected])) .check{visibility:hidden}::slotted([slot=prefix]),::slotted([slot=suffix]){flex-shrink:0}.option-label:focus-visible{outline:3px solid var(--wui-focus-ring,#08f6);outline-offset:2px}:host([active]) .option-label{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}@media (hover:hover) and (pointer:fine){.option-label:hover{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}:host([disabled]) .option-label{cursor:not-allowed}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/option/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.option-label {\n cursor: pointer;\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n height: 32px;\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n\n transition:\n color var(--wui-duration-feedback, 100ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1)),\n background-color var(--wui-duration-feedback, 100ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.check {\n flex-shrink: 0;\n}\n\n.content-wrap {\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(:not([selected])) .check {\n visibility: hidden;\n}\n\n::slotted([slot='prefix']),\n::slotted([slot='suffix']) {\n flex-shrink: 0;\n}\n\n.option-label:focus-visible {\n outline: 3px solid var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n}\n\n:host([active]) .option-label {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .option-label:hover {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n:host([disabled]) .option-label {\n cursor: not-allowed;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/option/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.option-label {\n cursor: pointer;\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n height: 32px;\n padding: 0 8px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n\n transition:\n color var(--wui-duration-feedback, 100ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1)),\n background-color var(--wui-duration-feedback, 100ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.check {\n flex-shrink: 0;\n}\n\n.content-wrap {\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(:not([selected])) .check {\n visibility: hidden;\n}\n\n::slotted([slot='prefix']),\n::slotted([slot='suffix']) {\n flex-shrink: 0;\n}\n\n.option-label:focus-visible {\n outline: 3px solid var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n}\n\n:host([active]) .option-label {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .option-label:hover {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n:host([disabled]) .option-label {\n cursor: not-allowed;\n}\n"],"mappings":""}
@@ -18,21 +18,17 @@ export declare class WebUiPopover extends LitElement {
18
18
  overlayContainer?: OverlayContainer;
19
19
  private _showTimer?;
20
20
  private _hideTimer?;
21
- private _suppressEvent;
21
+ private readonly _userOpenChange;
22
22
  private _shouldOpenInstantly;
23
23
  private _panelId;
24
24
  private readonly _panel;
25
- /** 当前是否打开 */
26
25
  get isOpen(): boolean;
27
26
  connectedCallback(): void;
28
27
  disconnectedCallback(): void;
29
28
  firstUpdated(): void;
30
29
  protected updated(changed: Map<string, unknown>): void;
31
- /** 打开 popover */
32
30
  show(): void;
33
- /** 关闭 popover */
34
31
  close(): void;
35
- /** 切换 popover */
36
32
  toggle(): void;
37
33
  private _isInsideShadowRoot;
38
34
  private _syncTriggerListeners;