@greypan/web-ui 6.3.1 → 6.4.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 (101) hide show
  1. package/README.CN.md +13 -4
  2. package/README.md +13 -4
  3. package/dist/_virtual/{_@oxc-project_runtime@0.146.0 → _@oxc-project_runtime@0.149.0}/helpers/esm/decorate.js +1 -1
  4. package/dist/assets/menu-portal.js +1 -1
  5. package/dist/assets/menu-portal.js.map +1 -1
  6. package/dist/assets/overlay-motion.js +1 -1
  7. package/dist/assets/overlay-motion.js.map +1 -1
  8. package/dist/components/autocomplete/index.js +3 -3
  9. package/dist/components/autocomplete/index.js.map +1 -1
  10. package/dist/components/autocomplete/style.js +1 -1
  11. package/dist/components/autocomplete/style.js.map +1 -1
  12. package/dist/components/avatar/index.js +1 -1
  13. package/dist/components/back-top/index.js +1 -1
  14. package/dist/components/badge/index.js +1 -1
  15. package/dist/components/button/index.js +1 -1
  16. package/dist/components/button-group/index.js +1 -1
  17. package/dist/components/checkbox/index.js +2 -2
  18. package/dist/components/checkbox/index.js.map +1 -1
  19. package/dist/components/checkbox/style.js +1 -1
  20. package/dist/components/checkbox/style.js.map +1 -1
  21. package/dist/components/checkbox-group/index.js +2 -2
  22. package/dist/components/checkbox-group/index.js.map +1 -1
  23. package/dist/components/collapse/index.js +3 -3
  24. package/dist/components/collapse/index.js.map +1 -1
  25. package/dist/components/context-menu/index.js +7 -7
  26. package/dist/components/context-menu/index.js.map +1 -1
  27. package/dist/components/dialog/index.js +1 -1
  28. package/dist/components/dialog/style.js +1 -1
  29. package/dist/components/dialog/style.js.map +1 -1
  30. package/dist/components/drawer/index.js +1 -1
  31. package/dist/components/drawer/index.js.map +1 -1
  32. package/dist/components/drawer/style.js +1 -1
  33. package/dist/components/dropdown/index.js +5 -5
  34. package/dist/components/dropdown/index.js.map +1 -1
  35. package/dist/components/dropdown-divider/index.js +1 -1
  36. package/dist/components/dropdown-header/index.js +1 -1
  37. package/dist/components/dropdown-item/index.js +1 -1
  38. package/dist/components/empty/index.js +1 -1
  39. package/dist/components/icon/index.js +1 -1
  40. package/dist/components/icon/style.js +1 -1
  41. package/dist/components/icon/style.js.map +1 -1
  42. package/dist/components/image-preview/index.js +5 -5
  43. package/dist/components/image-preview/index.js.map +1 -1
  44. package/dist/components/image-preview/style.js +1 -1
  45. package/dist/components/image-preview/style.js.map +1 -1
  46. package/dist/components/input/index.js +2 -2
  47. package/dist/components/input/index.js.map +1 -1
  48. package/dist/components/input-number/index.js +2 -2
  49. package/dist/components/input-number/index.js.map +1 -1
  50. package/dist/components/layout/index.js +1 -1
  51. package/dist/components/option/index.js +1 -1
  52. package/dist/components/popover/index.js +1 -1
  53. package/dist/components/radio/index.js +2 -2
  54. package/dist/components/radio/index.js.map +1 -1
  55. package/dist/components/radio/style.js +1 -1
  56. package/dist/components/radio/style.js.map +1 -1
  57. package/dist/components/radio-group/index.js +2 -2
  58. package/dist/components/radio-group/index.js.map +1 -1
  59. package/dist/components/segmented/index.js +1 -1
  60. package/dist/components/segmented/style.js +1 -1
  61. package/dist/components/segmented/style.js.map +1 -1
  62. package/dist/components/segmented-trigger/index.js +1 -1
  63. package/dist/components/select/index.js +3 -3
  64. package/dist/components/select/index.js.map +1 -1
  65. package/dist/components/select/style.js +1 -1
  66. package/dist/components/select/style.js.map +1 -1
  67. package/dist/components/slider/index.js +1 -1
  68. package/dist/components/slider/style.js +1 -1
  69. package/dist/components/slider/style.js.map +1 -1
  70. package/dist/components/spinner/index.js +2 -2
  71. package/dist/components/spinner/index.js.map +1 -1
  72. package/dist/components/spinner/style.js +1 -1
  73. package/dist/components/spinner/style.js.map +1 -1
  74. package/dist/components/svg-draw-lines/index.js +1 -1
  75. package/dist/components/switch/index.js +2 -2
  76. package/dist/components/switch/index.js.map +1 -1
  77. package/dist/components/switch/style.js +1 -1
  78. package/dist/components/switch/style.js.map +1 -1
  79. package/dist/components/textarea/index.js +3 -3
  80. package/dist/components/textarea/index.js.map +1 -1
  81. package/dist/components/theme/index.js +1 -1
  82. package/dist/components/theme/style.js +1 -1
  83. package/dist/components/theme/style.js.map +1 -1
  84. package/dist/components/toast/style.js +1 -1
  85. package/dist/components/toast/style.js.map +1 -1
  86. package/dist/components/toast/toast.js +1 -1
  87. package/dist/components/tooltip/index.js +6 -3
  88. package/dist/components/tooltip/index.js.map +1 -1
  89. package/dist/shared/form-association/index.js +1 -1
  90. package/dist/shared/form-association/index.js.map +1 -1
  91. package/dist/shared/menu-portal/menu-tree.js +1 -1
  92. package/dist/shared/menu-portal/menu-tree.js.map +1 -1
  93. package/dist/shared/overlay/native-dialog-presence.js +2 -2
  94. package/dist/shared/overlay/native-dialog-presence.js.map +1 -1
  95. package/dist/shared/overlay/overlay.js +1 -1
  96. package/dist/shared/overlay/overlay.js.map +1 -1
  97. package/dist/shared/overlay/portal.js +1 -1
  98. package/dist/shared/overlay/portal.js.map +1 -1
  99. package/dist/shared/visible-area/index.js +1 -1
  100. package/dist/shared/visible-area/index.js.map +1 -1
  101. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import { FormAssociated as t, FormAssociationController as n, defineFormAssociation as r } from "../../shared/form-association/index.js";
3
3
  import { GroupController as i, defineGroupCoordinator as a } from "../../shared/group-management/index.js";
4
4
  import o from "./style.js";
@@ -68,7 +68,7 @@ var p = class extends t(s) {
68
68
  }
69
69
  _syncValidity() {
70
70
  let e = this._formAssociation.getInternals();
71
- if (!(!e || typeof e.setValidity != "function")) {
71
+ if (e && typeof e.setValidity == "function") {
72
72
  if (this._isDisabled || !this.required || this._value) {
73
73
  e.setValidity({});
74
74
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/radio-group/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { defineGroupCoordinator, GroupController } from '@/shared/group-management'\n\nimport type { WebUiRadio } from '../radio'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-radio-group')\nexport class WebUiRadioGroup extends FormAssociated(LitElement) {\n static override styles = unsafeCSS(style)\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n\n @state() private _value = ''\n\n private readonly _groupController = new GroupController(\n this,\n defineGroupCoordinator<WebUiRadio, string>({\n host: this,\n getItems: () => [...this.querySelectorAll<WebUiRadio>('web-ui-radio')],\n getValue: () => this._value,\n setValue: value => {\n this.value = value\n },\n getDisabled: () => this._isDisabled,\n isItem: (target): target is WebUiRadio => target instanceof HTMLElement && target.matches('web-ui-radio'),\n isItemSelected: (radio, value) => radio.value === value,\n getNextValue: (radio, value) => (radio.checked ? radio.value : value),\n valuesEqual: (a, b) => a === b,\n copyValue: value => value,\n setItemSelected: (radio, selected) => {\n radio.checked = selected\n },\n dispatchValueChange: () => {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }).make()\n )\n\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 initialize: () => {\n const attributeValue = this.getAttribute('value')\n if (attributeValue !== null) this.value = attributeValue\n },\n getState: () => this._value,\n setState: value => {\n this.value = value\n },\n getFormValue: () => (this.name && this._value ? this._value : null),\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 override formDisabledCallback(disabled: boolean) {\n this._formAssociation.setDisabled(disabled)\n this._groupController.sync()\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._value) {\n internals.setValidity({})\n return\n }\n internals.setValidity({ valueMissing: true }, '请选择一项')\n }\n\n override render() {\n return html`<div class=\"wui-radio-group\"><slot></slot></div>`\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-radio-group': WebUiRadioGroup\n }\n}\n"],"mappings":";;;;;;;AAWO,IAAM,IAAN,cAA8B,EAAe,CAAU,CAAC,CAAC;;EAkEhB,aAhEI,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IAE7B,KAAA,SAAA,IAEU,KAAA,mBAAA,IAAI,EACtC,MACA,EAA2C;GACzC,MAAM;GACN,gBAAgB,CAAC,GAAG,KAAK,iBAA6B,cAAc,CAAC;GACrE,gBAAgB,KAAK;GACrB,WAAU,MAAS;IACjB,KAAK,QAAQ;GACf;GACA,mBAAmB,KAAK;GACxB,SAAS,MAAiC,aAAkB,eAAe,EAAO,QAAQ,cAAc;GACxG,iBAAiB,GAAO,MAAU,EAAM,UAAU;GAClD,eAAe,GAAO,MAAW,EAAM,UAAU,EAAM,QAAQ;GAC/D,cAAc,GAAG,MAAM,MAAM;GAC7B,YAAW,MAAS;GACpB,kBAAkB,GAAO,MAAa;IACpC,EAAM,UAAU;GAClB;GACA,2BAA2B;IAEzB,AADA,KAAK,cAAc,IAAI,MAAM,SAAS;KAAE,SAAS;KAAM,UAAU;IAAK,CAAC,CAAC,GACxE,KAAK,cAAc,IAAI,MAAM,UAAU;KAAE,SAAS;KAAM,UAAU;IAAK,CAAC,CAAC;GAC3E;EACF,CAAC,CAAC,CAAC,KAAK,CACV,GAiBoC,KAAA,mBAAA,EAA8B;GAChE,MAAM;GACN,kBA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AAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAEzC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GAPR,IAAA,EAAA,CAAA,EAAc,oBAAoB,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/radio-group/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { defineGroupCoordinator, GroupController } from '@/shared/group-management'\n\nimport type { WebUiRadio } from '../radio'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-radio-group')\nexport class WebUiRadioGroup extends FormAssociated(LitElement) {\n static override styles = unsafeCSS(style)\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n\n @state() private _value = ''\n\n private readonly _groupController = new GroupController(\n this,\n defineGroupCoordinator<WebUiRadio, string>({\n host: this,\n getItems: () => [...this.querySelectorAll<WebUiRadio>('web-ui-radio')],\n getValue: () => this._value,\n setValue: value => {\n this.value = value\n },\n getDisabled: () => this._isDisabled,\n isItem: (target): target is WebUiRadio => target instanceof HTMLElement && target.matches('web-ui-radio'),\n isItemSelected: (radio, value) => radio.value === value,\n getNextValue: (radio, value) => (radio.checked ? radio.value : value),\n valuesEqual: (a, b) => a === b,\n copyValue: value => value,\n setItemSelected: (radio, selected) => {\n radio.checked = selected\n },\n dispatchValueChange: () => {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }).make()\n )\n\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 initialize: () => {\n const attributeValue = this.getAttribute('value')\n if (attributeValue !== null) this.value = attributeValue\n },\n getState: () => this._value,\n setState: value => {\n this.value = value\n },\n getFormValue: () => (this.name && this._value ? this._value : null),\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 override formDisabledCallback(disabled: boolean) {\n this._formAssociation.setDisabled(disabled)\n this._groupController.sync()\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._value) {\n internals.setValidity({})\n return\n }\n internals.setValidity({ valueMissing: true }, '请选择一项')\n }\n\n override render() {\n return html`<div class=\"wui-radio-group\"><slot></slot></div>`\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-radio-group': WebUiRadioGroup\n }\n}\n"],"mappings":";;;;;;;AAWO,IAAM,IAAN,cAA8B,EAAe,CAAU,CAAC,CAAC;;EAkEhB,aAhEI,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IAE7B,KAAA,SAAA,IAEU,KAAA,mBAAA,IAAI,EACtC,MACA,EAA2C;GACzC,MAAM;GACN,gBAAgB,CAAC,GAAG,KAAK,iBAA6B,cAAc,CAAC;GACrE,gBAAgB,KAAK;GACrB,WAAU,MAAS;IACjB,KAAK,QAAQ;GACf;GACA,mBAAmB,KAAK;GACxB,SAAS,MAAiC,aAAkB,eAAe,EAAO,QAAQ,cAAc;GACxG,iBAAiB,GAAO,MAAU,EAAM,UAAU;GAClD,eAAe,GAAO,MAAW,EAAM,UAAU,EA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,OAAO,EAAU,eAAgB,YACnD;OAAI,KAAK,eAAe,CAAC,KAAK,YAAY,KAAK,QAAQ;IACrD,EAAU,YAAY,CAAC,CAAC;IACxB;GACF;GACA,EAAU,YAAY,EAAE,cAAc,GAAK,GAAG,OAAO;EADrD;CAEF;CAEA,SAAkB;EAChB,OAAO,CAAI;CACb;AAMF;AAzFG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,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,GAEzC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GAPR,IAAA,EAAA,CAAA,EAAc,oBAAoB,CAAA,GAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import { FormAssociated as t, FormAssociationController as n, defineFormAssociation as r } from "../../shared/form-association/index.js";
3
3
  import { installPointerFocusSuppression as i } from "../../shared/focus/pointer-focus.js";
4
4
  import { GroupController as a, defineGroupCoordinator as o } from "../../shared/group-management/index.js";
