@greypan/web-ui 3.0.0 → 4.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 (220) hide show
  1. package/README.CN.md +297 -34
  2. package/README.md +304 -39
  3. package/dist/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/decorate.js +1 -1
  4. package/dist/assets/glass.js +1 -1
  5. package/dist/assets/glass.js.map +1 -1
  6. package/dist/assets/menu-portal.js +1 -1
  7. package/dist/assets/menu-portal.js.map +1 -1
  8. package/dist/assets/overlay-motion.js +1 -1
  9. package/dist/assets/overlay-motion.js.map +1 -1
  10. package/dist/assets/toast-containers.js +1 -1
  11. package/dist/assets/toast-containers.js.map +1 -1
  12. package/dist/components/autocomplete/index.d.ts +4 -12
  13. package/dist/components/autocomplete/index.js +95 -102
  14. package/dist/components/autocomplete/index.js.map +1 -1
  15. package/dist/components/autocomplete/style.js +1 -1
  16. package/dist/components/autocomplete/style.js.map +1 -1
  17. package/dist/components/avatar/index.d.ts +0 -1
  18. package/dist/components/avatar/index.js +8 -13
  19. package/dist/components/avatar/index.js.map +1 -1
  20. package/dist/components/back-top/index.js +1 -1
  21. package/dist/components/back-top/style.js +1 -1
  22. package/dist/components/back-top/style.js.map +1 -1
  23. package/dist/components/badge/index.d.ts +1 -0
  24. package/dist/components/badge/index.js +12 -14
  25. package/dist/components/badge/index.js.map +1 -1
  26. package/dist/components/button/index.d.ts +2 -0
  27. package/dist/components/button/index.js +51 -38
  28. package/dist/components/button/index.js.map +1 -1
  29. package/dist/components/button/style.js +1 -1
  30. package/dist/components/button/style.js.map +1 -1
  31. package/dist/components/button-group/index.d.ts +1 -2
  32. package/dist/components/button-group/index.js +19 -23
  33. package/dist/components/button-group/index.js.map +1 -1
  34. package/dist/components/checkbox/index.d.ts +4 -7
  35. package/dist/components/checkbox/index.js +48 -37
  36. package/dist/components/checkbox/index.js.map +1 -1
  37. package/dist/components/checkbox/style.js +1 -1
  38. package/dist/components/checkbox/style.js.map +1 -1
  39. package/dist/components/checkbox-group/index.d.ts +4 -10
  40. package/dist/components/checkbox-group/index.js +74 -60
  41. package/dist/components/checkbox-group/index.js.map +1 -1
  42. package/dist/components/context-menu/index.js +7 -8
  43. package/dist/components/context-menu/index.js.map +1 -1
  44. package/dist/components/dialog/index.d.ts +1 -0
  45. package/dist/components/dialog/index.js +13 -9
  46. package/dist/components/dialog/index.js.map +1 -1
  47. package/dist/components/dialog/style.js +1 -1
  48. package/dist/components/dialog/style.js.map +1 -1
  49. package/dist/components/drawer/index.d.ts +15 -0
  50. package/dist/components/drawer/index.js +58 -34
  51. package/dist/components/drawer/index.js.map +1 -1
  52. package/dist/components/drawer/style.js +1 -1
  53. package/dist/components/drawer/style.js.map +1 -1
  54. package/dist/components/dropdown/index.js +1 -1
  55. package/dist/components/dropdown-divider/index.js +1 -1
  56. package/dist/components/dropdown-header/index.js +1 -1
  57. package/dist/components/dropdown-header/style.js +1 -1
  58. package/dist/components/dropdown-header/style.js.map +1 -1
  59. package/dist/components/dropdown-item/index.js +3 -2
  60. package/dist/components/dropdown-item/index.js.map +1 -1
  61. package/dist/components/empty/index.js +1 -1
  62. package/dist/components/empty/style.js +1 -1
  63. package/dist/components/empty/style.js.map +1 -1
  64. package/dist/components/icon/index.js +1 -1
  65. package/dist/components/index.d.ts +1 -1
  66. package/dist/components/index.js +9 -9
  67. package/dist/components/input/index.d.ts +2 -3
  68. package/dist/components/input/index.js +62 -52
  69. package/dist/components/input/index.js.map +1 -1
  70. package/dist/components/input/style.js +1 -1
  71. package/dist/components/input/style.js.map +1 -1
  72. package/dist/components/input-number/index.d.ts +2 -3
  73. package/dist/components/input-number/index.js +58 -38
  74. package/dist/components/input-number/index.js.map +1 -1
  75. package/dist/components/input-number/style.js +1 -1
  76. package/dist/components/input-number/style.js.map +1 -1
  77. package/dist/components/layout/index.d.ts +53 -3
  78. package/dist/components/layout/index.js +146 -39
  79. package/dist/components/layout/index.js.map +1 -1
  80. package/dist/components/layout/style.js +1 -1
  81. package/dist/components/layout/style.js.map +1 -1
  82. package/dist/components/option/index.js +1 -1
  83. package/dist/components/option/style.js +1 -1
  84. package/dist/components/option/style.js.map +1 -1
  85. package/dist/components/popover/index.js +7 -5
  86. package/dist/components/popover/index.js.map +1 -1
  87. package/dist/components/popover/style.js +1 -1
  88. package/dist/components/popover/style.js.map +1 -1
  89. package/dist/components/radio/index.d.ts +4 -7
  90. package/dist/components/radio/index.js +48 -37
  91. package/dist/components/radio/index.js.map +1 -1
  92. package/dist/components/radio/style.js +1 -1
  93. package/dist/components/radio/style.js.map +1 -1
  94. package/dist/components/radio-group/index.d.ts +4 -10
  95. package/dist/components/radio-group/index.js +70 -52
  96. package/dist/components/radio-group/index.js.map +1 -1
  97. package/dist/components/segmented/index.d.ts +6 -11
  98. package/dist/components/segmented/index.js +67 -55
  99. package/dist/components/segmented/index.js.map +1 -1
  100. package/dist/components/segmented/style.js +1 -1
  101. package/dist/components/segmented/style.js.map +1 -1
  102. package/dist/components/segmented-trigger/index.d.ts +1 -2
  103. package/dist/components/segmented-trigger/index.js +18 -19
  104. package/dist/components/segmented-trigger/index.js.map +1 -1
  105. package/dist/components/segmented-trigger/style.js +1 -1
  106. package/dist/components/segmented-trigger/style.js.map +1 -1
  107. package/dist/components/select/index.d.ts +13 -8
  108. package/dist/components/select/index.js +110 -75
  109. package/dist/components/select/index.js.map +1 -1
  110. package/dist/components/select/style.js +1 -1
  111. package/dist/components/select/style.js.map +1 -1
  112. package/dist/components/slider/index.d.ts +3 -5
  113. package/dist/components/slider/index.js +59 -42
  114. package/dist/components/slider/index.js.map +1 -1
  115. package/dist/components/slider/style.js +1 -1
  116. package/dist/components/slider/style.js.map +1 -1
  117. package/dist/components/spinner/index.d.ts +0 -2
  118. package/dist/components/spinner/index.js +14 -13
  119. package/dist/components/spinner/index.js.map +1 -1
  120. package/dist/components/spinner/style.js +1 -1
  121. package/dist/components/spinner/style.js.map +1 -1
  122. package/dist/components/svg-draw-lines/index.js +1 -1
  123. package/dist/components/switch/index.d.ts +5 -6
  124. package/dist/components/switch/index.js +51 -37
  125. package/dist/components/switch/index.js.map +1 -1
  126. package/dist/components/switch/style.js +1 -1
  127. package/dist/components/switch/style.js.map +1 -1
  128. package/dist/components/textarea/index.d.ts +5 -6
  129. package/dist/components/textarea/index.js +73 -63
  130. package/dist/components/textarea/index.js.map +1 -1
  131. package/dist/components/textarea/style.js +1 -1
  132. package/dist/components/textarea/style.js.map +1 -1
  133. package/dist/components/theme/index.js +1 -1
  134. package/dist/components/theme/style.js +1 -1
  135. package/dist/components/theme/style.js.map +1 -1
  136. package/dist/components/toast/style.js +1 -1
  137. package/dist/components/toast/style.js.map +1 -1
  138. package/dist/components/toast/toast.js +12 -12
  139. package/dist/components/toast/toast.js.map +1 -1
  140. package/dist/components/tooltip/index.js +1 -1
  141. package/dist/components/tooltip/style.js +1 -1
  142. package/dist/components/tooltip/style.js.map +1 -1
  143. package/dist/icons/generated/lucide-clapperboard.d.ts +6 -0
  144. package/dist/icons/generated/lucide-clapperboard.js +10 -0
  145. package/dist/icons/generated/lucide-clapperboard.js.map +1 -0
  146. package/dist/icons/generated/lucide-external-link.d.ts +6 -0
  147. package/dist/icons/generated/lucide-external-link.js +10 -0
  148. package/dist/icons/generated/lucide-external-link.js.map +1 -0
  149. package/dist/icons/generated/lucide-eye.d.ts +6 -0
  150. package/dist/icons/generated/lucide-eye.js +10 -0
  151. package/dist/icons/generated/lucide-eye.js.map +1 -0
  152. package/dist/icons/generated/lucide-file-text.d.ts +6 -0
  153. package/dist/icons/generated/lucide-file-text.js +10 -0
  154. package/dist/icons/generated/lucide-file-text.js.map +1 -0
  155. package/dist/icons/generated/lucide-film.d.ts +6 -0
  156. package/dist/icons/generated/lucide-film.js +10 -0
  157. package/dist/icons/generated/lucide-film.js.map +1 -0
  158. package/dist/icons/generated/lucide-folder-open.d.ts +6 -0
  159. package/dist/icons/generated/lucide-folder-open.js +10 -0
  160. package/dist/icons/generated/lucide-folder-open.js.map +1 -0
  161. package/dist/icons/generated/lucide-headphones.d.ts +6 -0
  162. package/dist/icons/generated/lucide-headphones.js +10 -0
  163. package/dist/icons/generated/lucide-headphones.js.map +1 -0
  164. package/dist/icons/generated/lucide-layout-grid.d.ts +6 -0
  165. package/dist/icons/generated/lucide-layout-grid.js +10 -0
  166. package/dist/icons/generated/lucide-layout-grid.js.map +1 -0
  167. package/dist/icons/generated/lucide-link.d.ts +6 -0
  168. package/dist/icons/generated/lucide-link.js +10 -0
  169. package/dist/icons/generated/lucide-link.js.map +1 -0
  170. package/dist/icons/generated/lucide-music.d.ts +6 -0
  171. package/dist/icons/generated/lucide-music.js +10 -0
  172. package/dist/icons/generated/lucide-music.js.map +1 -0
  173. package/dist/icons/generated/lucide-package.d.ts +6 -0
  174. package/dist/icons/generated/lucide-package.js +10 -0
  175. package/dist/icons/generated/lucide-package.js.map +1 -0
  176. package/dist/icons/generated/lucide-pen-line.d.ts +6 -0
  177. package/dist/icons/generated/lucide-pen-line.js +10 -0
  178. package/dist/icons/generated/lucide-pen-line.js.map +1 -0
  179. package/dist/icons/generated/lucide-pencil.d.ts +6 -0
  180. package/dist/icons/generated/lucide-pencil.js +10 -0
  181. package/dist/icons/generated/lucide-pencil.js.map +1 -0
  182. package/dist/icons/generated/lucide-play.d.ts +6 -0
  183. package/dist/icons/generated/lucide-play.js +10 -0
  184. package/dist/icons/generated/lucide-play.js.map +1 -0
  185. package/dist/icons/generated/lucide-refresh-cw.d.ts +6 -0
  186. package/dist/icons/generated/lucide-refresh-cw.js +10 -0
  187. package/dist/icons/generated/lucide-refresh-cw.js.map +1 -0
  188. package/dist/icons/generated/lucide-sliders-horizontal.d.ts +6 -0
  189. package/dist/icons/generated/lucide-sliders-horizontal.js +10 -0
  190. package/dist/icons/generated/lucide-sliders-horizontal.js.map +1 -0
  191. package/dist/icons/generated/lucide-tags.d.ts +6 -0
  192. package/dist/icons/generated/lucide-tags.js +10 -0
  193. package/dist/icons/generated/lucide-tags.js.map +1 -0
  194. package/dist/icons/generated/lucide-wrench.d.ts +6 -0
  195. package/dist/icons/generated/lucide-wrench.js +10 -0
  196. package/dist/icons/generated/lucide-wrench.js.map +1 -0
  197. package/dist/icons/index.d.ts +18 -0
  198. package/dist/icons/index.js +19 -1
  199. package/dist/node_modules/.pnpm/@floating-ui_core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -3
  200. package/dist/node_modules/.pnpm/@floating-ui_core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -1
  201. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +2 -1
  202. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -1
  203. package/dist/shared/events/user-change.js.map +1 -1
  204. package/dist/shared/form-association/index.js +41 -0
  205. package/dist/shared/form-association/index.js.map +1 -0
  206. package/dist/shared/group-management/index.js +109 -0
  207. package/dist/shared/group-management/index.js.map +1 -0
  208. package/dist/shared/menu-portal/menu-tree.js +20 -7
  209. package/dist/shared/menu-portal/menu-tree.js.map +1 -1
  210. package/dist/shared/option-portal/index.js +65 -0
  211. package/dist/shared/option-portal/index.js.map +1 -0
  212. package/dist/shared/overlay/overlay.js +1 -1
  213. package/dist/shared/overlay/overlay.js.map +1 -1
  214. package/dist/shared/overlay/portal.js +9 -6
  215. package/dist/shared/overlay/portal.js.map +1 -1
  216. package/dist/shared/overlay/presence.js.map +1 -1
  217. package/dist/shared/visible-area/index.js +69 -0
  218. package/dist/shared/visible-area/index.js.map +1 -0
  219. package/dist/types/utils.d.ts +6 -1
  220. package/package.json +7 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/switch/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\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideLoaderCircle } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-switch')\nexport class WebUiSwitch extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n static formAssociated = true\n\n private _internals?: ElementInternals\n @state() private _formDisabled = false\n\n @state() private _checked = false\n\n get checked(): boolean {\n return this._checked\n }\n\n set checked(v: boolean) {\n const old = this._checked\n this._checked = v\n this._syncFormValue()\n this.requestUpdate('checked', old)\n }\n\n @property({ type: String, reflect: true }) name = ''\n @property({ type: String }) value = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) loading = false\n @state() private pressed = false\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (this._internals) return\n this._internals = this.attachInternals()\n if (this.hasAttribute('checked')) {\n this._checked = true\n }\n this._syncFormValue()\n }\n\n formResetCallback() {\n this.checked = this.hasAttribute('checked')\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n override updated() {\n this._syncFormValue()\n if (!this._internals || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this._checked) this._internals.setValidity({})\n else this._internals.setValidity({ valueMissing: true }, '请启用此项')\n }\n\n private _syncFormValue() {\n this._internals?.setFormValue?.(this._checked ? this.value || 'on' : null)\n }\n\n // 用户点击切换开关状态,阻止 label 默认行为避免原生 checkbox 重复触发\n private handleClick(e: Event) {\n e.preventDefault()\n if (this._isDisabled || this.loading) return\n const old = this._checked\n this._checked = !old\n this._syncFormValue()\n this.requestUpdate('checked', old)\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handlePointerDown() {\n if (this._isDisabled || this.loading) return\n this.pressed = true\n }\n\n private handlePointerUp() {\n this.pressed = false\n }\n\n private handlePointerLeave() {\n this.pressed = false\n }\n\n override render() {\n const trackCls = {\n 'wui-switch-track': true,\n 'is-open': this._checked,\n 'is-disabled': this._isDisabled || this.loading\n }\n const thumbCls = {\n 'wui-switch-thumb': true,\n 'wui-glass': this.pressed,\n 'is-pressed': this.pressed\n }\n\n return html`\n <label\n class=${classMap(trackCls)}\n role=\"switch\"\n aria-checked=${String(this._checked)}\n @click=${this.handleClick}\n @pointerdown=${this.handlePointerDown}\n @pointerup=${this.handlePointerUp}\n @pointercancel=${this.handlePointerUp}\n @pointerleave=${this.handlePointerLeave}\n >\n <input\n type=\"checkbox\"\n .checked=${this._checked}\n ?disabled=${this._isDisabled || this.loading}\n class=\"sr-only\"\n />\n <div class=${classMap(thumbCls)}>\n ${this.loading\n ? html`<div class=\"wui-switch-loading\">\n <web-ui-icon .icon=${lucideLoaderCircle} size=\"14\" color=\"#08f\" spin></web-ui-icon>\n </div>`\n : ''}\n </div>\n </label>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-switch': WebUiSwitch\n }\n}\n"],"mappings":";;;;;;;;;AAWO,IAAM,IAAN,cAA0B,EAAW;;EAyBf,aApBM,KAAA,gBAAA,IAEL,KAAA,WAAA,IAasB,KAAA,OAAA,IACd,KAAA,QAAA,IACmB,KAAA,WAAA,IACA,KAAA,WAAA,IACD,KAAA,UAAA,IAC3B,KAAA,UAAA;;;EAxBF,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;;EACpC,KAAA,iBAAA;;CAOxB,IAAI,UAAmB;EACrB,OAAO,KAAK;CACd;CAEA,IAAI,QAAQ,GAAY;EACtB,IAAM,IAAM,KAAK;EAGjB,AAFA,KAAK,WAAW,GAChB,KAAK,eAAe,GACpB,KAAK,cAAc,WAAW,CAAG;CACnC;CASA,IAAY,cAAuB;EACjC,OAAO,KAAK,YAAY,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I;;gBAEC,EAAS,CAAQ,EAAE;;uBAEZ,OAAO,KAAK,QAAQ,EAAE;iBAC5B,KAAK,YAAY;uBACX,KAAK,kBAAkB;qBACzB,KAAK,gBAAgB;yBACjB,KAAK,gBAAgB;wBACtB,KAAK,mBAAmB;;;;qBAI3B,KAAK,SAAS;sBACb,KAAK,eAAe,KAAK,QAAQ;;;qBAGlC,EAAS,CAAQ,EAAE;YAC5B,KAAK,UACH,CAAI;qCACmB,EAAmB;wBAE1C,GAAG;;;;CAIf;AAMF;AA5HG,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GAEN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAaN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GACzB,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,WAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GA1BR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/switch/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\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideLoaderCircle } from '@/icons'\nimport { defineFormAssociation, FormAssociationController } from '@/shared/form-association'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-switch')\nexport class WebUiSwitch extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n static formAssociated = true\n\n @state() private _checked = false\n\n get checked(): boolean {\n return this._checked\n }\n\n set checked(v: boolean) {\n const old = this._checked\n this._checked = v\n this._formAssociation.sync()\n this.requestUpdate('checked', old)\n }\n\n @property({ type: String, reflect: true }) name = ''\n @property({ type: String }) value = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) loading = false\n @state() private _pressed = false\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n private readonly _formAssociation = defineFormAssociation<boolean>({\n host: this,\n initialize: () => {\n if (this.hasAttribute('checked')) this._checked = true\n },\n getState: () => this._checked,\n setState: checked => {\n this.checked = checked\n },\n getFormValue: () => (this._checked ? this.value || 'on' : null),\n getFormState: () => String(this._checked),\n restoreState: state => {\n if (typeof state === 'string') this.checked = state === 'true'\n },\n syncValidity: () => this._syncValidity()\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n formResetCallback() {\n this._formAssociation.reset()\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formAssociation.setDisabled(disabled)\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this._formAssociation.restore(state)\n }\n\n private _syncValidity() {\n const internals = this._formAssociation.getInternals()\n if (!internals || typeof internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this._checked) internals.setValidity({})\n else internals.setValidity({ valueMissing: true }, '请启用此项')\n }\n\n // 用户点击切换开关状态,阻止 label 默认行为避免原生 checkbox 重复触发\n private handleClick(e: Event) {\n e.preventDefault()\n if (this._isDisabled || this.loading) return\n const old = this._checked\n this._checked = !old\n this._formAssociation.sync()\n this.requestUpdate('checked', old)\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handlePointerDown() {\n if (this._isDisabled || this.loading) return\n this._pressed = true\n }\n\n private handlePointerUp() {\n this._pressed = false\n }\n\n private handlePointerLeave() {\n this._pressed = false\n }\n\n override render() {\n const trackCls = {\n 'wui-switch-track': true,\n 'is-open': this._checked,\n 'is-disabled': this._isDisabled || this.loading\n }\n const thumbCls = {\n 'wui-switch-thumb': true,\n 'wui-glass': this._pressed,\n 'is-pressed': this._pressed\n }\n\n return html`\n <label\n class=${classMap(trackCls)}\n role=\"switch\"\n aria-checked=${String(this._checked)}\n @click=${this.handleClick}\n @pointerdown=${this.handlePointerDown}\n @pointerup=${this.handlePointerUp}\n @pointercancel=${this.handlePointerUp}\n @pointerleave=${this.handlePointerLeave}\n >\n <input\n type=\"checkbox\"\n .checked=${this._checked}\n ?disabled=${this._isDisabled || this.loading}\n class=\"sr-only\"\n />\n <div class=${classMap(thumbCls)}>\n ${\n this.loading\n ? html`<div class=\"wui-switch-loading\">\n <web-ui-icon .icon=${lucideLoaderCircle} size=\"14\" color=\"#08f\" spin></web-ui-icon>\n </div>`\n : ''\n }\n </div>\n </label>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-switch': WebUiSwitch\n }\n}\n"],"mappings":";;;;;;;;;;AAYO,IAAM,IAAN,cAA0B,EAAW;;EA6CI,aAzClB,KAAA,WAAA,IAasB,KAAA,OAAA,IACd,KAAA,QAAA,IACmB,KAAA,WAAA,IACA,KAAA,WAAA,IACD,KAAA,UAAA,IAC1B,KAAA,WAAA,IAMQ,KAAA,mBAAA,EAA+B;GACjE,MAAM;GACN,kBAAkB;IAChB,AAAI,KAAK,aAAa,SAAS,MAAG,KAAK,WAAW;GACpD;GACA,gBAAgB,KAA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GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAvBR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