@@ -1,5 +1,5 @@
1
1
  //#region src/components/segmented/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{touch-action:none;-webkit-user-select:none;user-select:none;display:inline-block}.wui-segmented{touch-action:none;cursor:default;border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-segmented,#e5e5ea);align-items:stretch;padding:4px;display:inline-flex;position:relative}.wui-segmented.is-disabled{cursor:not-allowed;opacity:.4}.wui-segmented.is-disabled .wui-segmented-trigger.is-disabled{opacity:1}.wui-segmented-indicator{z-index:0;top:4px;bottom:4px;left:var(--indicator-left,0);transform-origin:50%;width:var(--indicator-width,0);border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-selected,#fff);transition:transform var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) ease, box-shadow var(--wui-duration-press,80ms) ease;display:block;position:absolute;transform:scale(1);box-shadow:0 1px 3px #0000001f,0 1px 2px #00000014}.is-indicator-ready:not(.is-dragging) .wui-segmented-indicator{transition:left var(--wui-duration-trigger,.16s) var(--wui-ease-slide,cubic-bezier(.77, 0, .175, 1)), width var(--wui-duration-trigger,.16s) var(--wui-ease-slide,cubic-bezier(.77, 0, .175, 1)), transform var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) ease, box-shadow var(--wui-duration-press,80ms) ease}.wui-segmented.is-pressed .wui-segmented-indicator,.wui-segmented.is-dragging .wui-segmented-indicator{background-color:var(--wui-color-surface-glass,#fafafa57);-webkit-backdrop-filter:blur(4px)saturate(160%);backdrop-filter:blur(4px)saturate(160%);transform:scale(1.5);box-shadow:0 0 1px #0000001a,0 5px 14px #00000029,0 12px 28px #0000001a}.wui-segmented.is-dragging:not(.is-disabled){--wui-internal-segmented-trigger-cursor:grabbing;cursor:grabbing}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{touch-action:none;-webkit-user-select:none;user-select:none;display:inline-block}.wui-segmented{touch-action:none;cursor:default;border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-segmented,#e5e5ea);align-items:stretch;padding:4px;display:inline-flex;position:relative}.wui-segmented.is-disabled{cursor:not-allowed;opacity:.4}.wui-segmented.is-disabled .wui-segmented-trigger.is-disabled{opacity:1}.wui-segmented-indicator{z-index:0;top:4px;bottom:4px;left:var(--indicator-left,0);transform-origin:50%;width:var(--indicator-width,0);border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-selected,#fff);transition:transform var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) ease, box-shadow var(--wui-duration-press,80ms) ease;display:block;position:absolute;transform:scale(1);box-shadow:0 1px 3px #0000001f,0 1px 2px #00000014}.is-indicator-ready:not(.is-dragging) .wui-segmented-indicator{transition:left var(--wui-duration-trigger,.16s) var(--wui-ease-slide,cubic-bezier(.77, 0, .175, 1)), width var(--wui-duration-trigger,.16s) var(--wui-ease-slide,cubic-bezier(.77, 0, .175, 1)), transform var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) ease, box-shadow var(--wui-duration-press,80ms) ease}.wui-segmented.is-pressed .wui-segmented-indicator,.wui-segmented.is-dragging .wui-segmented-indicator{background-color:var(--wui-color-surface-glass,#fafafa57);-webkit-backdrop-filter:blur(4px)saturate(160%);backdrop-filter:blur(4px)saturate(160%);box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 2px 20px #0003;transform:scale(1.5)}.wui-segmented.is-dragging:not(.is-disabled){--wui-internal-segmented-trigger-cursor:grabbing;cursor:grabbing}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/segmented/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n touch-action: none;\n user-select: none;\n display: inline-block;\n}\n\n.wui-segmented {\n touch-action: none;\n cursor: default;\n\n position: relative;\n\n display: inline-flex;\n align-items: stretch;\n\n padding: 4px;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: var(--wui-color-surface-segmented, #e5e5ea);\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n &.is-disabled .wui-segmented-trigger.is-disabled {\n opacity: 1;\n }\n}\n\n.wui-segmented-indicator {\n position: absolute;\n z-index: 0;\n top: 4px;\n bottom: 4px;\n left: var(--indicator-left, 0);\n transform-origin: center center;\n transform: scale(1);\n\n display: block;\n\n width: var(--indicator-width, 0);\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n /* 静止态实体白指示器;按压/拖拽时切换为玻璃(半透明玻璃背景 + backdrop blur +\n 描边)并放大 1.5x,回到最初修复不跟手问题时期的视觉结构。 */\n background-color: var(--wui-color-surface-selected, #fff);\n box-shadow:\n 0 1px 3px rgb(0 0 0 / 0.12),\n 0 1px 2px rgb(0 0 0 / 0.08);\n\n transition:\n transform var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) ease,\n box-shadow var(--wui-duration-press, 80ms) ease;\n\n /* transition 只在首帧定位后且非拖拽状态启用,避免组件进入视口时触发初始化动画或拖拽跟手产生延迟 */\n .is-indicator-ready:not(.is-dragging) & {\n transition:\n left var(--wui-duration-trigger, 160ms) var(--wui-ease-slide, cubic-bezier(0.77, 0, 0.175, 1)),\n width var(--wui-duration-trigger, 160ms) var(--wui-ease-slide, cubic-bezier(0.77, 0, 0.175, 1)),\n transform var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) ease,\n box-shadow var(--wui-duration-press, 80ms) ease;\n }\n}\n\n.wui-segmented.is-pressed .wui-segmented-indicator,\n.wui-segmented.is-dragging .wui-segmented-indicator {\n transform: scale(1.5);\n background-color: var(--wui-color-surface-glass, rgb(250 250 250 / 0.34));\n backdrop-filter: blur(4px) saturate(160%);\n\n /* 按下/拖拽时加深投影(立体玻璃感)。直接写死值、不经过 var 中转:iOS Safari 对\n var 离散切换驱动的 box-shadow 不触发过渡且可能整体不生效(上一轮真机「回退之前」)。 */\n box-shadow:\n 0 0 1px rgb(0 0 0 / 0.1),\n 0 5px 14px rgb(0 0 0 / 0.16),\n 0 12px 28px rgb(0 0 0 / 0.1);\n}\n\n.wui-segmented.is-dragging:not(.is-disabled) {\n --wui-internal-segmented-trigger-cursor: grabbing;\n cursor: grabbing;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/segmented/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n touch-action: none;\n user-select: none;\n display: inline-block;\n}\n\n.wui-segmented {\n touch-action: none;\n cursor: default;\n\n position: relative;\n\n display: inline-flex;\n align-items: stretch;\n\n padding: 4px;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: var(--wui-color-surface-segmented, #e5e5ea);\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n &.is-disabled .wui-segmented-trigger.is-disabled {\n opacity: 1;\n }\n}\n\n.wui-segmented-indicator {\n position: absolute;\n z-index: 0;\n top: 4px;\n bottom: 4px;\n left: var(--indicator-left, 0);\n transform-origin: center center;\n transform: scale(1);\n\n display: block;\n\n width: var(--indicator-width, 0);\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n /* 静止态实体白指示器;按压/拖拽时切换为玻璃(半透明玻璃背景 + backdrop blur +\n 描边)并放大 1.5x,回到最初修复不跟手问题时期的视觉结构。 */\n background-color: var(--wui-color-surface-selected, #fff);\n box-shadow:\n 0 1px 3px rgb(0 0 0 / 0.12),\n 0 1px 2px rgb(0 0 0 / 0.08);\n\n transition:\n transform var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) ease,\n box-shadow var(--wui-duration-press, 80ms) ease;\n\n /* transition 只在首帧定位后且非拖拽状态启用,避免组件进入视口时触发初始化动画或拖拽跟手产生延迟 */\n .is-indicator-ready:not(.is-dragging) & {\n transition:\n left var(--wui-duration-trigger, 160ms) var(--wui-ease-slide, cubic-bezier(0.77, 0, 0.175, 1)),\n width var(--wui-duration-trigger, 160ms) var(--wui-ease-slide, cubic-bezier(0.77, 0, 0.175, 1)),\n transform var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) ease,\n box-shadow var(--wui-duration-press, 80ms) ease;\n }\n}\n\n.wui-segmented.is-pressed .wui-segmented-indicator,\n.wui-segmented.is-dragging .wui-segmented-indicator {\n transform: scale(1.5);\n background-color: var(--wui-color-surface-glass, rgb(250 250 250 / 0.34));\n backdrop-filter: blur(4px) saturate(160%);\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 2px 20px rgb(0 0 0 / 0.2);\n}\n\n.wui-segmented.is-dragging:not(.is-disabled) {\n --wui-internal-segmented-trigger-cursor: grabbing;\n cursor: grabbing;\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import { installPointerFocusSuppression as t } from "../../shared/focus/pointer-focus.js";
3
3
  import { defineGroupManaged as n, selectionGroupContextKey as r } from "../../shared/group-management/index.js";
4
4
  import i from "./style.js";
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import "../icon/index.js";
3
3
  import t from "../../icons/generated/lucide-chevron-down.js";
4
4
  import "../option/index.js";
@@ -81,7 +81,7 @@ var O = class extends i(b) {
81
81
  }), this._bindOption = (e) => this._optionListeners.bind(e), this._unbindOption = (e) => this._optionListeners.unbind(e), this._handleOptionClick = (e) => {
82
82
  if (!(e.currentTarget instanceof HTMLElement)) return;
83
83
  let t = e.currentTarget;
84
- t.disabled || !this._isLive(t) || (this.value = t.value, this._close(), this._notifyValueChange());
84
+ !t.disabled && this._isLive(t) && (this.value = t.value, this._close(), this._notifyValueChange());
85
85
  }, this._onOptionUpdate = () => {
86
86
  this._syncSelected(), this._syncActiveOption();
87
87
  }, this._handleOptionPointerOver = (e) => {
@@ -170,7 +170,7 @@ var O = class extends i(b) {
170
170
  }
171
171
  _syncValidity() {
172
172
  let e = this._formAssociation.getInternals();
173
- !e || typeof e.setValidity != "function" || (this._isDisabled || !this.required || this.value ? e.setValidity({}) : e.setValidity({ valueMissing: !0 }, "请选择一项"));
173
+ e && typeof e.setValidity == "function" && (this._isDisabled || !this.required || this.value ? e.setValidity({}) : e.setValidity({ valueMissing: !0 }, "请选择一项"));
174
174
  }
175
175
  _syncOpenAttribute() {
176
176
  this.toggleAttribute("open", this._isOpen);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport '@/components/option'\nimport glass from '@/assets/glass.css?inline'\nimport overlayMotion from '@/assets/overlay-motion.css?inline'\nimport type { WebUiOption } from '@/components/option'\nimport { lucideChevronDown } from '@/icons'\nimport { installPointerFocusSuppression } from '@/shared/focus/pointer-focus'\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { dispatchOpenChangeEvent } from '@/shared/open-state'\nimport {\n createComboboxOpenController,\n createOptionListenerBinding,\n handleComboboxFocusOut,\n nextWrappingIndex\n} from '@/shared/option-portal'\nimport { defineOptionPortal } from '@/shared/option-portal'\nimport { defineAnchoredPanel } from '@/shared/overlay/anchored-panel'\nimport { overlayComposition } from '@/shared/overlay/composition'\nimport { applyOverlayVariables, defineOverlayPortal } from '@/shared/overlay/portal'\nimport type { OverlayContainer, OverlayPortal } from '@/shared/overlay/portal'\nimport { defineScrollLockLease } from '@/shared/scroll-lock/scroll-lock'\n\nimport style from './style.css?inline'\n\ninstallPointerFocusSuppression()\n\n@customElement('web-ui-select')\nexport class WebUiSelect extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(overlayMotion), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) portal = false\n @property({ type: Boolean, reflect: true, attribute: 'no-scroll-lock' }) noScrollLock = false\n @property({ attribute: false }) overlayContainer?: OverlayContainer\n @property({ type: String, reflect: true }) name = ''\n\n // value 使用内部状态 + 访问器模式,在变更时同步 ElementInternals;\n // @property + reflect 让它与 input/textarea/slider/input-number 的 value 反射语义保持一致。\n @state() private _value = ''\n @property({ type: String, reflect: true })\n get value(): string {\n return this._value\n }\n set value(v: string) {\n const old = this._value\n this._value = v\n this._formAssociation.sync()\n this.toggleAttribute('data-has-value', !!v)\n this.requestUpdate('value', old)\n }\n\n private readonly _formAssociation = defineFormAssociation<string>({\n host: this,\n initialize: () => {\n // 同步 HTML 属性中预设的 value,补全访问器模式不处理 attribute 反射。\n const attrValue = this.getAttribute('value')\n if (attrValue !== null) {\n this._value = attrValue\n this.toggleAttribute('data-has-value', !!attrValue)\n }\n },\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 private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n @state() private _isOpen = false\n @state() private _activeIndex = -1\n @state() private _selectedLabel = ''\n @state() private _hasTriggerSlot = false\n\n private _options: WebUiOption[] = []\n private _portal?: OverlayPortal\n private _portalContent?: HTMLElement\n private readonly _scrollLock = defineScrollLockLease().make()\n\n private static _nextInstanceId = 0\n\n // option 注册表 / portal 同步 / 微任务调度收敛到 shared 模块(autocomplete 同款)\n private readonly _optionPortal = defineOptionPortal().make({\n element: this,\n // 实例级前缀保证多实例同时展开时 option id 不冲突(aria 引用按 id 定位)\n idPrefix: `web-ui-select-${++WebUiSelect._nextInstanceId}`,\n getPortal: () => this._portal,\n getPortalContent: () => this._portalContent,\n isOpen: () => this.portal && this._isOpen,\n getMigratableNodes: () => [...this.querySelectorAll<WebUiOption>('web-ui-option')],\n hasUpdated: () => this.hasUpdated,\n requestUpdate: () => this.requestUpdate(),\n bindOption: option => this._bindOption(option),\n unbindOption: option => this._unbindOption(option),\n onImmediateSync: () => {\n this._refreshOptions()\n this._syncSelected()\n this._syncActiveOption()\n }\n })\n private readonly _panel = defineAnchoredPanel().make({\n getAnchor: () => this.shadowRoot?.querySelector<HTMLElement>('.select-trigger') ?? null,\n getLocalPanel: () => this.shadowRoot?.querySelector<HTMLElement>('.select-overlay') ?? null,\n getPositioning: () => ({\n placement: 'bottom-start',\n offset: 4,\n // 面板宽度统一为 max(内容, trigger, --wui-overlay-min-width),内容自适应展开\n minAnchorWidth: true,\n strategy: this.portal ? 'fixed' : 'absolute'\n }),\n isPortal: () => this.portal,\n createPortal: () => this._createPortal()\n })\n\n get isOpen(): boolean {\n return this._isOpen\n }\n\n get open(): boolean {\n return this._isOpen\n }\n\n private _onClickOutside = (e: MouseEvent) => {\n const panel = this._panel.getPanel()\n const isInside = e.composedPath().includes(this) || (panel && overlayComposition.containsEvent(panel, e))\n if (this._isOpen && !isInside) {\n this._close()\n }\n }\n\n private _onFocusOut = () => {\n handleComboboxFocusOut(\n this,\n () => this._panel.getPanel(),\n () => this._isOpen,\n () => this._close()\n )\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this._optionPortal.bindHost()\n this.addEventListener('keydown', this._onKeydown)\n this.addEventListener('focusout', this._onFocusOut)\n document.addEventListener('click', this._onClickOutside)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this._optionPortal.dispose()\n this.removeEventListener('keydown', this._onKeydown)\n this.removeEventListener('focusout', this._onFocusOut)\n document.removeEventListener('click', this._onClickOutside)\n this._options.forEach(this._unbindOption)\n this._options = []\n this._portal = undefined\n this._portalContent = undefined\n this._close()\n this._panel.dispose()\n this._scrollLock.release()\n }\n\n override firstUpdated() {\n requestAnimationFrame(() => {\n if (this.isConnected) this._optionPortal.scheduleRefresh()\n })\n }\n\n override willUpdate() {\n this._refreshOptions()\n this._syncSelected()\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('portal') || changed.has('overlayContainer'))\n requestAnimationFrame(() => this._reconfigureOverlay())\n if (changed.has('noScrollLock')) this._syncScrollLock()\n this._syncOpenAttribute()\n this._syncValidity()\n }\n\n private _syncValidity() {\n const internals = this._formAssociation.getInternals()\n if (!internals || typeof internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this.value) internals.setValidity({})\n else internals.setValidity({ valueMissing: true }, '请选择一项')\n }\n\n private _syncOpenAttribute() {\n this.toggleAttribute('open', this._isOpen)\n }\n\n private _onTriggerSlotChange = (e: Event) => {\n const slot = e.target as HTMLSlotElement\n const hasContent = slot.assignedElements().length > 0\n if (this._hasTriggerSlot === hasContent) return\n this._hasTriggerSlot = hasContent\n this._reconfigureOverlay()\n }\n\n private _syncSelected() {\n this._options.forEach(o => {\n o.selected = o.value === this.value\n })\n if (!this.value) {\n this._selectedLabel = this.placeholder\n return\n }\n const option = this._options.find(o => o.value === this.value)\n this._selectedLabel = option?.label || this.placeholder\n }\n\n private readonly _optionListeners = createOptionListenerBinding({\n // 惰性解引用:handler 字段声明在后者仍可在调用期取到\n onClick: event => this._handleOptionClick(event),\n onPointerOver: event => this._handleOptionPointerOver(event),\n onPointerDown: event => this._handleOptionPointerDown(event),\n onUpdate: () => this._onOptionUpdate()\n })\n private _bindOption = (option: WebUiOption) => this._optionListeners.bind(option)\n private _unbindOption = (option: WebUiOption) => this._optionListeners.unbind(option)\n\n private _refreshOptions() {\n const activeOption = this._options[this._activeIndex]\n // diff 绑定/解绑与激活索引按 option 身份保持在 shared 内完成,\n // 避免移除中间项后激活静默偏移到相邻项\n const next = this._optionPortal.refresh(this._options, activeOption)\n this._options = next.options\n this._activeIndex = next.activeIndex\n // 非 portal 模式 aria-activedescendant 引用真实 option id,需保证已分配\n this._optionPortal.ensureOptionIds(this._options)\n }\n\n private _handleOptionClick = (e: Event) => {\n if (!(e.currentTarget instanceof HTMLElement)) return\n const option = e.currentTarget as WebUiOption\n if (option.disabled || !this._isLive(option)) return\n this.value = option.value\n this._close()\n this._notifyValueChange()\n }\n\n private _onOptionUpdate = () => {\n this._syncSelected()\n this._syncActiveOption()\n }\n\n private _handleOptionPointerOver = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n if (!this._isOpen || this._activeIndex < 0 || !(e.currentTarget instanceof HTMLElement)) return\n\n // 指针接管后只保留 :hover,避免键盘激活项与悬停项同时高亮。\n this._activeIndex = -1\n this._syncActiveOption()\n }\n\n private _handleOptionPointerDown = (e: PointerEvent) => {\n // 保持 trigger 焦点,避免 focusout 在 click 前关闭浮层。\n e.preventDefault()\n }\n\n // slotchange 不冒泡,只能由模板内 slot 自行监听;稳定引用避免 Lit 重挂载\n private _onSlotChange = () => {\n this._optionPortal.scheduleRefresh()\n }\n\n // slotchange/unregister 的刷新依赖 Lit 渲染调度;键盘或 click 事件可能先于其触发,\n // 已从 DOM 移除或被移出 Select/portal 面板的选项不得再被激活或选中。\n private _isLive(option: WebUiOption): boolean {\n const panel = this.portal ? this._panel.getPanel() : null\n return option.isConnected && (this.contains(option) || (!!panel && panel.contains(option)))\n }\n\n private _onKeydown = (e: KeyboardEvent) => {\n if (this._isDisabled) return\n\n switch (e.key) {\n case 'Escape':\n if (this._isOpen) {\n this._close()\n e.preventDefault()\n }\n break\n case 'ArrowDown':\n e.preventDefault()\n if (!this._isOpen) {\n this._open(true)\n } else {\n this._navigateActive(1)\n }\n break\n case 'ArrowUp':\n e.preventDefault()\n if (!this._isOpen) this._open(true)\n else this._navigateActive(-1)\n break\n case 'Enter': {\n if (this._isOpen && this._activeIndex >= 0) {\n const option = this._options[this._activeIndex]\n if (option && this._isLive(option) && !option.disabled) {\n this.value = option.value\n this._notifyValueChange()\n }\n this._close()\n e.preventDefault()\n }\n break\n }\n }\n }\n\n private _navigateActive(delta: number) {\n const enabled = this._options.filter(o => !o.disabled && this._isLive(o))\n if (!enabled.length) return\n\n const selectedOption = this._options.find(\n option => option.value === this.value && !option.disabled && this._isLive(option)\n )\n const currentIdx =\n this._activeIndex >= 0 && this._isLive(this._options[this._activeIndex])\n ? enabled.indexOf(this._options[this._activeIndex])\n : selectedOption\n ? enabled.indexOf(selectedOption)\n : delta > 0\n ? -1\n : 0\n const nextOption = enabled[nextWrappingIndex(enabled.length, currentIdx, delta)]\n this._activeIndex = this._options.indexOf(nextOption)\n\n this._syncActiveOption()\n }\n\n // 开合生命周期不变量(guard / 派发顺序 / scroll-lock 配对 / portal rAF dance)\n // 收敛在 shared combobox-shell;select 只注入差异点\n private readonly _openController = createComboboxOpenController({\n canOpen: () => !this._isDisabled,\n getIsOpen: () => this._isOpen,\n setIsOpen: open => {\n this._isOpen = open\n },\n dispatchOpenChange: () => this._dispatchOpenChange(),\n syncScrollLock: open => this._syncScrollLock(open),\n isPortal: () => this.portal,\n openOverlay: isKeyboardNavigation => this._openOverlay(isKeyboardNavigation),\n closeOverlay: () => void this._closeOverlay(),\n onOpen: isKeyboardNavigation => {\n this._syncSelected()\n if (isKeyboardNavigation) this._setInitialActiveOption()\n else this._syncActiveOption()\n },\n onAfterClose: () => {\n this._activeIndex = -1\n this._options.forEach(o => o.removeAttribute('active'))\n }\n })\n\n private _open(isKeyboardNavigation = false) {\n this._openController.open(isKeyboardNavigation)\n }\n\n private _close() {\n this._openController.close()\n }\n\n private _dispatchOpenChange() {\n dispatchOpenChangeEvent(this, this._isOpen)\n }\n\n private _setInitialActiveOption() {\n const selectedIndex = this._options.findIndex(\n option => option.value === this.value && !option.disabled && this._isLive(option)\n )\n const firstEnabledIndex = this._options.findIndex(option => !option.disabled && this._isLive(option))\n this._activeIndex = selectedIndex >= 0 ? selectedIndex : firstEnabledIndex\n this._syncActiveOption()\n }\n\n private _syncActiveOption() {\n this._options.forEach((option, index) =>\n option.toggleAttribute('active', index === this._activeIndex && this._isLive(option))\n )\n }\n\n private _notifyValueChange() {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private _syncScrollLock(isOpen = this._isOpen) {\n this._scrollLock.sync(isOpen && !this.noScrollLock)\n }\n\n private _togglePopup() {\n if (this._isDisabled) return\n if (this._isOpen) this._close()\n else this._open()\n }\n\n private _openOverlay(isKeyboardNavigation = false) {\n this._panel.open(isKeyboardNavigation)\n }\n\n private _createPortal(): OverlayPortal {\n const portal = defineOverlayPortal().make({\n container: this.overlayContainer,\n target: this,\n style: `${glass}\\n${overlayMotion}\\n${style}`,\n className: 'wui-glass select-overlay portal wui-floating-panel',\n onContentChange: () => this._optionPortal.scheduleRefresh()\n })\n this._portal = portal\n applyOverlayVariables(portal.panel, this, [\n '--wui-overlay-min-width',\n '--wui-select-max-width',\n '--wui-select-max-height'\n ])\n portal.panel.setAttribute('role', 'listbox')\n const scroll = document.createElement('div')\n scroll.className = 'select-scroll'\n const content = document.createElement('div')\n content.className = 'select-content'\n this._portalContent = content\n scroll.append(content)\n portal.panel.append(scroll)\n // 自定义 trigger 必须留在宿主内,不能随 options 迁入 portal 面板\n portal.moveContent(\n Array.from(this.children).filter(child => child.slot !== 'trigger'),\n content\n )\n return portal\n }\n\n private _reconfigureOverlay() {\n // reconfigure 会 dispose 并按需重建 portal,旧引用必须同步失效\n this._portal = undefined\n this._portalContent = undefined\n this._panel.reconfigure(this._isOpen)\n }\n\n private async _closeOverlay() {\n const closed = await this._panel.close(() => this._isOpen)\n // portal 已随关闭 dispose,与 autocomplete 对齐同步失效引用\n if (closed) {\n this._portal = undefined\n this._portalContent = undefined\n }\n }\n\n override render() {\n // portal 模式下 options 被 moveContent 移入浮层 shadow root,id 引用无法跨树作用域\n // 解析,因此 activedescendant 仅在非 portal 模式输出;aria-controls 同理指向同根内 listbox\n const listboxId = `${this.localName}-listbox`\n const activeDescendant =\n !this.portal && this._isOpen && this._activeIndex >= 0\n ? (this._options[this._activeIndex]?.id ?? nothing)\n : nothing\n\n return html`\n <div class=\"wui-select-inner\">\n <div\n class=\"wui-glass select-trigger\"\n ?data-custom-trigger=${this._hasTriggerSlot}\n @click=${this._togglePopup}\n tabindex=${this._isDisabled ? '-1' : '0'}\n role=\"combobox\"\n aria-expanded=${this._isOpen}\n aria-haspopup=\"listbox\"\n aria-controls=${this.portal ? nothing : listboxId}\n aria-disabled=${String(this._isDisabled)}\n aria-activedescendant=${activeDescendant}\n >\n <slot name=\"trigger\" @slotchange=${this._onTriggerSlotChange}></slot>\n ${!this._hasTriggerSlot ? html`<span class=\"label\">${this._selectedLabel}</span>` : nothing}\n <web-ui-icon class=\"arrow\" .icon=${lucideChevronDown}></web-ui-icon>\n </div>\n <div class=\"select-overlay wui-floating-panel wui-glass\" hidden role=\"listbox\" id=${listboxId}>\n <div class=\"select-scroll\">\n <div class=\"select-content\">\n <slot @slotchange=${this._onSlotChange}></slot>\n </div>\n </div>\n </div>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n 'open-change': CustomEvent<{ open: boolean }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-select': WebUiSelect\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,EAA+B;AAGxB,IAAM,IAAN,cAA0B,EAAe,CAAU,CAAC,CAAC;;;;;EA+TvB,aA5TsB,KAAA,cAAA,IACF,KAAA,WAAA,IACA,K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,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAwCxC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,mBAAA,KAAA,CAAA,GA1DR,IAAA,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport '@/components/option'\nimport glass from '@/assets/glass.css?inline'\nimport overlayMotion from '@/assets/overlay-motion.css?inline'\nimport type { WebUiOption } from '@/components/option'\nimport { lucideChevronDown } from '@/icons'\nimport { installPointerFocusSuppression } from '@/shared/focus/pointer-focus'\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { dispatchOpenChangeEvent } from '@/shared/open-state'\nimport {\n createComboboxOpenController,\n createOptionListenerBinding,\n handleComboboxFocusOut,\n nextWrappingIndex\n} from '@/shared/option-portal'\nimport { defineOptionPortal } from '@/shared/option-portal'\nimport { defineAnchoredPanel } from '@/shared/overlay/anchored-panel'\nimport { overlayComposition } from '@/shared/overlay/composition'\nimport { applyOverlayVariables, defineOverlayPortal } from '@/shared/overlay/portal'\nimport type { OverlayContainer, OverlayPortal } from '@/shared/overlay/portal'\nimport { defineScrollLockLease } from '@/shared/scroll-lock/scroll-lock'\n\nimport style from './style.css?inline'\n\ninstallPointerFocusSuppression()\n\n@customElement('web-ui-select')\nexport class WebUiSelect extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(overlayMotion), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) portal = false\n @property({ type: Boolean, reflect: true, attribute: 'no-scroll-lock' }) noScrollLock = false\n @property({ attribute: false }) overlayContainer?: OverlayContainer\n @property({ type: String, reflect: true }) name = ''\n\n // value 使用内部状态 + 访问器模式,在变更时同步 ElementInternals;\n // @property + reflect 让它与 input/textarea/slider/input-number 的 value 反射语义保持一致。\n @state() private _value = ''\n @property({ type: String, reflect: true })\n get value(): string {\n return this._value\n }\n set value(v: string) {\n const old = this._value\n this._value = v\n this._formAssociation.sync()\n this.toggleAttribute('data-has-value', !!v)\n this.requestUpdate('value', old)\n }\n\n private readonly _formAssociation = defineFormAssociation<string>({\n host: this,\n initialize: () => {\n // 同步 HTML 属性中预设的 value,补全访问器模式不处理 attribute 反射。\n const attrValue = this.getAttribute('value')\n if (attrValue !== null) {\n this._value = attrValue\n this.toggleAttribute('data-has-value', !!attrValue)\n }\n },\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 private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n @state() private _isOpen = false\n @state() private _activeIndex = -1\n @state() private _selectedLabel = ''\n @state() private _hasTriggerSlot = false\n\n private _options: WebUiOption[] = []\n private _portal?: OverlayPortal\n private _portalContent?: HTMLElement\n private readonly _scrollLock = defineScrollLockLease().make()\n\n private static _nextInstanceId = 0\n\n // option 注册表 / portal 同步 / 微任务调度收敛到 shared 模块(autocomplete 同款)\n private readonly _optionPortal = defineOptionPortal().make({\n element: this,\n // 实例级前缀保证多实例同时展开时 option id 不冲突(aria 引用按 id 定位)\n idPrefix: `web-ui-select-${++WebUiSelect._nextInstanceId}`,\n getPortal: () => this._portal,\n getPortalContent: () => this._portalContent,\n isOpen: () => this.portal && this._isOpen,\n getMigratableNodes: () => [...this.querySelectorAll<WebUiOption>('web-ui-option')],\n hasUpdated: () => this.hasUpdated,\n requestUpdate: () => this.requestUpdate(),\n bindOption: option => this._bindOption(option),\n unbindOption: option => this._unbindOption(option),\n onImmediateSync: () => {\n this._refreshOptions()\n this._syncSelected()\n this._syncActiveOption()\n }\n })\n private readonly _panel = defineAnchoredPanel().make({\n getAnchor: () => this.shadowRoot?.querySelector<HTMLElement>('.select-trigger') ?? null,\n getLocalPanel: () => this.shadowRoot?.querySelector<HTMLElement>('.select-overlay') ?? null,\n getPositioning: () => ({\n placement: 'bottom-start',\n offset: 4,\n // 面板宽度统一为 max(内容, trigger, --wui-overlay-min-width),内容自适应展开\n minAnchorWidth: true,\n strategy: this.portal ? 'fixed' : 'absolute'\n }),\n isPortal: () => this.portal,\n createPortal: () => this._createPortal()\n })\n\n get isOpen(): boolean {\n return this._isOpen\n }\n\n get open(): boolean {\n return this._isOpen\n }\n\n private _onClickOutside = (e: MouseEvent) => {\n const panel = this._panel.getPanel()\n const isInside = e.composedPath().includes(this) || (panel && overlayComposition.containsEvent(panel, e))\n if (this._isOpen && !isInside) {\n this._close()\n }\n }\n\n private _onFocusOut = () => {\n handleComboboxFocusOut(\n this,\n () => this._panel.getPanel(),\n () => this._isOpen,\n () => this._close()\n )\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this._optionPortal.bindHost()\n this.addEventListener('keydown', this._onKeydown)\n this.addEventListener('focusout', this._onFocusOut)\n document.addEventListener('click', this._onClickOutside)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this._optionPortal.dispose()\n this.removeEventListener('keydown', this._onKeydown)\n this.removeEventListener('focusout', this._onFocusOut)\n document.removeEventListener('click', this._onClickOutside)\n this._options.forEach(this._unbindOption)\n this._options = []\n this._portal = undefined\n this._portalContent = undefined\n this._close()\n this._panel.dispose()\n this._scrollLock.release()\n }\n\n override firstUpdated() {\n requestAnimationFrame(() => {\n if (this.isConnected) this._optionPortal.scheduleRefresh()\n })\n }\n\n override willUpdate() {\n this._refreshOptions()\n this._syncSelected()\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('portal') || changed.has('overlayContainer'))\n requestAnimationFrame(() => this._reconfigureOverlay())\n if (changed.has('noScrollLock')) this._syncScrollLock()\n this._syncOpenAttribute()\n this._syncValidity()\n }\n\n private _syncValidity() {\n const internals = this._formAssociation.getInternals()\n if (!internals || typeof internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this.value) internals.setValidity({})\n else internals.setValidity({ valueMissing: true }, '请选择一项')\n }\n\n private _syncOpenAttribute() {\n this.toggleAttribute('open', this._isOpen)\n }\n\n private _onTriggerSlotChange = (e: Event) => {\n const slot = e.target as HTMLSlotElement\n const hasContent = slot.assignedElements().length > 0\n if (this._hasTriggerSlot === hasContent) return\n this._hasTriggerSlot = hasContent\n this._reconfigureOverlay()\n }\n\n private _syncSelected() {\n this._options.forEach(o => {\n o.selected = o.value === this.value\n })\n if (!this.value) {\n this._selectedLabel = this.placeholder\n return\n }\n const option = this._options.find(o => o.value === this.value)\n this._selectedLabel = option?.label || this.placeholder\n }\n\n private readonly _optionListeners = createOptionListenerBinding({\n // 惰性解引用:handler 字段声明在后者仍可在调用期取到\n onClick: event => this._handleOptionClick(event),\n onPointerOver: event => this._handleOptionPointerOver(event),\n onPointerDown: event => this._handleOptionPointerDown(event),\n onUpdate: () => this._onOptionUpdate()\n })\n private _bindOption = (option: WebUiOption) => this._optionListeners.bind(option)\n private _unbindOption = (option: WebUiOption) => this._optionListeners.unbind(option)\n\n private _refreshOptions() {\n const activeOption = this._options[this._activeIndex]\n // diff 绑定/解绑与激活索引按 option 身份保持在 shared 内完成,\n // 避免移除中间项后激活静默偏移到相邻项\n const next = this._optionPortal.refresh(this._options, activeOption)\n this._options = next.options\n this._activeIndex = next.activeIndex\n // 非 portal 模式 aria-activedescendant 引用真实 option id,需保证已分配\n this._optionPortal.ensureOptionIds(this._options)\n }\n\n private _handleOptionClick = (e: Event) => {\n if (!(e.currentTarget instanceof HTMLElement)) return\n const option = e.currentTarget as WebUiOption\n if (option.disabled || !this._isLive(option)) return\n this.value = option.value\n this._close()\n this._notifyValueChange()\n }\n\n private _onOptionUpdate = () => {\n this._syncSelected()\n this._syncActiveOption()\n }\n\n private _handleOptionPointerOver = (e: PointerEvent) => {\n if (e.pointerType === 'touch') return\n if (!this._isOpen || this._activeIndex < 0 || !(e.currentTarget instanceof HTMLElement)) return\n\n // 指针接管后只保留 :hover,避免键盘激活项与悬停项同时高亮。\n this._activeIndex = -1\n this._syncActiveOption()\n }\n\n private _handleOptionPointerDown = (e: PointerEvent) => {\n // 保持 trigger 焦点,避免 focusout 在 click 前关闭浮层。\n e.preventDefault()\n }\n\n // slotchange 不冒泡,只能由模板内 slot 自行监听;稳定引用避免 Lit 重挂载\n private _onSlotChange = () => {\n this._optionPortal.scheduleRefresh()\n }\n\n // slotchange/unregister 的刷新依赖 Lit 渲染调度;键盘或 click 事件可能先于其触发,\n // 已从 DOM 移除或被移出 Select/portal 面板的选项不得再被激活或选中。\n private _isLive(option: WebUiOption): boolean {\n const panel = this.portal ? this._panel.getPanel() : null\n return option.isConnected && (this.contains(option) || (!!panel && panel.contains(option)))\n }\n\n private _onKeydown = (e: KeyboardEvent) => {\n if (this._isDisabled) return\n\n switch (e.key) {\n case 'Escape':\n if (this._isOpen) {\n this._close()\n e.preventDefault()\n }\n break\n case 'ArrowDown':\n e.preventDefault()\n if (!this._isOpen) {\n this._open(true)\n } else {\n this._navigateActive(1)\n }\n break\n case 'ArrowUp':\n e.preventDefault()\n if (!this._isOpen) this._open(true)\n else this._navigateActive(-1)\n break\n case 'Enter': {\n if (this._isOpen && this._activeIndex >= 0) {\n const option = this._options[this._activeIndex]\n if (option && this._isLive(option) && !option.disabled) {\n this.value = option.value\n this._notifyValueChange()\n }\n this._close()\n e.preventDefault()\n }\n break\n }\n }\n }\n\n private _navigateActive(delta: number) {\n const enabled = this._options.filter(o => !o.disabled && this._isLive(o))\n if (!enabled.length) return\n\n const selectedOption = this._options.find(\n option => option.value === this.value && !option.disabled && this._isLive(option)\n )\n const currentIdx =\n this._activeIndex >= 0 && this._isLive(this._options[this._activeIndex])\n ? enabled.indexOf(this._options[this._activeIndex])\n : selectedOption\n ? enabled.indexOf(selectedOption)\n : delta > 0\n ? -1\n : 0\n const nextOption = enabled[nextWrappingIndex(enabled.length, currentIdx, delta)]\n this._activeIndex = this._options.indexOf(nextOption)\n\n this._syncActiveOption()\n }\n\n // 开合生命周期不变量(guard / 派发顺序 / scroll-lock 配对 / portal rAF dance)\n // 收敛在 shared combobox-shell;select 只注入差异点\n private readonly _openController = createComboboxOpenController({\n canOpen: () => !this._isDisabled,\n getIsOpen: () => this._isOpen,\n setIsOpen: open => {\n this._isOpen = open\n },\n dispatchOpenChange: () => this._dispatchOpenChange(),\n syncScrollLock: open => this._syncScrollLock(open),\n isPortal: () => this.portal,\n openOverlay: isKeyboardNavigation => this._openOverlay(isKeyboardNavigation),\n closeOverlay: () => void this._closeOverlay(),\n onOpen: isKeyboardNavigation => {\n this._syncSelected()\n if (isKeyboardNavigation) this._setInitialActiveOption()\n else this._syncActiveOption()\n },\n onAfterClose: () => {\n this._activeIndex = -1\n this._options.forEach(o => o.removeAttribute('active'))\n }\n })\n\n private _open(isKeyboardNavigation = false) {\n this._openController.open(isKeyboardNavigation)\n }\n\n private _close() {\n this._openController.close()\n }\n\n private _dispatchOpenChange() {\n dispatchOpenChangeEvent(this, this._isOpen)\n }\n\n private _setInitialActiveOption() {\n const selectedIndex = this._options.findIndex(\n option => option.value === this.value && !option.disabled && this._isLive(option)\n )\n const firstEnabledIndex = this._options.findIndex(option => !option.disabled && this._isLive(option))\n this._activeIndex = selectedIndex >= 0 ? selectedIndex : firstEnabledIndex\n this._syncActiveOption()\n }\n\n private _syncActiveOption() {\n this._options.forEach((option, index) =>\n option.toggleAttribute('active', index === this._activeIndex && this._isLive(option))\n )\n }\n\n private _notifyValueChange() {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private _syncScrollLock(isOpen = this._isOpen) {\n this._scrollLock.sync(isOpen && !this.noScrollLock)\n }\n\n private _togglePopup() {\n if (this._isDisabled) return\n if (this._isOpen) this._close()\n else this._open()\n }\n\n private _openOverlay(isKeyboardNavigation = false) {\n this._panel.open(isKeyboardNavigation)\n }\n\n private _createPortal(): OverlayPortal {\n const portal = defineOverlayPortal().make({\n container: this.overlayContainer,\n target: this,\n style: `${glass}\\n${overlayMotion}\\n${style}`,\n className: 'wui-glass select-overlay portal wui-floating-panel',\n onContentChange: () => this._optionPortal.scheduleRefresh()\n })\n this._portal = portal\n applyOverlayVariables(portal.panel, this, [\n '--wui-overlay-min-width',\n '--wui-select-max-width',\n '--wui-select-max-height'\n ])\n portal.panel.setAttribute('role', 'listbox')\n const scroll = document.createElement('div')\n scroll.className = 'select-scroll'\n const content = document.createElement('div')\n content.className = 'select-content'\n this._portalContent = content\n scroll.append(content)\n portal.panel.append(scroll)\n // 自定义 trigger 必须留在宿主内,不能随 options 迁入 portal 面板\n portal.moveContent(\n Array.from(this.children).filter(child => child.slot !== 'trigger'),\n content\n )\n return portal\n }\n\n private _reconfigureOverlay() {\n // reconfigure 会 dispose 并按需重建 portal,旧引用必须同步失效\n this._portal = undefined\n this._portalContent = undefined\n this._panel.reconfigure(this._isOpen)\n }\n\n private async _closeOverlay() {\n const closed = await this._panel.close(() => this._isOpen)\n // portal 已随关闭 dispose,与 autocomplete 对齐同步失效引用\n if (closed) {\n this._portal = undefined\n this._portalContent = undefined\n }\n }\n\n override render() {\n // portal 模式下 options 被 moveContent 移入浮层 shadow root,id 引用无法跨树作用域\n // 解析,因此 activedescendant 仅在非 portal 模式输出;aria-controls 同理指向同根内 listbox\n const listboxId = `${this.localName}-listbox`\n const activeDescendant =\n !this.portal && this._isOpen && this._activeIndex >= 0\n ? (this._options[this._activeIndex]?.id ?? nothing)\n : nothing\n\n return html`\n <div class=\"wui-select-inner\">\n <div\n class=\"wui-glass select-trigger\"\n ?data-custom-trigger=${this._hasTriggerSlot}\n @click=${this._togglePopup}\n tabindex=${this._isDisabled ? '-1' : '0'}\n role=\"combobox\"\n aria-expanded=${this._isOpen}\n aria-haspopup=\"listbox\"\n aria-controls=${this.portal ? nothing : listboxId}\n aria-disabled=${String(this._isDisabled)}\n aria-activedescendant=${activeDescendant}\n >\n <slot name=\"trigger\" @slotchange=${this._onTriggerSlotChange}></slot>\n ${!this._hasTriggerSlot ? html`<span class=\"label\">${this._selectedLabel}</span>` : nothing}\n <web-ui-icon class=\"arrow\" .icon=${lucideChevronDown}></web-ui-icon>\n </div>\n <div class=\"select-overlay wui-floating-panel wui-glass\" hidden role=\"listbox\" id=${listboxId}>\n <div class=\"select-scroll\">\n <div class=\"select-content\">\n <slot @slotchange=${this._onSlotChange}></slot>\n </div>\n </div>\n </div>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n 'open-change': CustomEvent<{ open: boolean }>\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-select': WebUiSelect\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,EAA+B;AAGxB,IAAM,IAAN,cAA0B,EAAe,CAAU,CAAC,CAAC;;;;;EA+TvB,aA5TsB,KAAA,cAAA,IACF,KAAA,WAAA,IACA,KAAA,WAAA,IACF,KAAA,SAAA,IACmC,KAAA,eAAA,IAEtC,KAAA,OAAA,IAIxB,KAAA,SAAA,IAaU,KAAA,mBAAA,EAA8B;GAChE,MAAM;GACN,kBAAkB;IAEhB,IAAM,IAAY,KAAK,aAAa,OAAO;IAC3C,AAAI,MAAc,SAChB,KAAK,SAAS,GACd,KAAK,gBAAgB,kBAAkB,CAAC,CAAC,CAAS;GAEtD;GACA,gBAAgB,KAAK;GACrB,WAAU,M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A,GA1DR,IAAA,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/select/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{--wui-select-bg-hover:var(--wui-color-surface-glass-hover,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 6%, var(--wui-color-surface-glass,#fafafa57)));--wui-select-bg-active:var(--wui-color-surface-glass-active,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 15%, var(--wui-color-surface-glass,#fafafa57)));-webkit-user-select:none;user-select:none;display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-select-inner{flex-direction:column;display:flex;position:relative}.select-trigger{--wui-glass-corner-radius:calc(var(--wui-control-size,36px) / 2);cursor:default;box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-control-size,36px);height:var(--wui-control-size,36px);border-radius:var(--wui-radius-control,calc(infinity * 1px));border:none;align-items:center;gap:8px;padding:0 12px;display:flex;overflow:clip}.select-trigger:focus-visible{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,#08f6);outline-offset:2px}:host([disabled]) .select-trigger{cursor:not-allowed}@media (hover:hover) and (pointer:fine){:host(:not([disabled])) .select-trigger:hover{background-color:var(--wui-select-bg-hover)}}:host(:not([disabled])) .select-trigger:active,:host([open]:not([disabled])) .select-trigger{background-color:var(--wui-select-bg-active)}.select-trigger[data-custom-trigger]{width:auto}.label{font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([data-has-value])) .label{color:var(--wui-color-text-secondary,#6a6a6a)}::slotted([slot=trigger]){font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.arrow{color:var(--wui-color-text-secondary,#6a6a6a);flex-shrink:0}:host([open]) .arrow{transform:rotate(180deg)}.select-overlay{--wui-internal-glass-shadow:var(--wui-shadow-panel,0 3px 9px #00000045);--wui-internal-duration-float-enter:var(--wui-duration-float-enter,.16s);--wui-internal-duration-float-exit:var(--wui-duration-float-exit,.12s);--wui-glass-corner-radius:var(--wui-radius-menu,18px);z-index:var(--wui-layer-inline-overlay,1);box-sizing:border-box;min-width:var(--wui-overlay-min-width,200px);max-width:var(--wui-select-max-width,500px);border-radius:var(--wui-radius-menu,18px);background-color:var(--wui-color-surface-menu,#f6f6f6d1);position:absolute;overflow:hidden}.select-overlay.portal{z-index:var(--wui-layer-menu,100);position:fixed}.select-overlay.hidden{display:none}.select-scroll{max-height:var(--wui-select-max-height,200px);overflow-y:auto}.select-content{padding:4px}:host([portal]) .select-overlay{display:none}:host([data-wui-pointer-focus]) .select-trigger:focus-visible{outline-color:#0000}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{--wui-select-bg-hover:var(--wui-color-surface-glass-hover,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 6%, var(--wui-color-surface-glass,#fafafa57)));--wui-select-bg-active:var(--wui-color-surface-glass-active,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 15%, var(--wui-color-surface-glass,#fafafa57)));-webkit-user-select:none;user-select:none;display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-select-inner{flex-direction:column;display:flex;position:relative}.select-trigger{--wui-glass-corner-radius:calc(var(--wui-control-size,36px) / 2);cursor:default;box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-control-size,36px);height:var(--wui-control-size,36px);border-radius:var(--wui-radius-control,calc(infinity * 1px));border:none;align-items:center;gap:8px;padding:0 12px;display:flex;overflow:clip}.select-trigger:focus-visible{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,#08f6);outline-offset:2px}:host([disabled]) .select-trigger{cursor:not-allowed}@media (hover:hover) and (pointer:fine){:host(:not([disabled])) .select-trigger:hover{background-color:var(--wui-select-bg-hover)}}:host(:not([disabled])) .select-trigger:active,:host([open]:not([disabled])) .select-trigger{background-color:var(--wui-select-bg-active)}.select-trigger[data-custom-trigger]{width:auto}.label{font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:host(:not([data-has-value])) .label{color:var(--wui-color-text-secondary,#6a6a6a)}::slotted([slot=trigger]){font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.arrow{color:var(--wui-color-text-secondary,#6a6a6a);flex-shrink:0}:host([open]) .arrow{transform:rotate(180deg)}.select-overlay{--wui-internal-glass-shadow:var(--wui-shadow-panel,0 3px 9px #00000045);--wui-internal-duration-float-enter:var(--wui-duration-float-enter,.24s);--wui-internal-duration-float-exit:var(--wui-duration-float-exit,.16s);--wui-glass-corner-radius:var(--wui-radius-menu,18px);z-index:var(--wui-layer-inline-overlay,1);box-sizing:border-box;min-width:var(--wui-overlay-min-width,200px);max-width:var(--wui-select-max-width,500px);border-radius:var(--wui-radius-menu,18px);background-color:var(--wui-color-surface-menu,#f6f6f6d1);position:absolute;overflow:hidden}.select-overlay.portal{z-index:var(--wui-layer-menu,100);position:fixed}.select-overlay.hidden{display:none}.select-scroll{max-height:var(--wui-select-max-height,200px);overflow-y:auto}.select-content{padding:4px}:host([portal]) .select-overlay{display:none}:host([data-wui-pointer-focus]) .select-trigger:focus-visible{outline-color:#0000}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/select/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-select-bg-hover: var(\n --wui-color-surface-glass-hover,\n color-mix(in srgb, var(--wui-color-text, #1b1b1b) 6%, var(--wui-color-surface-glass, rgb(250 250 250 / 0.34)))\n );\n --wui-select-bg-active: var(\n --wui-color-surface-glass-active,\n color-mix(in srgb, var(--wui-color-text, #1b1b1b) 15%, var(--wui-color-surface-glass, rgb(250 250 250 / 0.34)))\n );\n user-select: none;\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-select-inner {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.select-trigger {\n --wui-glass-corner-radius: calc(var(--wui-control-size, 36px) / 2);\n\n cursor: default;\n\n overflow: clip;\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-control-size, 36px);\n height: var(--wui-control-size, 36px);\n padding: 0 12px;\n border: none;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n &:focus-visible {\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}\n\n:host([disabled]) .select-trigger {\n cursor: not-allowed;\n}\n\n@media (hover: hover) and (pointer: fine) {\n :host(:not([disabled])) .select-trigger:hover {\n background-color: var(--wui-select-bg-hover);\n }\n}\n\n:host(:not([disabled])) .select-trigger:active,\n:host([open]:not([disabled])) .select-trigger {\n background-color: var(--wui-select-bg-active);\n}\n\n.select-trigger[data-custom-trigger] {\n width: auto;\n}\n\n.label {\n overflow: hidden;\n flex: 1;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(:not([data-has-value])) .label {\n color: var(--wui-color-text-secondary, #6a6a6a);\n}\n\n::slotted([slot='trigger']) {\n overflow: hidden;\n flex: 1;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.arrow {\n flex-shrink: 0;\n color: var(--wui-color-text-secondary, #6a6a6a);\n}\n\n:host([open]) .arrow {\n transform: rotate(180deg);\n}\n\n/* ===== 浮层(glass 样式参考 dialog) ===== */\n\n.select-overlay {\n --wui-internal-glass-shadow: var(--wui-shadow-panel, 0 3px 9px rgb(0 0 0 / 0.27));\n --wui-internal-duration-float-enter: var(--wui-duration-float-enter, 160ms);\n --wui-internal-duration-float-exit: var(--wui-duration-float-exit, 120ms);\n --wui-glass-corner-radius: var(--wui-radius-menu, 18px);\n position: absolute;\n z-index: var(--wui-layer-inline-overlay, 1);\n\n overflow: hidden;\n\n box-sizing: border-box;\n min-width: var(--wui-overlay-min-width, 200px);\n max-width: var(--wui-select-max-width, 500px);\n border-radius: var(--wui-radius-menu, 18px);\n\n /* 玻璃背景:wui-glass 在面板自身,这里覆盖其默认玻璃底为菜单表面色 */\n background-color: var(--wui-color-surface-menu, rgb(246 246 246 / 0.82));\n\n &.portal {\n position: fixed;\n z-index: var(--wui-layer-menu, 100);\n }\n\n &.hidden {\n display: none;\n }\n}\n\n.select-scroll {\n overflow-y: auto;\n max-height: var(--wui-select-max-height, 200px);\n}\n\n.select-content {\n padding: 4px;\n}\n\n:host([portal]) .select-overlay {\n display: none;\n}\n\n:host([data-wui-pointer-focus]) .select-trigger:focus-visible {\n outline-color: transparent;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/select/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-select-bg-hover: var(\n --wui-color-surface-glass-hover,\n color-mix(in srgb, var(--wui-color-text, #1b1b1b) 6%, var(--wui-color-surface-glass, rgb(250 250 250 / 0.34)))\n );\n --wui-select-bg-active: var(\n --wui-color-surface-glass-active,\n color-mix(in srgb, var(--wui-color-text, #1b1b1b) 15%, var(--wui-color-surface-glass, rgb(250 250 250 / 0.34)))\n );\n user-select: none;\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-select-inner {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\n.select-trigger {\n --wui-glass-corner-radius: calc(var(--wui-control-size, 36px) / 2);\n\n cursor: default;\n\n overflow: clip;\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-control-size, 36px);\n height: var(--wui-control-size, 36px);\n padding: 0 12px;\n border: none;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n &:focus-visible {\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}\n\n:host([disabled]) .select-trigger {\n cursor: not-allowed;\n}\n\n@media (hover: hover) and (pointer: fine) {\n :host(:not([disabled])) .select-trigger:hover {\n background-color: var(--wui-select-bg-hover);\n }\n}\n\n:host(:not([disabled])) .select-trigger:active,\n:host([open]:not([disabled])) .select-trigger {\n background-color: var(--wui-select-bg-active);\n}\n\n.select-trigger[data-custom-trigger] {\n width: auto;\n}\n\n.label {\n overflow: hidden;\n flex: 1;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(:not([data-has-value])) .label {\n color: var(--wui-color-text-secondary, #6a6a6a);\n}\n\n::slotted([slot='trigger']) {\n overflow: hidden;\n flex: 1;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.arrow {\n flex-shrink: 0;\n color: var(--wui-color-text-secondary, #6a6a6a);\n}\n\n:host([open]) .arrow {\n transform: rotate(180deg);\n}\n\n/* ===== 浮层(glass 样式参考 dialog) ===== */\n\n.select-overlay {\n --wui-internal-glass-shadow: var(--wui-shadow-panel, 0 3px 9px rgb(0 0 0 / 0.27));\n --wui-internal-duration-float-enter: var(--wui-duration-float-enter, 240ms);\n --wui-internal-duration-float-exit: var(--wui-duration-float-exit, 160ms);\n --wui-glass-corner-radius: var(--wui-radius-menu, 18px);\n position: absolute;\n z-index: var(--wui-layer-inline-overlay, 1);\n\n overflow: hidden;\n\n box-sizing: border-box;\n min-width: var(--wui-overlay-min-width, 200px);\n max-width: var(--wui-select-max-width, 500px);\n border-radius: var(--wui-radius-menu, 18px);\n\n /* 玻璃背景:wui-glass 在面板自身,这里覆盖其默认玻璃底为菜单表面色 */\n background-color: var(--wui-color-surface-menu, rgb(246 246 246 / 0.82));\n\n &.portal {\n position: fixed;\n z-index: var(--wui-layer-menu, 100);\n }\n\n &.hidden {\n display: none;\n }\n}\n\n.select-scroll {\n overflow-y: auto;\n max-height: var(--wui-select-max-height, 200px);\n}\n\n.select-content {\n padding: 4px;\n}\n\n:host([portal]) .select-overlay {\n display: none;\n}\n\n:host([data-wui-pointer-focus]) .select-trigger:focus-visible {\n outline-color: transparent;\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import t from "../../assets/glass.js";
3
3
  import { FormAssociated as n, FormAssociationController as r, defineFormAssociation as i } from "../../shared/form-association/index.js";
4
4
  import { normalizeNumber as a } from "../../shared/normalize/index.js";
@@ -1,5 +1,5 @@
1
1
  //#region src/components/slider/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{touch-action:none;width:var(--wui-slider-width,200px);display:inline-block}:host([vertical]){width:auto;height:var(--wui-slider-vertical-height,200px)}:host([disabled]){cursor:not-allowed}.wui-slider-track{touch-action:none;cursor:default;-webkit-user-select:none;user-select:none;width:100%;height:var(--wui-slider-height,var(--wui-slider-track-size,6px));border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-track,#e5e5ea);position:relative}.wui-slider-track:focus-visible{outline-color:var(--wui-color-focus-ring,#08f6)}.wui-slider-track.is-disabled{cursor:not-allowed;opacity:.38}.wui-slider-track.is-dragging{cursor:grabbing}:host([vertical]) .wui-slider-track{touch-action:none;width:var(--wui-slider-height,var(--wui-slider-track-size,6px));height:100%}.wui-slider-progress{z-index:1;width:var(--percent);border-radius:inherit;background-color:var(--wui-color-accent,#08f);position:absolute;top:0;bottom:0;left:0}:host([vertical]) .wui-slider-progress{width:100%;height:var(--percent);top:auto;bottom:0}.wui-slider-marks{pointer-events:none;z-index:2;top:calc(100% + 2px);right:var(--wui-slider-marks-inset,0);left:var(--wui-slider-marks-inset,0);height:4px;margin-left:2px;margin-right:2px;position:absolute}:host([vertical]) .wui-slider-marks{top:var(--wui-slider-marks-inset,0);right:auto;bottom:var(--wui-slider-marks-inset,0);width:4px;height:auto;margin:2px 0;left:calc(100% + 2px)}.wui-slider-mark{top:0;left:var(--percent);border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-track,#e5e5ea);width:4px;height:4px;position:absolute;transform:translate(-50%)}:host([vertical]) .wui-slider-mark{top:auto;bottom:var(--percent);left:50%;transform:translate(-50%,50%)}.wui-slider-thumb{--wui-glass-corner-radius:var(--wui-slider-thumb-radius,8px);cursor:inherit;z-index:3;top:50%;left:var(--percent);transform-origin:50%;width:var(--wui-slider-thumb-width,24px);height:var(--wui-slider-thumb-height,18px);border-radius:var(--wui-slider-thumb-radius,8px);transition:transform var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) ease, box-shadow var(--wui-duration-press,80ms) ease;position:absolute;transform:translate(-50%,-50%)scale(1)}.wui-slider-thumb:not(.is-dragging){background-color:var(--wui-color-on-control,#fff)}.wui-slider-thumb.is-pressed:not(.is-dragging){background-color:var(--wui-color-surface-glass,#fafafa57);box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 2px 10px #00000047, 0 10px 28px #0000003d, 0 18px 44px #00000029;transform:translate(-50%,-50%)scale(1.5)}.wui-slider-thumb.is-dragging{cursor:grabbing;box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 2px 10px #00000047, 0 10px 28px #0000003d, 0 18px 44px #00000029;background-color:#0000;transform:translate(-50%,-50%)scale(1.5)}:host([vertical]) .wui-slider-thumb{top:auto;bottom:var(--percent);left:50%;transform:translate(-50%,50%)scale(1)}:host([vertical]) .wui-slider-thumb.is-pressed:not(.is-dragging),:host([vertical]) .wui-slider-thumb.is-dragging{transform:translate(-50%,50%)scale(1.5)}:host([data-wui-pointer-focus]) .wui-slider-track:focus-visible{outline-color:#0000}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{touch-action:none;width:var(--wui-slider-width,200px);display:inline-block}:host([vertical]){width:auto;height:var(--wui-slider-vertical-height,200px)}:host([disabled]){cursor:not-allowed}.wui-slider-track{touch-action:none;cursor:default;-webkit-user-select:none;user-select:none;width:100%;height:var(--wui-slider-height,var(--wui-slider-track-size,6px));border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-track,#e5e5ea);position:relative}.wui-slider-track:focus-visible{outline-color:var(--wui-color-focus-ring,#08f6)}.wui-slider-track.is-disabled{cursor:not-allowed;opacity:.38}.wui-slider-track.is-dragging{cursor:grabbing}:host([vertical]) .wui-slider-track{touch-action:none;width:var(--wui-slider-height,var(--wui-slider-track-size,6px));height:100%}.wui-slider-progress{z-index:1;width:var(--percent);border-radius:inherit;background-color:var(--wui-color-accent,#08f);position:absolute;top:0;bottom:0;left:0}:host([vertical]) .wui-slider-progress{width:100%;height:var(--percent);top:auto;bottom:0}.wui-slider-marks{pointer-events:none;z-index:2;top:calc(100% + 2px);right:var(--wui-slider-marks-inset,0);left:var(--wui-slider-marks-inset,0);height:4px;margin-left:2px;margin-right:2px;position:absolute}:host([vertical]) .wui-slider-marks{top:var(--wui-slider-marks-inset,0);right:auto;bottom:var(--wui-slider-marks-inset,0);width:4px;height:auto;margin:2px 0;left:calc(100% + 2px)}.wui-slider-mark{top:0;left:var(--percent);border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-track,#e5e5ea);width:4px;height:4px;position:absolute;transform:translate(-50%)}:host([vertical]) .wui-slider-mark{top:auto;bottom:var(--percent);left:50%;transform:translate(-50%,50%)}.wui-slider-thumb{--wui-glass-corner-radius:var(--wui-slider-thumb-radius,8px);cursor:inherit;z-index:3;top:50%;left:var(--percent);transform-origin:50%;width:var(--wui-slider-thumb-width,24px);height:var(--wui-slider-thumb-height,18px);border-radius:var(--wui-slider-thumb-radius,8px);transition:transform var(--wui-duration-press,80ms) cubic-bezier(.4, 0, .2, 1), background-color var(--wui-duration-press,80ms) ease, box-shadow var(--wui-duration-press,80ms) ease;position:absolute;transform:translate(-50%,-50%)scale(1)}.wui-slider-thumb:not(.is-dragging){background-color:var(--wui-color-on-control,#fff)}.wui-slider-thumb.is-pressed:not(.is-dragging){background-color:var(--wui-color-surface-glass,#fafafa57);box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 2px 20px #0003;transform:translate(-50%,-50%)scale(1.5)}.wui-slider-thumb.is-dragging{cursor:grabbing;box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 2px 20px #0003;background-color:#0000;transform:translate(-50%,-50%)scale(1.5)}:host([vertical]) .wui-slider-thumb{top:auto;bottom:var(--percent);left:50%;transform:translate(-50%,50%)scale(1)}:host([vertical]) .wui-slider-thumb.is-pressed:not(.is-dragging),:host([vertical]) .wui-slider-thumb.is-dragging{transform:translate(-50%,50%)scale(1.5)}:host([data-wui-pointer-focus]) .wui-slider-track:focus-visible{outline-color:#0000}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/slider/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n touch-action: none;\n display: inline-block;\n width: var(--wui-slider-width, 200px);\n}\n\n:host([vertical]) {\n width: auto;\n height: var(--wui-slider-vertical-height, 200px);\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n.wui-slider-track {\n touch-action: none;\n cursor: default;\n user-select: none;\n\n position: relative;\n\n width: 100%;\n height: var(--wui-slider-height, var(--wui-slider-track-size, 6px));\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: var(--wui-color-surface-track, #e5e5ea);\n\n &:focus-visible {\n outline-color: var(--wui-color-focus-ring, rgb(0 136 255 / 0.4));\n }\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.38;\n }\n\n &.is-dragging {\n cursor: grabbing;\n }\n}\n\n:host([vertical]) .wui-slider-track {\n touch-action: none;\n width: var(--wui-slider-height, var(--wui-slider-track-size, 6px));\n height: 100%;\n}\n\n.wui-slider-progress {\n position: absolute;\n z-index: 1;\n top: 0;\n bottom: 0;\n left: 0;\n\n width: var(--percent);\n border-radius: inherit;\n\n background-color: var(--wui-color-accent, #08f);\n}\n\n:host([vertical]) .wui-slider-progress {\n top: auto;\n bottom: 0;\n width: 100%;\n height: var(--percent);\n}\n\n.wui-slider-marks {\n pointer-events: none;\n\n position: absolute;\n z-index: 2;\n top: calc(100% + 2px);\n right: var(--wui-slider-marks-inset, 0);\n left: var(--wui-slider-marks-inset, 0);\n\n height: 4px;\n margin-right: 2px;\n margin-left: 2px;\n}\n\n:host([vertical]) .wui-slider-marks {\n top: var(--wui-slider-marks-inset, 0);\n right: auto;\n bottom: var(--wui-slider-marks-inset, 0);\n left: calc(100% + 2px);\n\n width: 4px;\n height: auto;\n margin: 2px 0;\n}\n\n.wui-slider-mark {\n position: absolute;\n top: 0;\n left: var(--percent);\n transform: translateX(-50%);\n\n width: 4px;\n height: 4px;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: var(--wui-color-surface-track, #e5e5ea);\n}\n\n:host([vertical]) .wui-slider-mark {\n top: auto;\n bottom: var(--percent);\n left: 50%;\n transform: translate(-50%, 50%);\n}\n\n.wui-slider-thumb {\n --wui-glass-corner-radius: var(--wui-slider-thumb-radius, 8px);\n\n cursor: inherit;\n\n position: absolute;\n z-index: 3;\n top: 50%;\n left: var(--percent);\n transform-origin: center center;\n transform: translate(-50%, -50%) scale(1);\n\n width: var(--wui-slider-thumb-width, 24px);\n height: var(--wui-slider-thumb-height, 18px);\n border-radius: var(--wui-slider-thumb-radius, 8px);\n\n transition:\n transform var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) ease,\n box-shadow var(--wui-duration-press, 80ms) ease;\n\n /* 静止态实体白 thumb(wui-glass 恒开仅提供描边/高光,背景被白色覆盖);\n 按压时切到半透明玻璃背景并放大 1.5x,拖拽时背景转透明让 backdrop blur 透出。\n box-shadow 直接写死值(不经自定义属性中转):iOS Safari 对 var 离散切换驱动的\n box-shadow 不触发过渡且可能整体不生效(r2 真机「回退之前」的根因),直接写值\n 后是普通属性变化,transition 正常插值;同时复制 wui-glass 的三条 inset 高光,\n 避免整段覆盖后按压态丢失玻璃描边。 */\n &:not(.is-dragging) {\n background-color: var(--wui-color-on-control, #fff);\n }\n\n &.is-pressed:not(.is-dragging) {\n transform: translate(-50%, -50%) scale(1.5);\n background-color: var(--wui-color-surface-glass, rgb(250 250 250 / 0.34));\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 2px 10px rgb(0 0 0 / 0.28),\n 0 10px 28px rgb(0 0 0 / 0.24),\n 0 18px 44px rgb(0 0 0 / 0.16);\n }\n\n &.is-dragging {\n cursor: grabbing;\n transform: translate(-50%, -50%) scale(1.5);\n background-color: transparent;\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 2px 10px rgb(0 0 0 / 0.28),\n 0 10px 28px rgb(0 0 0 / 0.24),\n 0 18px 44px rgb(0 0 0 / 0.16);\n }\n}\n\n:host([vertical]) .wui-slider-thumb {\n top: auto;\n bottom: var(--percent);\n left: 50%;\n transform: translate(-50%, 50%) scale(1);\n\n &.is-pressed:not(.is-dragging) {\n transform: translate(-50%, 50%) scale(1.5);\n }\n\n &.is-dragging {\n transform: translate(-50%, 50%) scale(1.5);\n }\n}\n\n:host([data-wui-pointer-focus]) .wui-slider-track:focus-visible {\n outline-color: transparent;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/slider/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n touch-action: none;\n display: inline-block;\n width: var(--wui-slider-width, 200px);\n}\n\n:host([vertical]) {\n width: auto;\n height: var(--wui-slider-vertical-height, 200px);\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n.wui-slider-track {\n touch-action: none;\n cursor: default;\n user-select: none;\n\n position: relative;\n\n width: 100%;\n height: var(--wui-slider-height, var(--wui-slider-track-size, 6px));\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: var(--wui-color-surface-track, #e5e5ea);\n\n &:focus-visible {\n outline-color: var(--wui-color-focus-ring, rgb(0 136 255 / 0.4));\n }\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.38;\n }\n\n &.is-dragging {\n cursor: grabbing;\n }\n}\n\n:host([vertical]) .wui-slider-track {\n touch-action: none;\n width: var(--wui-slider-height, var(--wui-slider-track-size, 6px));\n height: 100%;\n}\n\n.wui-slider-progress {\n position: absolute;\n z-index: 1;\n top: 0;\n bottom: 0;\n left: 0;\n\n width: var(--percent);\n border-radius: inherit;\n\n background-color: var(--wui-color-accent, #08f);\n}\n\n:host([vertical]) .wui-slider-progress {\n top: auto;\n bottom: 0;\n width: 100%;\n height: var(--percent);\n}\n\n.wui-slider-marks {\n pointer-events: none;\n\n position: absolute;\n z-index: 2;\n top: calc(100% + 2px);\n right: var(--wui-slider-marks-inset, 0);\n left: var(--wui-slider-marks-inset, 0);\n\n height: 4px;\n margin-right: 2px;\n margin-left: 2px;\n}\n\n:host([vertical]) .wui-slider-marks {\n top: var(--wui-slider-marks-inset, 0);\n right: auto;\n bottom: var(--wui-slider-marks-inset, 0);\n left: calc(100% + 2px);\n\n width: 4px;\n height: auto;\n margin: 2px 0;\n}\n\n.wui-slider-mark {\n position: absolute;\n top: 0;\n left: var(--percent);\n transform: translateX(-50%);\n\n width: 4px;\n height: 4px;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: var(--wui-color-surface-track, #e5e5ea);\n}\n\n:host([vertical]) .wui-slider-mark {\n top: auto;\n bottom: var(--percent);\n left: 50%;\n transform: translate(-50%, 50%);\n}\n\n.wui-slider-thumb {\n --wui-glass-corner-radius: var(--wui-slider-thumb-radius, 8px);\n\n cursor: inherit;\n\n position: absolute;\n z-index: 3;\n top: 50%;\n left: var(--percent);\n transform-origin: center center;\n transform: translate(-50%, -50%) scale(1);\n\n width: var(--wui-slider-thumb-width, 24px);\n height: var(--wui-slider-thumb-height, 18px);\n border-radius: var(--wui-slider-thumb-radius, 8px);\n\n transition:\n transform var(--wui-duration-press, 80ms) cubic-bezier(0.4, 0, 0.2, 1),\n background-color var(--wui-duration-press, 80ms) ease,\n box-shadow var(--wui-duration-press, 80ms) ease;\n\n /* 静止态实体白 thumb(wui-glass 恒开仅提供描边/高光,背景被白色覆盖);\n 按压时切到半透明玻璃背景并放大 1.5x,拖拽时背景转透明让 backdrop blur 透出。\n box-shadow 直接写死值(不经自定义属性中转):iOS Safari 对 var 离散切换驱动的\n box-shadow 不触发过渡且可能整体不生效(r2 真机「回退之前」的根因),直接写值\n 后是普通属性变化,transition 正常插值;同时复制 wui-glass 的三条 inset 高光,\n 避免整段覆盖后按压态丢失玻璃描边。 */\n &:not(.is-dragging) {\n background-color: var(--wui-color-on-control, #fff);\n }\n\n &.is-pressed:not(.is-dragging) {\n transform: translate(-50%, -50%) scale(1.5);\n background-color: var(--wui-color-surface-glass, rgb(250 250 250 / 0.34));\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 2px 20px rgb(0 0 0 / 0.2);\n }\n\n &.is-dragging {\n cursor: grabbing;\n transform: translate(-50%, -50%) scale(1.5);\n background-color: transparent;\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 2px 20px rgb(0 0 0 / 0.2);\n }\n}\n\n:host([vertical]) .wui-slider-thumb {\n top: auto;\n bottom: var(--percent);\n left: 50%;\n transform: translate(-50%, 50%) scale(1);\n\n &.is-pressed:not(.is-dragging) {\n transform: translate(-50%, 50%) scale(1.5);\n }\n\n &.is-dragging {\n transform: translate(-50%, 50%) scale(1.5);\n }\n}\n\n:host([data-wui-pointer-focus]) .wui-slider-track:focus-visible {\n outline-color: transparent;\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import t from "./style.js";
3
3
  import { LitElement as n, html as r, nothing as i, unsafeCSS as a } from "lit";
4
4
  import { customElement as o, property as s } from "lit/decorators.js";
@@ -34,7 +34,7 @@ var l, u = 8, d = class extends n {
34
34
  let e = r`
35
35
  <div class="wui-spinner">
36
36
  ${c(Array.from({ length: u }, (e, t) => t), (e) => r`<span
37
- style="transform:rotate(${e * 45}deg);animation-delay:calc(-${u - e} / ${u} * 0.8s)"
37
+ style="transform:rotate(${e * 45}deg);animation-delay:calc(-${u - e} / ${u} * var(--wui-duration-spinner, 800ms))"
38
38
  ></span>`)}
39
39
  </div>
40
40
  ${this.description ? r`<div class="spinner-description">${this.description}</div>` : i}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/spinner/index.ts"],"sourcesContent":["import { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\n\nimport style from './style.css?inline'\n\nconst LEAF_COUNT = 8\n\n@customElement('web-ui-spinner')\nexport class WebUiSpinner extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: Number, reflect: true }) size = 24\n @property({ type: String }) description = ''\n\n // 自动创建并挂载全屏实例。\n static show(options?: { size?: number; duration?: number; description?: string }): WebUiSpinner {\n const el = document.createElement('web-ui-spinner')\n el._imperative = true\n if (options?.size) el.size = options.size\n if (options?.description) el.description = options.description\n document.body.appendChild(el)\n if (options?.duration && options.duration > 0) {\n el._timer = window.setTimeout(() => WebUiSpinner.hide(), options.duration)\n }\n return el\n }\n\n // 销毁由 show() 挂载的全屏实例。\n static hide() {\n if (WebUiSpinner._current?._timer) {\n clearTimeout(WebUiSpinner._current._timer)\n WebUiSpinner._current._timer = undefined\n }\n WebUiSpinner._current?.remove()\n WebUiSpinner._current = undefined\n }\n\n /** @internal 当前命令式实例 */\n static _current?: WebUiSpinner\n\n /** @internal */\n _imperative = false\n /** @internal */\n _timer?: ReturnType<typeof setTimeout>\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'status')\n }\n if (!this.hasAttribute('aria-label')) {\n this.setAttribute('aria-label', '加载中')\n }\n if (this._imperative) {\n WebUiSpinner._current?.remove()\n WebUiSpinner._current = this\n this.classList.add('wui-spinner-overlay')\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n if (this._timer) {\n clearTimeout(this._timer)\n this._timer = undefined\n }\n }\n\n protected override updated(props: PropertyValues) {\n super.updated(props)\n if (props.has('size')) {\n this.style.setProperty('--wui-spinner-size', `${this.size}px`)\n }\n }\n\n override render() {\n const spinner = html`\n <div class=\"wui-spinner\">\n ${repeat(\n Array.from({ length: LEAF_COUNT }, (_, i) => i),\n i =>\n html`<span\n style=\"transform:rotate(${i * 45}deg);animation-delay:calc(-${LEAF_COUNT - i} / ${LEAF_COUNT} * 0.8s)\"\n ></span>`\n )}\n </div>\n ${this.description ? html`<div class=\"spinner-description\">${this.description}</div>` : nothing}\n <slot name=\"description\"></slot>\n `\n return this._imperative ? html`<div class=\"wui-spinner-overlay\">${spinner}</div>` : spinner\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-spinner': WebUiSpinner\n }\n}\n"],"mappings":";;;;;;OAMM,IAAa,GAGN,IAAN,cAA2B,EAAW;;;;;EAiC7B,aA9BoC,KAAA,OAAA,IACR,KAAA,cAAA,IA6B5B,KAAA,cAAA;;;EAhCW,KAAA,SAAA,EAAU,CAAK;;CAMxC,OAAO,KAAK,GAAo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UAAU;CACtF;AACF;AAhFG,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,eAAA,KAAA,CAAA,GAL3B,IAAA,IAAA,EAAA,CAAA,EAAc,gBAAgB,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/spinner/index.ts"],"sourcesContent":["import { html, LitElement, nothing, type PropertyValues, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\n\nimport style from './style.css?inline'\n\nconst LEAF_COUNT = 8\n\n@customElement('web-ui-spinner')\nexport class WebUiSpinner extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: Number, reflect: true }) size = 24\n @property({ type: String }) description = ''\n\n // 自动创建并挂载全屏实例。\n static show(options?: { size?: number; duration?: number; description?: string }): WebUiSpinner {\n const el = document.createElement('web-ui-spinner')\n el._imperative = true\n if (options?.size) el.size = options.size\n if (options?.description) el.description = options.description\n document.body.appendChild(el)\n if (options?.duration && options.duration > 0) {\n el._timer = window.setTimeout(() => WebUiSpinner.hide(), options.duration)\n }\n return el\n }\n\n // 销毁由 show() 挂载的全屏实例。\n static hide() {\n if (WebUiSpinner._current?._timer) {\n clearTimeout(WebUiSpinner._current._timer)\n WebUiSpinner._current._timer = undefined\n }\n WebUiSpinner._current?.remove()\n WebUiSpinner._current = undefined\n }\n\n /** @internal 当前命令式实例 */\n static _current?: WebUiSpinner\n\n /** @internal */\n _imperative = false\n /** @internal */\n _timer?: ReturnType<typeof setTimeout>\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'status')\n }\n if (!this.hasAttribute('aria-label')) {\n this.setAttribute('aria-label', '加载中')\n }\n if (this._imperative) {\n WebUiSpinner._current?.remove()\n WebUiSpinner._current = this\n this.classList.add('wui-spinner-overlay')\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n if (this._timer) {\n clearTimeout(this._timer)\n this._timer = undefined\n }\n }\n\n protected override updated(props: PropertyValues) {\n super.updated(props)\n if (props.has('size')) {\n this.style.setProperty('--wui-spinner-size', `${this.size}px`)\n }\n }\n\n override render() {\n const spinner = html`\n <div class=\"wui-spinner\">\n ${repeat(\n Array.from({ length: LEAF_COUNT }, (_, i) => i),\n i =>\n html`<span\n style=\"transform:rotate(${i * 45}deg);animation-delay:calc(-${LEAF_COUNT - i} / ${LEAF_COUNT} * var(--wui-duration-spinner, 800ms))\"\n ></span>`\n )}\n </div>\n ${this.description ? html`<div class=\"spinner-description\">${this.description}</div>` : nothing}\n <slot name=\"description\"></slot>\n `\n return this._imperative ? html`<div class=\"wui-spinner-overlay\">${spinner}</div>` : spinner\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-spinner': WebUiSpinner\n }\n}\n"],"mappings":";;;;;;OAMM,IAAa,GAGN,IAAN,cAA2B,EAAW;;;;;EAiC7B,aA9BoC,KAAA,OAAA,IACR,KAAA,cAAA,IA6B5B,KAAA,cAAA;;;EAhCW,KAAA,SAAA,EAAU,CAAK;;CAMxC,OAAO,KAAK,GAAoF;EAC9F,IAAM,IAAK,SAAS,cAAc,gBAAgB;EAQlD,OAPA,EAAG,cAAc,IACb,GAAS,SAAM,EAAG,OAAO,EAAQ,OACjC,GAAS,gBAAa,EAAG,cAAc,EAAQ,cACnD,SAAS,KAAK,YAAY,CAAE,GACxB,GAAS,YAAY,EAAQ,WAAW,MAC1C,EAAG,SAAS,OAAO,iBAAA,EAA8B,KAAK,GAAG,EAAQ,QAAQ,IAEpE;CACT;CAGA,OAAO,OAAO;EAMZ,AALA,EAAiB,UAAU,WACzB,aAAA,EAA0B,SAAS,MAAM,GACzC,EAAa,SAAS,SAAS,KAAA,IAEjC,EAAa,UAAU,OAAO,GAC9B,EAAa,WAAW,KAAA;CAC1B;CAUA,oBAA6B;EAQ3B,AAPA,MAAM,kBAAkB,GACnB,KAAK,aAAa,MAAM,KAC3B,KAAK,aAAa,QAAQ,QAAQ,GAE/B,KAAK,aAAa,YAAY,KACjC,KAAK,aAAa,cAAc,KAAK,GAEnC,KAAK,gBACP,EAAa,UAAU,OAAO,GAC9B,EAAa,WAAW,MACxB,KAAK,UAAU,IAAI,qBAAqB;CAE5C;CAEA,uBAAgC;EAE9B,AADA,MAAM,qBAAqB,GAC3B,AAEE,KAAK,YADL,aAAa,KAAK,MAAM,GACV,KAAA;CAElB;CAEA,QAA2B,GAAuB;EAEhD,AADA,MAAM,QAAQ,CAAK,GACf,EAAM,IAAI,MAAM,KAClB,KAAK,MAAM,YAAY,sBAAsB,GAAG,KAAK,KAAK,GAAG;CAEjE;CAEA,SAAkB;EAChB,IAAM,IAAU,CAAI;;UAEd,EACA,MAAM,KAAK,EAAE,QAAQ,EAAW,IAAI,GAAG,MAAM,CAAC,IAC9C,MACE,CAAI;wCACwB,IAAI,GAAG,6BAA6B,IAAa,EAAE,KAAK,EAAW;qBAEnG,EAAE;;QAEF,KAAK,cAAc,CAAI,oCAAoC,KAAK,YAAY,UAAU,EAAQ;;;EAGlG,OAAO,KAAK,cAAc,CAAI,oCAAoC,EAAQ,UAAU;CACtF;AACF;AAhFG,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,eAAA,KAAA,CAAA,GAL3B,IAAA,IAAA,EAAA,CAAA,EAAc,gBAAgB,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/components/spinner/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{justify-content:center;align-items:center;display:inline-flex}:host(.wui-spinner-overlay){display:contents}.wui-spinner{width:var(--wui-spinner-size,24px);height:var(--wui-spinner-size,24px);color:#666;position:relative}.wui-spinner span{transform-origin:50%;width:10%;height:100%;animation:.8s linear infinite wui-spinner-leaf-fade;position:absolute;top:0;left:50%}.wui-spinner span:before{content:\"\";border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:currentColor;width:100%;height:30%;margin-top:12%;display:block}.wui-spinner-overlay{pointer-events:none;z-index:var(--wui-layer-loading,300);flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex;position:fixed;inset:0}.wui-spinner-overlay .wui-spinner{pointer-events:auto}.spinner-description{pointer-events:auto;max-width:240px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text-secondary,#6a6a6a);text-align:center;line-height:1.5}@keyframes wui-spinner-leaf-fade{0%{opacity:1}to{opacity:0}}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{justify-content:center;align-items:center;display:inline-flex}:host(.wui-spinner-overlay){display:contents}.wui-spinner{width:var(--wui-spinner-size,24px);height:var(--wui-spinner-size,24px);color:#666;position:relative}.wui-spinner span{transform-origin:50%;width:10%;height:100%;animation:wui-spinner-leaf-fade var(--wui-duration-spinner,.8s) linear infinite;position:absolute;top:0;left:50%}.wui-spinner span:before{content:\"\";border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:currentColor;width:100%;height:30%;margin-top:12%;display:block}.wui-spinner-overlay{pointer-events:none;z-index:var(--wui-layer-loading,300);flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex;position:fixed;inset:0}.wui-spinner-overlay .wui-spinner{pointer-events:auto}.spinner-description{pointer-events:auto;max-width:240px;font-size:var(--wui-font-size,14px);color:var(--wui-color-text-secondary,#6a6a6a);text-align:center;line-height:1.5}@keyframes wui-spinner-leaf-fade{0%{opacity:1}to{opacity:0}}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/spinner/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n:host(.wui-spinner-overlay) {\n display: contents;\n}\n\n.wui-spinner {\n position: relative;\n width: var(--wui-spinner-size, 24px);\n height: var(--wui-spinner-size, 24px);\n color: #666;\n\n span {\n position: absolute;\n top: 0;\n left: 50%;\n transform-origin: center center;\n\n width: 10%;\n height: 100%;\n\n animation: wui-spinner-leaf-fade 0.8s linear infinite;\n\n &::before {\n content: '';\n\n display: block;\n\n width: 100%;\n height: 30%;\n margin-top: 12%;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: currentcolor;\n }\n }\n}\n\n.wui-spinner-overlay {\n pointer-events: none;\n\n position: fixed;\n z-index: var(--wui-layer-loading, 300);\n inset: 0;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n justify-content: center;\n\n .wui-spinner {\n pointer-events: auto;\n }\n}\n\n.spinner-description {\n pointer-events: auto;\n\n max-width: 240px;\n\n font-size: var(--wui-font-size, 14px);\n line-height: 1.5;\n color: var(--wui-color-text-secondary, #6a6a6a);\n text-align: center;\n}\n\n@keyframes wui-spinner-leaf-fade {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/spinner/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n:host(.wui-spinner-overlay) {\n display: contents;\n}\n\n.wui-spinner {\n position: relative;\n width: var(--wui-spinner-size, 24px);\n height: var(--wui-spinner-size, 24px);\n color: #666;\n\n span {\n position: absolute;\n top: 0;\n left: 50%;\n transform-origin: center center;\n\n width: 10%;\n height: 100%;\n\n animation: wui-spinner-leaf-fade var(--wui-duration-spinner, 800ms) linear infinite;\n\n &::before {\n content: '';\n\n display: block;\n\n width: 100%;\n height: 30%;\n margin-top: 12%;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: currentcolor;\n }\n }\n}\n\n.wui-spinner-overlay {\n pointer-events: none;\n\n position: fixed;\n z-index: var(--wui-layer-loading, 300);\n inset: 0;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n justify-content: center;\n\n .wui-spinner {\n pointer-events: auto;\n }\n}\n\n.spinner-description {\n pointer-events: auto;\n\n max-width: 240px;\n\n font-size: var(--wui-font-size, 14px);\n line-height: 1.5;\n color: var(--wui-color-text-secondary, #6a6a6a);\n text-align: center;\n}\n\n@keyframes wui-spinner-leaf-fade {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0;\n }\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import { normalizeNumber as t } from "../../shared/normalize/index.js";