@@ -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;width:48px;height:24px;transition:background-color var(--wui-duration-trigger,.16s) ease;border-radius:2147483647px;outline:3px solid #0000;justify-content:space-between;align-items:center;display:flex;position:relative}.wui-switch-track:focus-within{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,80ms) cubic-bezier(.4, 0, .2, 1), transform var(--wui-duration-trigger,.16s) cubic-bezier(.4, 0, .2, 1), border-radius var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) 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}";
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-track,#e5e5ea);outline:var(--wui-focus-ring-width,3px) solid transparent;outline-offset:2px;width:48px;height:24px;transition:background-color var(--wui-duration-trigger,.16s) ease;border-radius:2147483647px;justify-content:space-between;align-items:center;display:flex;position:relative}.wui-switch-track:focus-within{outline-color:var(--wui-color-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,80ms) cubic-bezier(.4, 0, .2, 1), transform var(--wui-duration-trigger,.16s) cubic-bezier(.4, 0, .2, 1), border-radius var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) 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 var(--wui-duration-trigger, 160ms) ease;\n\n /* 实际获得焦点的是内部 sr-only 的 checkbox,track 本身不可聚焦;\n :focus-visible 在 track 上永不匹配,需用 :focus-within 让键盘焦点环生效 */\n &:focus-within {\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, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n transform var(--wui-duration-trigger, 160ms) cubic-bezier(0.4, 0, 0.2, 1),\n border-radius var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) 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-track, #e5e5ea);\n outline: var(--wui-focus-ring-width, 3px) solid transparent;\n outline-offset: 2px;\n\n transition: background-color var(--wui-duration-trigger, 160ms) ease;\n\n /* 实际获得焦点的是内部 sr-only 的 checkbox,track 本身不可聚焦;\n :focus-visible 在 track 上永不匹配,需用 :focus-within 让键盘焦点环生效 */\n &:focus-within {\n outline-color: var(--wui-color-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, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n transform var(--wui-duration-trigger, 160ms) cubic-bezier(0.4, 0, 0.2, 1),\n border-radius var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) 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":""}
@@ -19,22 +19,21 @@ export declare class WebUiTextarea extends LitElement {
19
19
  ariaLabelledby: string | undefined;
20
20
  private _value;
21
21
  private _focused;
22
- private _formDisabled;
23
22
  private _hasPrefix;
24
23
  private _hasSuffix;
25
24
  private _textarea;
26
25
  private _resizeObserver;
27
- private _internals?;
28
26
  get value(): string;
29
27
  set value(v: string);
30
28
  private get _isDisabled();
31
- connectedCallback(): void;
29
+ private readonly _formAssociation;
30
+ private readonly _formAssociationController;
31
+ formResetCallback(): void;
32
+ formDisabledCallback(disabled: boolean): void;
33
+ formStateRestoreCallback(state: string | File | FormData | null): void;
32
34
  disconnectedCallback(): void;
33
35
  firstUpdated(): void;
34
36
  updated(changed: Map<string, unknown>): void;
35
- formDisabledCallback(disabled: boolean): void;
36
- formResetCallback(): void;
37
- formStateRestoreCallback(state: string | File | FormData | null): void;
38
37
  private _getTextarea;
39
38
  private _syncValidity;
40
39
  private _setupAutosize;
@@ -1,37 +1,56 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
2
2
  import "../icon/index.js";
3
3
  import t from "../../icons/generated/jam-close-circle-f.js";
4
4
  import n from "../../assets/glass.js";
5
+ import { FormAssociationController as r, defineFormAssociation as i } from "../../shared/form-association/index.js";
5
6
  import "../button/index.js";
6
- import r from "./style.js";
7
- import { LitElement as i, html as a, nothing as o, unsafeCSS as s } from "lit";
8
- import { customElement as c, property as l, state as u } from "lit/decorators.js";
9
- import { ifDefined as d } from "lit/directives/if-defined.js";
10
- import { classMap as f } from "lit/directives/class-map.js";
11
- import { styleMap as p } from "lit/directives/style-map.js";
7
+ import a from "./style.js";
8
+ import { LitElement as o, html as s, nothing as c, unsafeCSS as l } from "lit";
9
+ import { customElement as u, property as d, state as f } from "lit/decorators.js";
10
+ import { ifDefined as p } from "lit/directives/if-defined.js";
11
+ import { classMap as m } from "lit/directives/class-map.js";
12
+ import { styleMap as h } from "lit/directives/style-map.js";
12
13
  //#region src/components/textarea/index.ts
13
- var m = class extends i {
14
+ var g = class extends o {
14
15
  constructor(...e) {
15
- super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.full = !1, this.clearable = !1, this.borderless = !1, this.rows = 3, this.autosize = !1, this.maxHeight = 0, this.ariaLabel = null, this._value = "", this._focused = !1, this._formDisabled = !1, this._hasPrefix = !1, this._hasSuffix = !1, this._textarea = null, this._resizeObserver = null;
16
+ super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.full = !1, this.clearable = !1, this.borderless = !1, this.rows = 3, this.autosize = !1, this.maxHeight = 0, this.ariaLabel = null, this._value = "", this._focused = !1, this._hasPrefix = !1, this._hasSuffix = !1, this._textarea = null, this._resizeObserver = null, this._formAssociation = i({
17
+ host: this,
18
+ getState: () => this._value,
19
+ setState: (e) => {
20
+ this.value = e;
21
+ },
22
+ getFormValue: () => this._value,
23
+ getFormState: () => this._value,
24
+ restoreState: (e) => {
25
+ typeof e == "string" && (this.value = e);
26
+ },
27
+ syncValidity: () => this._syncValidity()
28
+ }).make(), this._formAssociationController = new r(this, this._formAssociation);
16
29
  }
17
30
  static {
18
31
  this.formAssociated = !0;
19
32
  }
20
33
  static {
21
- this.styles = [s(n), s(r)];
34
+ this.styles = [l(n), l(a)];
22
35
  }
23
36
  get value() {
24
37
  return this._value;
25
38
  }
26
39
  set value(e) {
27
40
  let t = this._value;
28
- this._value = e, this._internals?.setFormValue?.(e), this.requestUpdate("value", t);
41
+ this._value = e, this._formAssociation.sync(), this.requestUpdate("value", t);
29
42
  }
30
43
  get _isDisabled() {
31
- return this.disabled || this._formDisabled;
44
+ return this.disabled || this._formAssociation.isFormDisabled();
32
45
  }
33
- connectedCallback() {
34
- super.connectedCallback(), this._internals ||= this.attachInternals(), this._internals.setFormValue?.(this._value);
46
+ formResetCallback() {
47
+ this._formAssociation.reset();
48
+ }
49
+ formDisabledCallback(e) {
50
+ this._formAssociation.setDisabled(e);
51
+ }
52
+ formStateRestoreCallback(e) {
53
+ this._formAssociation.restore(e);
35
54
  }
36
55
  disconnectedCallback() {
37
56
  super.disconnectedCallback(), this._teardownAutosize();
@@ -46,20 +65,11 @@ var m = class extends i {
46
65
  }
47
66
  e.has("autosize") && (this.autosize ? this._setupAutosize() : this._teardownAutosize(!0)), this._syncValidity(), this.toggleAttribute("focused", this._focused);
48
67
  }
49
- formDisabledCallback(e) {
50
- this._formDisabled = e;
51
- }
52
- formResetCallback() {
53
- this.value = this.getAttribute("value") || "";
54
- }
55
- formStateRestoreCallback(e) {
56
- typeof e == "string" && (this.value = e);
57
- }
58
68
  _getTextarea() {
59
69
  return this._textarea ??= this.shadowRoot?.querySelector("textarea") ?? null, this._textarea;
60
70
  }
61
71
  _syncValidity() {
62
- let e = this._internals, t = this._getTextarea();
72
+ let e = this._formAssociation.getInternals(), t = this._getTextarea();
63
73
  if (!e || !t || typeof e.setValidity != "function") return;
64
74
  if (this._isDisabled || t.validity.valid) {
65
75
  e.setValidity({});
@@ -87,7 +97,7 @@ var m = class extends i {
87
97
  this._textarea.style.height = `${n}px`;
88
98
  }
89
99
  handleInput(e) {
90
- e.target instanceof HTMLTextAreaElement && (this._value = e.target.value, this._internals?.setFormValue?.(this._value), this._syncValidity(), this._autosize());
100
+ e.target instanceof HTMLTextAreaElement && (this._value = e.target.value, this._formAssociation.sync(), this._syncValidity(), this._autosize());
91
101
  }
92
102
  handleFocus() {
93
103
  this._isDisabled || (this._focused = !0);
@@ -96,7 +106,7 @@ var m = class extends i {
96
106
  this._focused = !1;
97
107
  }
98
108
  handleNativeChange(e) {
99
- e.target instanceof HTMLTextAreaElement && (this._value = e.target.value, this._internals?.setFormValue?.(this._value), this._syncValidity(), this.dispatchEvent(new Event("change", {
109
+ e.target instanceof HTMLTextAreaElement && (this._value = e.target.value, this._formAssociation.sync(), this._syncValidity(), this.dispatchEvent(new Event("change", {
100
110
  bubbles: !0,
101
111
  composed: !0
102
112
  })));
@@ -119,7 +129,7 @@ var m = class extends i {
119
129
  t.name === "prefix" && (this._hasPrefix = n), t.name === "suffix" && (this._hasSuffix = n);
120
130
  }
121
131
  handleClear() {
122
- this._isDisabled || this.readonly || (this._value = "", this._internals?.setFormValue?.(""), this.dispatchEvent(new Event("input", {
132
+ this._isDisabled || this.readonly || (this._value = "", this._formAssociation.sync(), this.dispatchEvent(new Event("input", {
123
133
  bubbles: !0,
124
134
  composed: !0
125
135
  })));
@@ -129,93 +139,93 @@ var m = class extends i {
129
139
  }
130
140
  render() {
131
141
  let e = this.clearable && this._value && !this.readonly;
132
- return a`
142
+ return s`
133
143
  <div class="wui-glass wui-textarea-inner" @click=${this.focusTextarea}>
134
- <slot name="prefix" class=${f({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>
144
+ <slot name="prefix" class=${m({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>
135
145
  <textarea
136
146
  placeholder=${this.placeholder}
137
147
  name=${this.name}
138
- aria-label=${d(this.ariaLabel)}
139
- aria-labelledby=${d(this.ariaLabelledby)}
148
+ aria-label=${p(this.ariaLabel)}
149
+ aria-labelledby=${p(this.ariaLabelledby)}
140
150
  .rows=${this.rows}
141
- minlength=${d(this.minlength)}
142
- maxlength=${d(this.maxlength)}
151
+ minlength=${p(this.minlength)}
152
+ maxlength=${p(this.maxlength)}
143
153
  ?disabled=${this._isDisabled}
144
154
  ?readonly=${this.readonly}
145
155
  ?required=${this.required}
146
156
  .value=${this._value}
147
- style=${this.maxHeight > 0 ? p({ "max-height": `${this.maxHeight}px` }) : o}
157
+ style=${this.maxHeight > 0 ? h({ "max-height": `${this.maxHeight}px` }) : c}
148
158
  @input=${this.handleInput}
149
159
  @change=${this.handleNativeChange}
150
160
  @focus=${this.handleFocus}
151
161
  @blur=${this.handleBlur}
152
162
  ></textarea>
153
- ${e ? a`<web-ui-button
154
- icon
155
- variant="ghost"
156
- size="24"
157
- aria-label="清除"
158
- @pointerdown=${this.preventMouseDownBlur}
159
- @click=${this.handleClear}
160
- >
161
- <web-ui-icon .icon=${t}></web-ui-icon>
162
- </web-ui-button>` : ""}
163
- <slot name="suffix" class=${f({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>
163
+ ${e ? s`<web-ui-button
164
+ icon
165
+ variant="ghost"
166
+ size="24"
167
+ aria-label="清除"
168
+ @pointerdown=${this.preventMouseDownBlur}
169
+ @click=${this.handleClear}
170
+ >
171
+ <web-ui-icon .icon=${t}></web-ui-icon>
172
+ </web-ui-button>` : ""}
173
+ <slot name="suffix" class=${m({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>
164
174
  </div>
165
175
  `;
166
176
  }
167
177
  };
168
- e([l({
178
+ e([d({
169
179
  type: String,
170
180
  reflect: !0
171
- })], m.prototype, "placeholder", void 0), e([l({
181
+ })], g.prototype, "placeholder", void 0), e([d({
172
182
  type: String,
173
183
  reflect: !0
174
- })], m.prototype, "name", void 0), e([l({
184
+ })], g.prototype, "name", void 0), e([d({
175
185
  type: Boolean,
176
186
  reflect: !0
177
- })], m.prototype, "disabled", void 0), e([l({
187
+ })], g.prototype, "disabled", void 0), e([d({
178
188
  type: Boolean,
179
189
  reflect: !0
180
- })], m.prototype, "readonly", void 0), e([l({
190
+ })], g.prototype, "readonly", void 0), e([d({
181
191
  type: Boolean,
182
192
  reflect: !0
183
- })], m.prototype, "required", void 0), e([l({
193
+ })], g.prototype, "required", void 0), e([d({
184
194
  type: Boolean,
185
195
  reflect: !0
186
- })], m.prototype, "full", void 0), e([l({
196
+ })], g.prototype, "full", void 0), e([d({
187
197
  type: Boolean,
188
198
  reflect: !0
189
- })], m.prototype, "clearable", void 0), e([l({
199
+ })], g.prototype, "clearable", void 0), e([d({
190
200
  type: Boolean,
191
201
  reflect: !0
192
- })], m.prototype, "borderless", void 0), e([l({
202
+ })], g.prototype, "borderless", void 0), e([d({
193
203
  type: Number,
194
204
  reflect: !0
195
- })], m.prototype, "rows", void 0), e([l({
205
+ })], g.prototype, "rows", void 0), e([d({
196
206
  type: Number,
197
207
  reflect: !0
198
- })], m.prototype, "minlength", void 0), e([l({
208
+ })], g.prototype, "minlength", void 0), e([d({
199
209
  type: Number,
200
210
  reflect: !0
201
- })], m.prototype, "maxlength", void 0), e([l({
211
+ })], g.prototype, "maxlength", void 0), e([d({
202
212
  type: Boolean,
203
213
  reflect: !0
204
- })], m.prototype, "autosize", void 0), e([l({
214
+ })], g.prototype, "autosize", void 0), e([d({
205
215
  type: Number,
206
216
  reflect: !0,
207
217
  attribute: "max-height"
208
- })], m.prototype, "maxHeight", void 0), e([l({
218
+ })], g.prototype, "maxHeight", void 0), e([d({
209
219
  type: String,
210
220
  attribute: "aria-label"
211
- })], m.prototype, "ariaLabel", void 0), e([l({
221
+ })], g.prototype, "ariaLabel", void 0), e([d({
212
222
  type: String,
213
223
  attribute: "aria-labelledby"
214
- })], m.prototype, "ariaLabelledby", void 0), e([u()], m.prototype, "_value", void 0), e([u()], m.prototype, "_focused", void 0), e([u()], m.prototype, "_formDisabled", void 0), e([u()], m.prototype, "_hasPrefix", void 0), e([u()], m.prototype, "_hasSuffix", void 0), e([l({
224
+ })], g.prototype, "ariaLabelledby", void 0), e([f()], g.prototype, "_value", void 0), e([f()], g.prototype, "_focused", void 0), e([f()], g.prototype, "_hasPrefix", void 0), e([f()], g.prototype, "_hasSuffix", void 0), e([d({
215
225
  type: String,
216
226
  reflect: !0
217
- })], m.prototype, "value", null), m = e([c("web-ui-textarea")], m);
227
+ })], g.prototype, "value", null), g = e([u("web-ui-textarea")], g);
218
228
  //#endregion
219
- export { m as WebUiTextarea };
229
+ export { g as WebUiTextarea };
220
230
 
221
231
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/textarea/index.ts"],"sourcesContent":["import { html, LitElement, nothing, 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'\nimport { styleMap } from 'lit/directives/style-map.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-textarea')\nexport class WebUiTextarea 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: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) clearable = false\n @property({ type: Boolean, reflect: true }) borderless = false\n @property({ type: Number, reflect: true }) rows = 3\n @property({ type: Number, reflect: true }) minlength: number | undefined\n @property({ type: Number, reflect: true }) maxlength: number | undefined\n @property({ type: Boolean, reflect: true }) autosize = false\n // 自动高度上限(px);0 表示不限制,随内容无限增高\n @property({ type: Number, reflect: true, attribute: 'max-height' }) maxHeight = 0\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n @property({ type: String, attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined\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 _textarea: HTMLTextAreaElement | null = null\n private _resizeObserver: ResizeObserver | null = null\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 disconnectedCallback() {\n super.disconnectedCallback()\n this._teardownAutosize()\n }\n\n override firstUpdated() {\n this._textarea = this.shadowRoot?.querySelector('textarea') ?? null\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_value')) {\n const textarea = this._getTextarea()\n if (textarea && textarea.value !== this._value) {\n textarea.value = this._value\n }\n }\n if (changed.has('autosize')) {\n if (this.autosize) {\n this._setupAutosize()\n } else {\n this._teardownAutosize(true)\n }\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = state\n }\n\n private _getTextarea(): HTMLTextAreaElement | null {\n this._textarea ??= this.shadowRoot?.querySelector('textarea') ?? null\n return this._textarea\n }\n\n private _syncValidity() {\n const internals = this._internals\n const textarea = this._getTextarea()\n if (!internals || !textarea || typeof internals.setValidity !== 'function') return\n\n if (this._isDisabled || textarea.validity.valid) {\n internals.setValidity({})\n return\n }\n\n const validity: ValidityStateFlags = {}\n if (textarea.validity.valueMissing) validity.valueMissing = true\n if (textarea.validity.tooShort) validity.tooShort = true\n if (textarea.validity.tooLong) validity.tooLong = true\n internals.setValidity(validity, textarea.validationMessage, textarea)\n }\n\n private _setupAutosize() {\n this._teardownAutosize()\n if (typeof ResizeObserver === 'undefined') {\n this._autosize()\n return\n }\n this._resizeObserver = new ResizeObserver(() => {\n this._autosize()\n })\n if (this._textarea) this._resizeObserver.observe(this._textarea)\n this._autosize()\n }\n\n private _teardownAutosize(resetHeight = false) {\n this._resizeObserver?.disconnect()\n this._resizeObserver = null\n if (resetHeight) this._textarea?.style.removeProperty('height')\n }\n\n private _autosize() {\n if (!this._textarea || !this.autosize) return\n this._textarea.style.height = 'auto'\n const computedMin = this.rows * 20\n const scrollH = this._textarea.scrollHeight\n // 上限由 CSS max-height(maxHeight 属性)钳制,这里只负责随内容增高,默认无限\n const height = Math.max(scrollH, computedMin)\n this._textarea.style.height = `${height}px`\n }\n\n private handleInput(e: Event) {\n if (!(e.target instanceof HTMLTextAreaElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n this._autosize()\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;这里补发 composed 事件,\n // 兑现 $events/README 声明的公共 change 契约。\n private handleNativeChange(e: Event) {\n if (!(e.target instanceof HTMLTextAreaElement)) 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 override focus() {\n this.shadowRoot?.querySelector('textarea')?.focus()\n }\n\n override blur() {\n this.shadowRoot?.querySelector('textarea')?.blur()\n }\n\n select() {\n this.shadowRoot?.querySelector('textarea')?.select()\n }\n\n private focusTextarea() {\n if (this._isDisabled) return\n this.shadowRoot?.querySelector('textarea')?.focus()\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 handleClear() {\n if (this._isDisabled || this.readonly) return\n this._value = ''\n this._internals?.setFormValue?.('')\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private preventMouseDownBlur(e: Event) {\n e.preventDefault()\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-textarea-inner\" @click=${this.focusTextarea}>\n <slot name=\"prefix\" class=${classMap({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>\n <textarea\n placeholder=${this.placeholder}\n name=${this.name}\n aria-label=${ifDefined(this.ariaLabel)}\n aria-labelledby=${ifDefined(this.ariaLabelledby)}\n .rows=${this.rows}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this._value}\n style=${this.maxHeight > 0 ? styleMap({ 'max-height': `${this.maxHeight}px` }) : nothing}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n ></textarea>\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-textarea': WebUiTextarea\n }\n}\n"],"mappings":";;;;;;;;;;;;AAcO,IAAM,IAAN,cAA4B,EAAW;;EA4BK,aAxBQ,KAAA,cAAA,IACP,KAAA,OAAA,I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A,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,GAMN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAhC1C,IAAA,EAAA,CAAA,EAAc,iBAAiB,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/textarea/index.ts"],"sourcesContent":["import { html, LitElement, nothing, 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'\nimport { styleMap } from 'lit/directives/style-map.js'\n\nimport '@/components/icon'\nimport '@/components/button'\nimport glass from '@/assets/glass.css?inline'\nimport { jamCloseCircleF } from '@/icons'\nimport { defineFormAssociation, FormAssociationController } from '@/shared/form-association'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-textarea')\nexport class WebUiTextarea 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: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) clearable = false\n @property({ type: Boolean, reflect: true }) borderless = false\n @property({ type: Number, reflect: true }) rows = 3\n @property({ type: Number, reflect: true }) minlength: number | undefined\n @property({ type: Number, reflect: true }) maxlength: number | undefined\n @property({ type: Boolean, reflect: true }) autosize = false\n // 自动高度上限(px);0 表示不限制,随内容无限增高\n @property({ type: Number, reflect: true, attribute: 'max-height' }) maxHeight = 0\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n @property({ type: String, attribute: 'aria-labelledby' }) ariaLabelledby: string | undefined\n\n @state() private _value = ''\n @state() private _focused = false\n @state() private _hasPrefix = false\n @state() private _hasSuffix = false\n\n private _textarea: HTMLTextAreaElement | null = null\n private _resizeObserver: ResizeObserver | null = null\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._formAssociation.sync()\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n private readonly _formAssociation = defineFormAssociation<string>({\n host: this,\n getState: () => this._value,\n setState: value => {\n this.value = value\n },\n getFormValue: () => this._value,\n getFormState: () => this._value,\n restoreState: state => {\n if (typeof state === 'string') this.value = state\n },\n syncValidity: () => this._syncValidity()\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n formResetCallback() {\n this._formAssociation.reset()\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formAssociation.setDisabled(disabled)\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this._formAssociation.restore(state)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this._teardownAutosize()\n }\n\n override firstUpdated() {\n this._textarea = this.shadowRoot?.querySelector('textarea') ?? null\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_value')) {\n const textarea = this._getTextarea()\n if (textarea && textarea.value !== this._value) {\n textarea.value = this._value\n }\n }\n if (changed.has('autosize')) {\n if (this.autosize) {\n this._setupAutosize()\n } else {\n this._teardownAutosize(true)\n }\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n private _getTextarea(): HTMLTextAreaElement | null {\n this._textarea ??= this.shadowRoot?.querySelector('textarea') ?? null\n return this._textarea\n }\n\n private _syncValidity() {\n const internals = this._formAssociation.getInternals()\n const textarea = this._getTextarea()\n if (!internals || !textarea || typeof internals.setValidity !== 'function') return\n\n if (this._isDisabled || textarea.validity.valid) {\n internals.setValidity({})\n return\n }\n\n const validity: ValidityStateFlags = {}\n if (textarea.validity.valueMissing) validity.valueMissing = true\n if (textarea.validity.tooShort) validity.tooShort = true\n if (textarea.validity.tooLong) validity.tooLong = true\n internals.setValidity(validity, textarea.validationMessage, textarea)\n }\n\n private _setupAutosize() {\n this._teardownAutosize()\n if (typeof ResizeObserver === 'undefined') {\n this._autosize()\n return\n }\n this._resizeObserver = new ResizeObserver(() => {\n this._autosize()\n })\n if (this._textarea) this._resizeObserver.observe(this._textarea)\n this._autosize()\n }\n\n private _teardownAutosize(resetHeight = false) {\n this._resizeObserver?.disconnect()\n this._resizeObserver = null\n if (resetHeight) this._textarea?.style.removeProperty('height')\n }\n\n private _autosize() {\n if (!this._textarea || !this.autosize) return\n this._textarea.style.height = 'auto'\n const computedMin = this.rows * 20\n const scrollH = this._textarea.scrollHeight\n // 上限由 CSS max-height(maxHeight 属性)钳制,这里只负责随内容增高,默认无限\n const height = Math.max(scrollH, computedMin)\n this._textarea.style.height = `${height}px`\n }\n\n private handleInput(e: Event) {\n if (!(e.target instanceof HTMLTextAreaElement)) return\n this._value = e.target.value\n this._formAssociation.sync()\n this._syncValidity()\n this._autosize()\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;这里补发 composed 事件,\n // 兑现 $events/README 声明的公共 change 契约。\n private handleNativeChange(e: Event) {\n if (!(e.target instanceof HTMLTextAreaElement)) return\n this._value = e.target.value\n this._formAssociation.sync()\n this._syncValidity()\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n override focus() {\n this.shadowRoot?.querySelector('textarea')?.focus()\n }\n\n override blur() {\n this.shadowRoot?.querySelector('textarea')?.blur()\n }\n\n select() {\n this.shadowRoot?.querySelector('textarea')?.select()\n }\n\n private focusTextarea() {\n if (this._isDisabled) return\n this.shadowRoot?.querySelector('textarea')?.focus()\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 handleClear() {\n if (this._isDisabled || this.readonly) return\n this._value = ''\n this._formAssociation.sync()\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private preventMouseDownBlur(e: Event) {\n e.preventDefault()\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-textarea-inner\" @click=${this.focusTextarea}>\n <slot name=\"prefix\" class=${classMap({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>\n <textarea\n placeholder=${this.placeholder}\n name=${this.name}\n aria-label=${ifDefined(this.ariaLabel)}\n aria-labelledby=${ifDefined(this.ariaLabelledby)}\n .rows=${this.rows}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this._value}\n style=${this.maxHeight > 0 ? styleMap({ 'max-height': `${this.maxHeight}px` }) : nothing}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n ></textarea>\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 }\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 HTMLElementTagN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CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAClD,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAkB,CAAC,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GAEvD,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,cAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GAKN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GA9B1C,IAAA,EAAA,CAAA,EAAc,iBAAiB,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/textarea/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-textarea-inner{box-sizing:border-box;width:var(--wui-textarea-width,200px);min-width:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:20px;align-items:flex-start;gap:8px;padding:9px 12px;display:flex;position:relative}:host([full]) .wui-textarea-inner{width:100%}:host([borderless]) .wui-textarea-inner{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;background:0 0;border:none;padding:9px 0}:host([focused]) .wui-textarea-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-textarea-inner{box-shadow:none;border-color:#0000}textarea{resize:vertical;box-sizing:border-box;width: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;line-height:1.5;display:block}textarea::placeholder{color:var(--wui-color-text-muted,#6a6a6a)}textarea:disabled{cursor:not-allowed}textarea:read-only{cursor:default}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-textarea-inner web-ui-button[variant=ghost]{--wui-button-color:var(--wui-color-text-muted,#6a6a6a);margin-top:calc((var(--wui-font-size,14px) * 1.5 - 24px) / 2);margin-left:-8px}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{--wui-textarea-clear-color:var(--wui-color-text-tertiary,#1b1b1b59);display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-textarea-inner{box-sizing:border-box;width:var(--wui-textarea-width,200px);min-width:var(--wui-control-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:20px;align-items:flex-start;gap:8px;padding:9px 12px;display:flex;position:relative}:host([full]) .wui-textarea-inner{width:100%}:host([borderless]) .wui-textarea-inner{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;background:0 0;border:none;padding:9px 0}:host([focused]) .wui-textarea-inner{--wui-internal-glass-focus-ring:inset 0 0 0 1px var(--wui-color-accent,#08f), 0 0 0 var(--wui-focus-ring-width,3px) var(--wui-color-focus-ring,#08f6)}:host([borderless][focused]) .wui-textarea-inner{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,#08f6);outline-offset:2px;border-color:#0000}textarea{resize:vertical;box-sizing:border-box;width: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;line-height:1.5;display:block}textarea::placeholder{color:var(--wui-color-text-secondary,#6a6a6a)}textarea:disabled{cursor:not-allowed}textarea:read-only{cursor:default}slot{font-size:var(--wui-font-size,14px);color:var(--wui-color-text-secondary,#6a6a6a);flex-shrink:0;align-items:center;display:flex}slot.empty{display:none}.wui-textarea-inner web-ui-button[variant=ghost]{--wui-button-color:var(--wui-textarea-clear-color);margin-top:calc((var(--wui-font-size,14px) * 1.5 - 24px) / 2);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/textarea/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/* ===== Textarea ===== */\n\n.wui-textarea-inner {\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: flex-start;\n\n box-sizing: border-box;\n width: var(--wui-textarea-width, 200px);\n min-width: var(--wui-button-size, 40px);\n padding: 9px 12px;\n border-radius: 20px;\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([full]) .wui-textarea-inner {\n width: 100%;\n}\n\n/* ===== Borderless ===== */\n\n:host([borderless]) .wui-textarea-inner {\n padding: 9px 0;\n border: none;\n\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n:host([focused]) .wui-textarea-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-textarea-inner {\n border-color: transparent;\n box-shadow: none;\n}\n\ntextarea {\n resize: vertical;\n\n display: block;\n flex: 1;\n\n box-sizing: border-box;\n width: 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 line-height: 1.5;\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 }\n\n &:read-only {\n cursor: default;\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\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-textarea-inner web-ui-button[variant='ghost'] {\n --wui-button-color: var(--wui-color-text-muted, #6a6a6a);\n\n /* 与首行文字垂直居中对齐:容器 align-items: flex-start 使按钮贴内容区顶部(9px 留白处),\n 而首行中心在 9px + 行高半程;要让 24px 按钮(18px 图标居中)的图标中心落在首行中心,\n 需上移 (行高 − 按钮高度) / 2,行高 = font-size × 1.5(与 textarea 的 line-height 一致) */\n margin-top: calc((var(--wui-font-size, 14px) * 1.5 - 24px) / 2);\n margin-left: -8px;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/textarea/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-textarea-clear-color: var(--wui-color-text-tertiary, rgb(27 27 27 / 0.35));\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n/* ===== Textarea ===== */\n\n.wui-textarea-inner {\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: flex-start;\n\n box-sizing: border-box;\n width: var(--wui-textarea-width, 200px);\n min-width: var(--wui-control-size, 40px);\n padding: 9px 12px;\n border-radius: 20px;\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([full]) .wui-textarea-inner {\n width: 100%;\n}\n\n/* ===== Borderless ===== */\n\n:host([borderless]) .wui-textarea-inner {\n padding: 9px 0;\n border: none;\n\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n:host([focused]) .wui-textarea-inner {\n --wui-internal-glass-focus-ring:\n inset 0 0 0 1px var(--wui-color-accent, #08f),\n 0 0 0 var(--wui-focus-ring-width, 3px) var(--wui-color-focus-ring, rgb(0 136 255 / 0.4));\n}\n\n:host([borderless][focused]) .wui-textarea-inner {\n border-color: transparent;\n\n /* borderless 移除了背景和玻璃阴影,但仍必须保留可感知的键盘/输入焦点边界 */\n outline: var(--wui-focus-ring-width, 3px) solid var(--wui-color-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n}\n\ntextarea {\n resize: vertical;\n\n display: block;\n flex: 1;\n\n box-sizing: border-box;\n width: 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 line-height: 1.5;\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-secondary, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &:read-only {\n cursor: default;\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-secondary, #6a6a6a);\n}\n\nslot.empty {\n display: none;\n}\n\n/* ===== Clear button ===== */\n\n/* 复用 web-ui-button icon ghost:仅覆盖颜色为 faint 并对齐首行,保持弱意图清除图标观感;\n 负 margin-left 抵消容器 8px flex gap,让清除按钮紧贴文本域内容 */\n.wui-textarea-inner web-ui-button[variant='ghost'] {\n --wui-button-color: var(--wui-textarea-clear-color);\n\n /* 与首行文字垂直居中对齐:容器 align-items: flex-start 使按钮贴内容区顶部(9px 留白处),\n 而首行中心在 9px + 行高半程;要让 24px 按钮(18px 图标居中)的图标中心落在首行中心,\n 需上移 (行高 − 按钮高度) / 2,行高 = font-size × 1.5(与 textarea 的 line-height 一致) */\n margin-top: calc((var(--wui-font-size, 14px) * 1.5 - 24px) / 2);\n margin-left: -8px;\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
2
2
  import { normalizeLiteral as t } from "../../shared/normalize/index.js";
3
3
  import { applyOverlayRootStyles as n } from "../../shared/theme/overlay-root.js";
4
4
  import r from "./style.js";
@@ -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:80ms;--wui-duration-feedback:.1s;--wui-duration-trigger:.16s;--wui-duration-focus:.2s;--wui-duration-menu-enter:.14s;--wui-duration-menu-exit:.1s;--wui-duration-overlay-enter:.18s;--wui-duration-overlay-exit:.14s;--wui-duration-drawer-enter:.28s;--wui-duration-drawer-exit:.24s;--wui-ease-enter:cubic-bezier(.23, 1, .32, 1);--wui-ease-slide:cubic-bezier(.77, 0, .175, 1);--wui-scale-enter:.97;display:contents}:host([motion=reduced]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-trigger:0s;--wui-duration-focus:0s;--wui-duration-menu-enter:0s;--wui-duration-menu-exit:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer-enter:0s;--wui-duration-drawer-exit:0s;--wui-scale-enter:1}@media (prefers-reduced-motion:reduce){:host([motion=system]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-trigger:0s;--wui-duration-focus:0s;--wui-duration-menu-enter:0s;--wui-duration-menu-exit:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer-enter:0s;--wui-duration-drawer-exit:0s;--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-font-size:14px;--wui-input-width:200px;--wui-control-size:40px;--wui-overlay-min-width:200px;--wui-layer-base:0;--wui-layer-inline-overlay:1;--wui-layer-header:10;--wui-layer-auxiliary:20;--wui-layer-banner:30;--wui-layer-tabbar:40;--wui-layer-sidebar:50;--wui-layer-menu:100;--wui-layer-menu-nested:110;--wui-layer-toast:200;--wui-layer-loading:300;--wui-duration-press:80ms;--wui-duration-feedback:.1s;--wui-duration-trigger:.16s;--wui-duration-focus:.2s;--wui-duration-menu-enter:.14s;--wui-duration-menu-exit:.1s;--wui-duration-overlay-enter:.18s;--wui-duration-overlay-exit:.14s;--wui-duration-drawer-enter:.28s;--wui-duration-drawer-exit:.24s;--wui-duration-layout:.2s;--wui-ease-enter:cubic-bezier(.23, 1, .32, 1);--wui-ease-slide:cubic-bezier(.77, 0, .175, 1);--wui-scale-enter:.97;--wui-focus-ring-width:3px;display:contents}:host([motion=reduced]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-trigger:0s;--wui-duration-focus:0s;--wui-duration-menu-enter:0s;--wui-duration-menu-exit:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer-enter:0s;--wui-duration-drawer-exit:0s;--wui-duration-layout:0s;--wui-scale-enter:1}@media (prefers-reduced-motion:reduce){:host([motion=system]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-trigger:0s;--wui-duration-focus:0s;--wui-duration-menu-enter:0s;--wui-duration-menu-exit:0s;--wui-duration-overlay-enter:0s;--wui-duration-overlay-exit:0s;--wui-duration-drawer-enter:0s;--wui-duration-drawer-exit:0s;--wui-duration-layout:0s;--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-control:#dfdfdf;--wui-color-surface-track:#e5e5ea;--wui-color-surface-glass:#fafafa57;--wui-color-surface-glass-hover:color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));--wui-color-surface-glass-active:color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));--wui-color-surface-overlay:#f6f6f6d1;--wui-color-text:#1b1b1b;--wui-color-text-secondary:#6a6a6a;--wui-color-text-tertiary:color-mix(in srgb, var(--wui-color-text) 35%, transparent);--wui-color-text-disabled:color-mix(in srgb, var(--wui-color-text) 32%, transparent);--wui-color-state-layer-hover:color-mix(in srgb, var(--wui-color-text) 6%, transparent);--wui-color-state-layer-active:color-mix(in srgb, var(--wui-color-text) 15%, transparent);--wui-color-border:#0000001a;--wui-color-glass-border:#3333331f;--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-panel:0 3px 9px #00000045;--wui-shadow-glass:0 0 1px #0000000d, 0 0 8px #00000008, 0 2px 16px #00000006, 0 8px 32px #00000004;--wui-color-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-control:#3a3a3c;--wui-color-surface-track:#444446;--wui-color-surface-glass:#2c2c2e6b;--wui-color-surface-glass-hover:color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));--wui-color-surface-glass-active:color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));--wui-color-surface-overlay:#2c2c2ed1;--wui-color-text:#f5f5f7;--wui-color-text-secondary:#a1a1a6;--wui-color-text-tertiary:color-mix(in srgb, var(--wui-color-text) 42%, transparent);--wui-color-text-disabled:color-mix(in srgb, var(--wui-color-text) 38%, transparent);--wui-color-state-layer-hover:color-mix(in srgb, var(--wui-color-text) 6%, transparent);--wui-color-state-layer-active:color-mix(in srgb, var(--wui-color-text) 15%, transparent);--wui-color-border:#ffffff24;--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-panel:0 4px 16px #00000059;--wui-shadow-glass:0 12px 32px #00000061;--wui-color-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-control:#3a3a3c;--wui-color-surface-track:#444446;--wui-color-surface-glass:#2c2c2e6b;--wui-color-surface-glass-hover:color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));--wui-color-surface-glass-active:color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));--wui-color-surface-overlay:#2c2c2ed1;--wui-color-text:#f5f5f7;--wui-color-text-secondary:#a1a1a6;--wui-color-text-tertiary:color-mix(in srgb, var(--wui-color-text) 42%, transparent);--wui-color-text-disabled:color-mix(in srgb, var(--wui-color-text) 38%, transparent);--wui-color-state-layer-hover:color-mix(in srgb, var(--wui-color-text) 6%, transparent);--wui-color-state-layer-active:color-mix(in srgb, var(--wui-color-text) 15%, transparent);--wui-color-border:#ffffff24;--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-panel:0 4px 16px #00000059;--wui-shadow-glass:0 12px 32px #00000061;--wui-color-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: 80ms;\n --wui-duration-feedback: 100ms;\n --wui-duration-trigger: 160ms;\n --wui-duration-focus: 200ms;\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-enter: 280ms;\n --wui-duration-drawer-exit: 240ms;\n --wui-ease-enter: cubic-bezier(0.23, 1, 0.32, 1);\n --wui-ease-slide: cubic-bezier(0.77, 0, 0.175, 1);\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-trigger: 0ms;\n --wui-duration-focus: 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-enter: 0ms;\n --wui-duration-drawer-exit: 0ms;\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-trigger: 0ms;\n --wui-duration-focus: 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-enter: 0ms;\n --wui-duration-drawer-exit: 0ms;\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-font-size: 14px;\n --wui-input-width: 200px;\n --wui-control-size: 40px;\n --wui-overlay-min-width: 200px;\n\n /* z-index layers - 基础结构 */\n --wui-layer-base: 0;\n --wui-layer-inline-overlay: 1;\n --wui-layer-header: 10;\n --wui-layer-auxiliary: 20;\n --wui-layer-banner: 30;\n --wui-layer-tabbar: 40;\n --wui-layer-sidebar: 50;\n\n /* z-index layers - 浮层 */\n --wui-layer-menu: 100;\n --wui-layer-menu-nested: 110;\n --wui-layer-toast: 200;\n --wui-layer-loading: 300;\n --wui-duration-press: 80ms;\n --wui-duration-feedback: 100ms;\n --wui-duration-trigger: 160ms;\n --wui-duration-focus: 200ms;\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-enter: 280ms;\n --wui-duration-drawer-exit: 240ms;\n --wui-duration-layout: 200ms;\n --wui-ease-enter: cubic-bezier(0.23, 1, 0.32, 1);\n --wui-ease-slide: cubic-bezier(0.77, 0, 0.175, 1);\n --wui-scale-enter: 0.97;\n --wui-focus-ring-width: 3px;\n display: contents;\n}\n\n:host([motion='reduced']) {\n --wui-duration-press: 0ms;\n --wui-duration-feedback: 0ms;\n --wui-duration-trigger: 0ms;\n --wui-duration-focus: 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-enter: 0ms;\n --wui-duration-drawer-exit: 0ms;\n --wui-duration-layout: 0ms;\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-trigger: 0ms;\n --wui-duration-focus: 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-enter: 0ms;\n --wui-duration-drawer-exit: 0ms;\n --wui-duration-layout: 0ms;\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-control: #dfdfdf;\n --wui-color-surface-track: #e5e5ea;\n --wui-color-surface-glass: rgb(250 250 250 / 0.34);\n --wui-color-surface-glass-hover: color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));\n --wui-color-surface-glass-active: color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));\n --wui-color-surface-overlay: rgb(246 246 246 / 0.82);\n --wui-color-text: #1b1b1b;\n --wui-color-text-secondary: #6a6a6a;\n --wui-color-text-tertiary: color-mix(in srgb, var(--wui-color-text) 35%, transparent);\n --wui-color-text-disabled: color-mix(in srgb, var(--wui-color-text) 32%, transparent);\n --wui-color-state-layer-hover: color-mix(in srgb, var(--wui-color-text) 6%, transparent);\n --wui-color-state-layer-active: color-mix(in srgb, var(--wui-color-text) 15%, transparent);\n --wui-color-border: rgb(0 0 0 / 0.1);\n --wui-color-glass-border: rgb(51 51 51 / 0.12);\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-panel: 0 3px 9px rgb(0 0 0 / 0.27);\n --wui-shadow-glass:\n 0 0 1px rgb(0 0 0 / 0.05), 0 0 8px rgb(0 0 0 / 0.03), 0 2px 16px rgb(0 0 0 / 0.025), 0 8px 32px rgb(0 0 0 / 0.015);\n --wui-color-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-control: #3a3a3c;\n --wui-color-surface-track: #444446;\n --wui-color-surface-glass: rgb(44 44 46 / 0.42);\n --wui-color-surface-glass-hover: color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));\n --wui-color-surface-glass-active: color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));\n --wui-color-surface-overlay: rgb(44 44 46 / 0.82);\n --wui-color-text: #f5f5f7;\n --wui-color-text-secondary: #a1a1a6;\n --wui-color-text-tertiary: color-mix(in srgb, var(--wui-color-text) 42%, transparent);\n --wui-color-text-disabled: color-mix(in srgb, var(--wui-color-text) 38%, transparent);\n --wui-color-state-layer-hover: color-mix(in srgb, var(--wui-color-text) 6%, transparent);\n --wui-color-state-layer-active: color-mix(in srgb, var(--wui-color-text) 15%, transparent);\n --wui-color-border: rgb(255 255 255 / 0.14);\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-panel: 0 4px 16px rgb(0 0 0 / 0.35);\n --wui-shadow-glass: 0 12px 32px rgb(0 0 0 / 0.38);\n --wui-color-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-control: #3a3a3c;\n --wui-color-surface-track: #444446;\n --wui-color-surface-glass: rgb(44 44 46 / 0.42);\n --wui-color-surface-glass-hover: color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));\n --wui-color-surface-glass-active: color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));\n --wui-color-surface-overlay: rgb(44 44 46 / 0.82);\n --wui-color-text: #f5f5f7;\n --wui-color-text-secondary: #a1a1a6;\n --wui-color-text-tertiary: color-mix(in srgb, var(--wui-color-text) 42%, transparent);\n --wui-color-text-disabled: color-mix(in srgb, var(--wui-color-text) 38%, transparent);\n --wui-color-state-layer-hover: color-mix(in srgb, var(--wui-color-text) 6%, transparent);\n --wui-color-state-layer-active: color-mix(in srgb, var(--wui-color-text) 15%, transparent);\n --wui-color-border: rgb(255 255 255 / 0.14);\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-panel: 0 4px 16px rgb(0 0 0 / 0.35);\n --wui-shadow-glass: 0 12px 32px rgb(0 0 0 / 0.38);\n --wui-color-focus-ring: rgb(10 132 255 / 0.62);\n color-scheme: dark;\n }\n}\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/toast/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([hidden]){display:none}.toast{--wui-glass-shadow:var(--wui-shadow-pop,0 3px 9px #00000045);transform:translate(var(--toast-slide-x,0), var(--toast-slide-y,-8px)) scale(.97);width:320px;min-height:36px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);opacity:0;background-color:var(--wui-color-surface-overlay,#f6f6f6e0);transition:opacity var(--wui-duration-overlay-enter,.18s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1)), transform var(--wui-duration-overlay-enter,.18s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));border-radius:20px;gap:8px;padding:8px;line-height:1.5;display:flex;position:relative}:host([visible]) .toast{opacity:1;transform:translate(0)scale(1)}:host(:not([visible])) .toast{transition-duration:var(--wui-duration-overlay-exit,.14s)}web-ui-button.toast-close-btn{pointer-events:none;cursor:pointer;opacity:0;transition:opacity var(--wui-duration-trigger,.16s) ease;position:absolute;top:-8px;right:-8px}web-ui-button.toast-close-btn:focus-within{pointer-events:auto;opacity:1}@media (hover:hover) and (pointer:fine){web-ui-button.toast-close-btn:hover,.toast:hover web-ui-button.toast-close-btn{pointer-events:auto;opacity:1}}.toast web-ui-button[icon]{--wui-button-color:var(--wui-color-text-muted,#6a6a6a)}.toast-icon{border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;width:20px;height:20px;margin-bottom:auto;display:flex}.toast.success .toast-icon{color:var(--wui-color-success,#16a34a);background-color:color-mix(in srgb, var(--wui-color-success,#16a34a) 10%, transparent)}.toast.info .toast-icon{color:var(--wui-color-info,#2563eb);background-color:color-mix(in srgb, var(--wui-color-info,#2563eb) 10%, transparent)}.toast.warning .toast-icon{color:var(--wui-color-warning,#d97706);background-color:color-mix(in srgb, var(--wui-color-warning,#d97706) 10%, transparent)}.toast.error .toast-icon{color:var(--wui-color-danger,#dc2626);background-color:color-mix(in srgb, var(--wui-color-danger,#dc2626) 10%, transparent)}.toast-body{flex:1;min-width:0}.toast-heading{font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;font-weight:600;line-height:1.4;overflow:hidden}.toast-message{-webkit-line-clamp:3;font-size:calc(var(--wui-font-size,14px) - 1px);color:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 55%, transparent);word-break:break-all;-webkit-box-orient:vertical;line-height:1.4;display:-webkit-box;overflow:hidden}.toast-time{color:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 30%, transparent);white-space:nowrap;font-size:12px}@media (prefers-reduced-motion:reduce){.toast,:host([visible]) .toast{transform:none}}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([hidden]){display:none}.toast{--wui-internal-glass-shadow:var(--wui-shadow-panel,0 3px 9px #00000045);transform:translate(var(--toast-slide-x,0), var(--toast-slide-y,-8px)) scale(.97);width:320px;min-height:36px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);opacity:0;background-color:var(--wui-color-surface-overlay,#f6f6f6d1);transition:opacity var(--wui-duration-overlay-enter,.18s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1)), transform var(--wui-duration-overlay-enter,.18s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));border-radius:20px;gap:8px;padding:8px;line-height:1.5;display:flex;position:relative}:host([visible]) .toast{opacity:1;transform:translate(0)scale(1)}:host(:not([visible])) .toast{transition-duration:var(--wui-duration-overlay-exit,.14s)}web-ui-button.toast-close-btn{pointer-events:none;cursor:pointer;opacity:0;transition:opacity var(--wui-duration-trigger,.16s) ease;position:absolute;top:-8px;right:-8px}web-ui-button.toast-close-btn:focus-within{pointer-events:auto;opacity:1}@media (hover:hover) and (pointer:fine){web-ui-button.toast-close-btn:hover,.toast:hover web-ui-button.toast-close-btn{pointer-events:auto;opacity:1}}.toast web-ui-button[icon]{--wui-button-color:var(--wui-color-text-secondary,#6a6a6a)}.toast-icon{border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;width:20px;height:20px;margin-bottom:auto;display:flex}.toast.success .toast-icon{color:var(--wui-color-success,#16a34a);background-color:color-mix(in srgb, var(--wui-color-success,#16a34a) 10%, transparent)}.toast.info .toast-icon{color:var(--wui-color-info,#2563eb);background-color:color-mix(in srgb, var(--wui-color-info,#2563eb) 10%, transparent)}.toast.warning .toast-icon{color:var(--wui-color-warning,#d97706);background-color:color-mix(in srgb, var(--wui-color-warning,#d97706) 10%, transparent)}.toast.error .toast-icon{color:var(--wui-color-danger,#dc2626);background-color:color-mix(in srgb, var(--wui-color-danger,#dc2626) 10%, transparent)}.toast-body{flex:1;min-width:0}.toast-heading{font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;font-weight:600;line-height:1.4;overflow:hidden}.toast-message{-webkit-line-clamp:3;font-size:calc(var(--wui-font-size,14px) - 1px);color:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 55%, transparent);word-break:break-all;-webkit-box-orient:vertical;line-height:1.4;display:-webkit-box;overflow:hidden}.toast-time{color:color-mix(in srgb, var(--wui-color-text,#1b1b1b) 30%, transparent);white-space:nowrap;font-size:12px}@media (prefers-reduced-motion:reduce){.toast,:host([visible]) .toast{transform:none}}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/toast/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n/* ===== 入场 / 退场动画 ===== */\n\n.toast {\n --wui-glass-shadow: var(--wui-shadow-pop, 0 3px 9px rgb(0 0 0 / 0.27));\n position: relative;\n transform: translate(var(--toast-slide-x, 0), var(--toast-slide-y, -8px)) scale(0.97);\n\n display: flex;\n gap: 8px;\n\n width: 320px;\n min-height: 36px;\n padding: 8px;\n border-radius: 20px;\n\n font-size: var(--wui-font-size, 14px);\n line-height: 1.5;\n color: var(--wui-color-text, #1b1b1b);\n\n opacity: 0;\n background-color: var(--wui-color-surface-overlay, rgb(246 246 246 / 0.88));\n\n transition:\n opacity var(--wui-duration-overlay-enter, 180ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1)),\n transform var(--wui-duration-overlay-enter, 180ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n:host([visible]) .toast {\n transform: translate(0, 0) scale(1);\n opacity: 1;\n}\n\n:host(:not([visible])) .toast {\n transition-duration: var(--wui-duration-overlay-exit, 140ms);\n}\n\n/* ===== 关闭按钮(放在 hover 规则之前,避免 specificity 降序) ===== */\n\nweb-ui-button.toast-close-btn {\n pointer-events: none;\n cursor: pointer;\n\n position: absolute;\n top: -8px;\n right: -8px;\n\n opacity: 0;\n\n transition: opacity var(--wui-duration-trigger, 160ms) ease;\n\n /* 内层原生按钮获得键盘焦点时宿主同样可见 */\n &:focus-within {\n pointer-events: auto;\n opacity: 1;\n }\n}\n\n@media (hover: hover) and (pointer: fine) {\n web-ui-button.toast-close-btn:hover,\n .toast:hover web-ui-button.toast-close-btn {\n pointer-events: auto;\n opacity: 1;\n }\n}\n\n/* secondary 变体默认用文本色,恢复原关闭按钮的 muted 观感 */\n.toast web-ui-button[icon] {\n --wui-button-color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n/* ===== 图标 ===== */\n\n.toast-icon {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 20px;\n height: 20px;\n margin-bottom: auto;\n border-radius: calc(infinity * 1px);\n}\n\n.toast.success .toast-icon {\n color: var(--wui-color-success, #16a34a);\n background-color: color-mix(in srgb, var(--wui-color-success, #16a34a) 10%, transparent);\n}\n\n.toast.info .toast-icon {\n color: var(--wui-color-info, #2563eb);\n background-color: color-mix(in srgb, var(--wui-color-info, #2563eb) 10%, transparent);\n}\n\n.toast.warning .toast-icon {\n color: var(--wui-color-warning, #d97706);\n background-color: color-mix(in srgb, var(--wui-color-warning, #d97706) 10%, transparent);\n}\n\n.toast.error .toast-icon {\n color: var(--wui-color-danger, #dc2626);\n background-color: color-mix(in srgb, var(--wui-color-danger, #dc2626) 10%, transparent);\n}\n\n/* ===== 内容区 ===== */\n\n.toast-body {\n flex: 1;\n min-width: 0;\n}\n\n.toast-heading {\n overflow: hidden;\n\n font-size: var(--wui-font-size, 14px);\n font-weight: 600;\n line-height: 1.4;\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.toast-message {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n\n font-size: calc(var(--wui-font-size, 14px) - 1px);\n line-height: 1.4;\n color: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 55%, transparent);\n word-break: break-all;\n}\n\n/* ===== 时间戳 ===== */\n\n.toast-time {\n font-size: 12px;\n color: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 30%, transparent);\n white-space: nowrap;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast,\n :host([visible]) .toast {\n transform: none;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/toast/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n/* ===== 入场 / 退场动画 ===== */\n\n.toast {\n --wui-internal-glass-shadow: var(--wui-shadow-panel, 0 3px 9px rgb(0 0 0 / 0.27));\n position: relative;\n transform: translate(var(--toast-slide-x, 0), var(--toast-slide-y, -8px)) scale(0.97);\n\n display: flex;\n gap: 8px;\n\n width: 320px;\n min-height: 36px;\n padding: 8px;\n border-radius: 20px;\n\n font-size: var(--wui-font-size, 14px);\n line-height: 1.5;\n color: var(--wui-color-text, #1b1b1b);\n\n opacity: 0;\n background-color: var(--wui-color-surface-overlay, rgb(246 246 246 / 0.82));\n\n transition:\n opacity var(--wui-duration-overlay-enter, 180ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1)),\n transform var(--wui-duration-overlay-enter, 180ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n:host([visible]) .toast {\n transform: translate(0, 0) scale(1);\n opacity: 1;\n}\n\n:host(:not([visible])) .toast {\n transition-duration: var(--wui-duration-overlay-exit, 140ms);\n}\n\n/* ===== 关闭按钮(放在 hover 规则之前,避免 specificity 降序) ===== */\n\nweb-ui-button.toast-close-btn {\n pointer-events: none;\n cursor: pointer;\n\n position: absolute;\n top: -8px;\n right: -8px;\n\n opacity: 0;\n\n transition: opacity var(--wui-duration-trigger, 160ms) ease;\n\n /* 内层原生按钮获得键盘焦点时宿主同样可见 */\n &:focus-within {\n pointer-events: auto;\n opacity: 1;\n }\n}\n\n@media (hover: hover) and (pointer: fine) {\n web-ui-button.toast-close-btn:hover,\n .toast:hover web-ui-button.toast-close-btn {\n pointer-events: auto;\n opacity: 1;\n }\n}\n\n/* secondary 变体默认用文本色,恢复原关闭按钮的 muted 观感 */\n.toast web-ui-button[icon] {\n --wui-button-color: var(--wui-color-text-secondary, #6a6a6a);\n}\n\n/* ===== 图标 ===== */\n\n.toast-icon {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 20px;\n height: 20px;\n margin-bottom: auto;\n border-radius: calc(infinity * 1px);\n}\n\n.toast.success .toast-icon {\n color: var(--wui-color-success, #16a34a);\n background-color: color-mix(in srgb, var(--wui-color-success, #16a34a) 10%, transparent);\n}\n\n.toast.info .toast-icon {\n color: var(--wui-color-info, #2563eb);\n background-color: color-mix(in srgb, var(--wui-color-info, #2563eb) 10%, transparent);\n}\n\n.toast.warning .toast-icon {\n color: var(--wui-color-warning, #d97706);\n background-color: color-mix(in srgb, var(--wui-color-warning, #d97706) 10%, transparent);\n}\n\n.toast.error .toast-icon {\n color: var(--wui-color-danger, #dc2626);\n background-color: color-mix(in srgb, var(--wui-color-danger, #dc2626) 10%, transparent);\n}\n\n/* ===== 内容区 ===== */\n\n.toast-body {\n flex: 1;\n min-width: 0;\n}\n\n.toast-heading {\n overflow: hidden;\n\n font-size: var(--wui-font-size, 14px);\n font-weight: 600;\n line-height: 1.4;\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.toast-message {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n\n font-size: calc(var(--wui-font-size, 14px) - 1px);\n line-height: 1.4;\n color: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 55%, transparent);\n word-break: break-all;\n}\n\n/* ===== 时间戳 ===== */\n\n.toast-time {\n font-size: 12px;\n color: color-mix(in srgb, var(--wui-color-text, #1b1b1b) 30%, transparent);\n white-space: nowrap;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast,\n :host([visible]) .toast {\n transform: none;\n }\n}\n"],"mappings":""}