3
3
  import { findNearestTheme as n } from "../../shared/overlay/theme-overlay-scope.js";
4
4
  import r from "./style.js";
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
2
2
  import "../icon/index.js";
3
3
  import t from "../../icons/generated/lucide-loader-circle.js";
4
4
  import n from "../../assets/glass.js";
@@ -50,7 +50,7 @@ var y = class extends r(d) {
50
50
  }
51
51
  _syncValidity() {
52
52
  let e = this._formAssociation.getInternals();
53
- !e || typeof e.setValidity != "function" || (this._isDisabled || !this.required || this._checked ? e.setValidity({}) : e.setValidity({ valueMissing: !0 }, "请启用此项"));
53
+ e && typeof e.setValidity == "function" && (this._isDisabled || !this.required || this._checked ? e.setValidity({}) : e.setValidity({ valueMissing: !0 }, "请启用此项"));
54
54
  }
55
55
  handleClick(e) {
56
56
  if (e.preventDefault(), this._dragged) {
@@ -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'\nimport { styleMap } from 'lit/directives/style-map.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideLoaderCircle } from '@/icons'\nimport { installPointerFocusSuppression } from '@/shared/focus/pointer-focus'\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { attachDragGesture, type DragGestureHandle } from '@/shared/gesture/drag-gesture'\nimport { clamp, normalizeProgress } from '@/shared/gesture/physics'\n\nimport style from './style.css?inline'\n\ninstallPointerFocusSuppression()\n\n@customElement('web-ui-switch')\nexport class WebUiSwitch extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\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 @state() private _isDragging = false\n @state() private _dragOffset = 0\n @state() private _dragProgress = 0\n\n private _dragged = false\n private _maxTravel = 20\n private _startOffset = 0\n private _dragGestureHandle: DragGestureHandle | null = null\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this._dragGestureHandle?.destroy()\n this._dragGestureHandle = null\n }\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 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._dragged) {\n this._dragged = false\n return\n }\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(e: PointerEvent) {\n if (this._isDisabled || this.loading) return\n this._pressed = true\n\n const track = this.renderRoot.querySelector<HTMLElement>('.wui-switch-track')\n if (track) {\n const trackWidth = track.getBoundingClientRect().width || 40\n // 拖拽时 thumb 的 pressed 布局盒为 20px(scale(1.5) 视觉放大),因此行程按 20px 布局盒钳制;\n // 释放后的 checked 静止位移为 20px(16px thumb),两者由 transition 衔接。\n this._maxTravel = Math.max(1, trackWidth - 4 - 20)\n } else {\n this._maxTravel = 16\n }\n\n this._startOffset = this._checked ? this._maxTravel : 0\n this._dragOffset = this._startOffset\n this._dragProgress = this._checked ? 1 : 0\n\n this._dragGestureHandle?.destroy()\n this._dragGestureHandle = attachDragGesture(e, {\n axis: 'x',\n threshold: 6,\n onMove: info => {\n this._isDragging = true\n const current = clamp(this._startOffset + info.deltaX, 0, this._maxTravel)\n this._dragOffset = current\n this._dragProgress = normalizeProgress(current, 0, this._maxTravel)\n this.requestUpdate()\n },\n onEnd: info => {\n const wasDragging = this._isDragging\n this._isDragging = false\n this._pressed = false\n\n if (wasDragging) {\n this._dragged = true\n let targetChecked = this._checked\n if (info.velocityX > 300) {\n targetChecked = true\n } else if (info.velocityX < -300) {\n targetChecked = false\n } else {\n targetChecked = this._dragProgress >= 0.5\n }\n\n if (targetChecked !== this._checked) {\n const old = this._checked\n this._checked = targetChecked\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 } else {\n this.requestUpdate()\n }\n }\n },\n onCancel: () => {\n this._isDragging = false\n this._pressed = false\n this.requestUpdate()\n }\n })\n }\n\n private handlePointerUp() {\n this._pressed = false\n }\n\n private handlePointerLeave() {\n if (!this._isDragging) {\n this._pressed = false\n }\n }\n\n override render() {\n const isOpen = this._isDragging ? this._dragProgress >= 0.5 : this._checked\n const trackCls = {\n 'wui-switch-track': true,\n 'is-open': isOpen,\n 'is-dragging': this._isDragging,\n 'is-disabled': this._isDisabled || this.loading\n }\n // wui-glass 条件化:静止态实体白 thumb,按压/拖拽时切换为玻璃(backdrop blur +\n // 半透明玻璃背景 + 描边)并放大,回到最初修复不跟手问题时期的视觉结构。\n const thumbCls = {\n 'wui-switch-thumb': true,\n 'wui-glass': this._pressed || this._isDragging,\n 'is-pressed': this._pressed || this._isDragging\n }\n const trackStyle = this._isDragging ? { '--wui-switch-drag-offset': `${this._dragOffset}px` } : {}\n\n return html`\n <label\n class=${classMap(trackCls)}\n style=${styleMap(trackStyle)}\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":";;;;;;;;;;;;;;AAeA,EAA+B;AAGxB,IAAM,IAAN,cAA0B,EAAe,CAAU,CAAC,CAAC;;EAyDZ,aAvDlB,KAAA,WAAA,IAasB,KAAA,OAAA,IACd,KAAA,QAAA,IACmB,KAAA,WAAA,IACA,KAAA,WAAA,IACD,KAAA,UAAA,IAC1B,KAAA,WAAA,IACG,KAAA,cAAA,IACA,KAAA,cAAA,GACE,KAAA,gBAAA,GAEd,KAAA,WAAA,IACE,KAAA,aAAA,IACE,KAAA,eAAA,GACgC,KAAA,qBAAA,MAYnB,KAAA,mBAAA,EAA+B;GACjE,MAAM;GACN,kBAAkB;IAChB,AAAI,KAAK,aAAa,SAAS,MAAG,KAAK,WAAW;GACpD;GACA,gBAAgB,KAAK;GACrB,WAAU,MAAW;IACnB,KAAK,UAAU;GACjB;GACA,oBAAqB,KAAK,WAAW,KAAK,SAAS,OAAO;GAC1D,oBAAoB,OAAO,KAAK,QAAQ;GACxC,eAAc,MAAS;IACrB,AAAI,OAAO,KAAU,aAAU,KAAK,UAAU,MAAU;GAC1D;GACA,oBAAoB,KAAK,cAAc;EACzC,CAAC,CAAC,CAAC,KAAK,GAEsC,KAAA,6BAAA,IAAI,EAA0B,MAAM,KAAK,gBAAgB;;;EAxD9E,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAG5D,IAAI,UAAmB;EACrB,OAAO,KAAK;CACd;CAEA,IAAI,QAAQ,GAAY;EACtB,IAAM,IAAM,KAAK;EAGjB,AAFA,KAAK,WAAW,GAChB,KAAK,iBAAiB,KAAK,GAC3B,KAAK,cAAc,WAAW,CAAG;CACnC;CAiBA,uBAAgC;EAG9B,AAFA,MAAM,qBAAqB,GAC3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AA,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'\nimport { styleMap } from 'lit/directives/style-map.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideLoaderCircle } from '@/icons'\nimport { installPointerFocusSuppression } from '@/shared/focus/pointer-focus'\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { attachDragGesture, type DragGestureHandle } from '@/shared/gesture/drag-gesture'\nimport { clamp, normalizeProgress } from '@/shared/gesture/physics'\n\nimport style from './style.css?inline'\n\ninstallPointerFocusSuppression()\n\n@customElement('web-ui-switch')\nexport class WebUiSwitch extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\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 @state() private _isDragging = false\n @state() private _dragOffset = 0\n @state() private _dragProgress = 0\n\n private _dragged = false\n private _maxTravel = 20\n private _startOffset = 0\n private _dragGestureHandle: DragGestureHandle | null = null\n\n override disconnectedCallback() {\n super.disconnectedCallback()\n this._dragGestureHandle?.destroy()\n this._dragGestureHandle = null\n }\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 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._dragged) {\n this._dragged = false\n return\n }\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(e: PointerEvent) {\n if (this._isDisabled || this.loading) return\n this._pressed = true\n\n const track = this.renderRoot.querySelector<HTMLElement>('.wui-switch-track')\n if (track) {\n const trackWidth = track.getBoundingClientRect().width || 40\n // 拖拽时 thumb 的 pressed 布局盒为 20px(scale(1.5) 视觉放大),因此行程按 20px 布局盒钳制;\n // 释放后的 checked 静止位移为 20px(16px thumb),两者由 transition 衔接。\n this._maxTravel = Math.max(1, trackWidth - 4 - 20)\n } else {\n this._maxTravel = 16\n }\n\n this._startOffset = this._checked ? this._maxTravel : 0\n this._dragOffset = this._startOffset\n this._dragProgress = this._checked ? 1 : 0\n\n this._dragGestureHandle?.destroy()\n this._dragGestureHandle = attachDragGesture(e, {\n axis: 'x',\n threshold: 6,\n onMove: info => {\n this._isDragging = true\n const current = clamp(this._startOffset + info.deltaX, 0, this._maxTravel)\n this._dragOffset = current\n this._dragProgress = normalizeProgress(current, 0, this._maxTravel)\n this.requestUpdate()\n },\n onEnd: info => {\n const wasDragging = this._isDragging\n this._isDragging = false\n this._pressed = false\n\n if (wasDragging) {\n this._dragged = true\n let targetChecked = this._checked\n if (info.velocityX > 300) {\n targetChecked = true\n } else if (info.velocityX < -300) {\n targetChecked = false\n } else {\n targetChecked = this._dragProgress >= 0.5\n }\n\n if (targetChecked !== this._checked) {\n const old = this._checked\n this._checked = targetChecked\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 } else {\n this.requestUpdate()\n }\n }\n },\n onCancel: () => {\n this._isDragging = false\n this._pressed = false\n this.requestUpdate()\n }\n })\n }\n\n private handlePointerUp() {\n this._pressed = false\n }\n\n private handlePointerLeave() {\n if (!this._isDragging) {\n this._pressed = false\n }\n }\n\n override render() {\n const isOpen = this._isDragging ? this._dragProgress >= 0.5 : this._checked\n const trackCls = {\n 'wui-switch-track': true,\n 'is-open': isOpen,\n 'is-dragging': this._isDragging,\n 'is-disabled': this._isDisabled || this.loading\n }\n // wui-glass 条件化:静止态实体白 thumb,按压/拖拽时切换为玻璃(backdrop blur +\n // 半透明玻璃背景 + 描边)并放大,回到最初修复不跟手问题时期的视觉结构。\n const thumbCls = {\n 'wui-switch-thumb': true,\n 'wui-glass': this._pressed || this._isDragging,\n 'is-pressed': this._pressed || this._isDragging\n }\n const trackStyle = this._isDragging ? { '--wui-switch-drag-offset': `${this._dragOffset}px` } : {}\n\n return html`\n <label\n class=${classMap(trackCls)}\n style=${styleMap(trackStyle)}\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":";;;;;;;;;;;;;;AAeA,EAA+B;AAGxB,IAAM,IAAN,cAA0B,EAAe,CAAU,CAAC,CAAC;;EAyDZ,aAvDlB,KAAA,WAAA,IAasB,KAAA,OAAA,IACd,KAAA,QAAA,IACmB,KAAA,WAAA,IACA,KAAA,WAAA,IACD,KAAA,UAAA,IAC1B,KAAA,WAAA,IACG,KAAA,cAAA,IACA,KAAA,cAAA,GACE,KAAA,gBAAA,GAEd,KAAA,WAAA,IACE,KAAA,aAAA,IACE,KAAA,eAAA,GACgC,KAAA,qBAAA,MAYnB,KAAA,mBAAA,EAA+B;GACjE,MAAM;GACN,kBAAkB;IAChB,AAAI,KAAK,aAAa,SAAS,MAAG,KAAK,WAAW;GACpD;GACA,gBAAgB,KAAK;GACrB,WAAU,MAAW;IACnB,KAAK,UAAU;GACjB;GACA,oBAAqB,KAAK,WAAW,KAAK,SAAS,OAAO;GAC1D,oBAAoB,OAAO,KAAK,QAAQ;GACxC,eAAc,MAAS;IACrB,AAAI,OAAO,KAAU,aAAU,KAAK,UAAU,MAAU;GAC1D;GACA,oBAAoB,KAAK,cAAc;EACzC,CAAC,CAAC,CAAC,KAAK,GAEsC,KAAA,6BAAA,IAAI,EAA0B,MAAM,KAAK,gBAAgB;;;EAxD9E,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAG5D,IAAI,UAAmB;EACrB,OAAO,KAAK;CACd;CAEA,IAAI,QAAQ,GAAY;EACtB,IAAM,IAAM,KAAK;EAGjB,AAFA,KAAK,WAAW,GAChB,KAAK,iBAAiB,KAAK,GAC3B,KAAK,cAAc,WAAW,CAAG;CACnC;CAiBA,uBAAgC;EAG9B,AAFA,MAAM,qBAAqB,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e,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{touch-action:none;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{touch-action:none;cursor:default;-webkit-user-select:none;user-select:none;border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-track,#e5e5ea);outline:var(--wui-focus-ring-width,3px) solid transparent;outline-offset:2px;width:40px;height:20px;transition:background-color var(--wui-duration-trigger,.16s) ease;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{--wui-glass-corner-radius:calc(16px / 2);transform-origin:50%;border-radius:var(--wui-radius-control,calc(infinity * 1px));width:16px;height:16px;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, box-shadow var(--wui-duration-press,80ms) ease;position:absolute;top:2px;left:2px;overflow:hidden;transform:translate(0)scale(1)}.wui-switch-thumb.is-pressed{border-radius:var(--wui-radius-control,calc(infinity * 1px));width:20px;box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 1px 6px #0003, 0 6px 16px #00000029, 0 14px 28px #0000001a;background-color:#0000;transform:translate(0)scale(1.5)}.wui-switch-thumb:not(.is-pressed){background-color:var(--wui-color-on-control,#fff);box-shadow:1px 2px 6px #0003}.wui-switch-track.is-open .wui-switch-thumb{transform:translate(20px)scale(1)}.wui-switch-track.is-open .wui-switch-thumb.is-pressed{transform:translate(16px)scale(1.5)}.wui-switch-track.is-dragging{cursor:grabbing}:host([data-wui-pointer-focus]) .wui-switch-track:focus-within{outline-color:#0000}.wui-switch-track.is-dragging .wui-switch-thumb,.wui-switch-track.is-dragging .wui-switch-thumb.is-pressed{transform:translateX(var(--wui-switch-drag-offset,0)) scale(1.5);transition:none}.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{touch-action:none;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{touch-action:none;cursor:default;-webkit-user-select:none;user-select:none;border-radius:var(--wui-radius-control,calc(infinity * 1px));background-color:var(--wui-color-surface-track,#e5e5ea);outline:var(--wui-focus-ring-width,3px) solid transparent;outline-offset:2px;width:40px;height:20px;transition:background-color var(--wui-duration-trigger,.16s) ease;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{--wui-glass-corner-radius:calc(16px / 2);transform-origin:50%;border-radius:var(--wui-radius-control,calc(infinity * 1px));width:16px;height:16px;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, box-shadow var(--wui-duration-press,80ms) ease;position:absolute;top:2px;left:2px;overflow:hidden;transform:translate(0)scale(1)}.wui-switch-thumb.is-pressed{border-radius:var(--wui-radius-control,calc(infinity * 1px));width:20px;box-shadow:inset 0 0 0 .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 38%, transparent), inset 0 1px .5px color-mix(in srgb, var(--wui-color-glass-highlight,#ffffffe6) 52%, transparent), inset 0 -.5px 1px #00000008, 0 2px 20px #0003;background-color:#0000;transform:translate(0)scale(1.5)}.wui-switch-thumb:not(.is-pressed){background-color:var(--wui-color-on-control,#fff);box-shadow:1px 2px 6px #0003}.wui-switch-track.is-open .wui-switch-thumb{transform:translate(20px)scale(1)}.wui-switch-track.is-open .wui-switch-thumb.is-pressed{transform:translate(16px)scale(1.5)}.wui-switch-track.is-dragging{cursor:grabbing}:host([data-wui-pointer-focus]) .wui-switch-track:focus-within{outline-color:#0000}.wui-switch-track.is-dragging .wui-switch-thumb,.wui-switch-track.is-dragging .wui-switch-thumb.is-pressed{transform:translateX(var(--wui-switch-drag-offset,0)) scale(1.5);transition:none}.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 touch-action: none;\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 touch-action: none;\n cursor: default;\n user-select: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n width: 40px;\n height: 20px;\n border-radius: var(--wui-radius-control, 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 --wui-glass-corner-radius: calc(16px / 2);\n\n position: absolute;\n top: 2px;\n left: 2px;\n transform-origin: center center;\n transform: translateX(0) scale(1);\n\n overflow: hidden;\n\n width: 16px;\n height: 16px;\n border-radius: var(--wui-radius-control, 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 box-shadow var(--wui-duration-press, 80ms) ease;\n\n /*\n * 静止态:实体白 thumb。按压/拖拽时切到 wui-glass(backdrop blur + 半透明玻璃背景\n * + 描边)并放大 1.5x,背景转为透明让玻璃材质透出。\n *\n * 按压/拖拽的 box-shadow 必须直接写死值、不能经自定义属性中转:iOS Safari 对\n * 「自定义属性值变化驱动依赖属性」不触发 transition(且 var 离散切换可能整体\n * 不生效),上一轮经 var 中转让按压阴影在真机上「回退之前」。直接写值后 box-shadow\n * 是普通属性变化,transition 正常插值。这里同时复制 wui-glass 的三条 inset 高光,\n * 避免整段覆盖后按压态丢失玻璃描边。\n */\n &.is-pressed {\n transform: translateX(0) scale(1.5);\n\n width: 20px;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: transparent;\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 1px 6px rgb(0 0 0 / 0.2),\n 0 6px 16px rgb(0 0 0 / 0.16),\n 0 14px 28px rgb(0 0 0 / 0.1);\n }\n\n &:not(.is-pressed) {\n background-color: var(--wui-color-on-control, #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(20px) scale(1);\n\n &.is-pressed {\n transform: translateX(16px) scale(1.5);\n }\n}\n\n.wui-switch-track.is-dragging {\n cursor: grabbing;\n}\n\n:host([data-wui-pointer-focus]) .wui-switch-track:focus-within {\n outline-color: transparent;\n}\n\n.wui-switch-track.is-dragging .wui-switch-thumb,\n.wui-switch-track.is-dragging .wui-switch-thumb.is-pressed {\n transform: translateX(var(--wui-switch-drag-offset, 0)) scale(1.5);\n transition: none;\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 touch-action: none;\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 touch-action: none;\n cursor: default;\n user-select: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n width: 40px;\n height: 20px;\n border-radius: var(--wui-radius-control, 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 --wui-glass-corner-radius: calc(16px / 2);\n\n position: absolute;\n top: 2px;\n left: 2px;\n transform-origin: center center;\n transform: translateX(0) scale(1);\n\n overflow: hidden;\n\n width: 16px;\n height: 16px;\n border-radius: var(--wui-radius-control, 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 box-shadow var(--wui-duration-press, 80ms) ease;\n\n &.is-pressed {\n transform: translateX(0) scale(1.5);\n\n width: 20px;\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n\n background-color: transparent;\n box-shadow:\n inset 0 0 0 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 38%, transparent),\n inset 0 1px 0.5px color-mix(in srgb, var(--wui-color-glass-highlight, rgb(255 255 255 / 0.9)) 52%, transparent),\n inset 0 -0.5px 1px rgb(0 0 0 / 0.03),\n 0 2px 20px rgb(0 0 0 / 0.2);\n }\n\n &:not(.is-pressed) {\n background-color: var(--wui-color-on-control, #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(20px) scale(1);\n\n &.is-pressed {\n transform: translateX(16px) scale(1.5);\n }\n}\n\n.wui-switch-track.is-dragging {\n cursor: grabbing;\n}\n\n:host([data-wui-pointer-focus]) .wui-switch-track:focus-within {\n outline-color: transparent;\n}\n\n.wui-switch-track.is-dragging .wui-switch-thumb,\n.wui-switch-track.is-dragging .wui-switch-thumb.is-pressed {\n transform: translateX(var(--wui-switch-drag-offset, 0)) scale(1.5);\n transition: none;\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,4 +1,4 @@
1
- import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import e from "../../_virtual/_@oxc-project_runtime@0.149.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";
@@ -58,7 +58,7 @@ var v = class extends r(c) {
58
58
  }
59
59
  _syncValidity() {
60
60
  let e = this._formAssociation.getInternals(), t = this._getTextarea();
61
- !e || !t || typeof e.setValidity != "function" || o(e, t, [
61
+ e && t && typeof e.setValidity == "function" && o(e, t, [
62
62
  "valueMissing",
63
63
  "tooShort",
64
64
  "tooLong"
@@ -77,7 +77,7 @@ var v = class extends r(c) {
77
77
  this._resizeObserver?.disconnect(), this._resizeObserver = null, e && this._textarea?.style.removeProperty("height");
78
78
  }
79
79
  _autosize() {
80
- !this._textarea || !this.autosize || (this._textarea.style.height = "auto", this._textarea.style.height = `${this._textarea.scrollHeight}px`);
80
+ this._textarea && this.autosize && (this._textarea.style.height = "auto", this._textarea.style.height = `${this._textarea.scrollHeight}px`);
81
81
  }
82
82
  handleInput(e) {
83
83
  e.target instanceof HTMLTextAreaElement && (this._value = e.target.value, this._formAssociation.sync(), this._syncValidity(), this._autosize());