@aceshooting/lyra-ui 30.5.0 → 30.7.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 (203) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +1 -1
  3. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.d.ts +7 -4
  4. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.js +5 -5
  5. package/dist/components/conversation/code-block/onig.provenance.json +1 -1
  6. package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -1
  7. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  8. package/dist/components/conversation/markdown/markdown-core.class.d.ts +11 -1
  9. package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
  10. package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
  11. package/dist/components/conversation/markdown/markdown-shared.d.ts +7 -2
  12. package/dist/components/conversation/markdown/markdown-shared.js +3 -3
  13. package/dist/components/conversation/markdown/markdown.class.d.ts +11 -1
  14. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  15. package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
  16. package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
  17. package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
  18. package/dist/components/conversation/model-select/model-select.class.d.ts +8 -1
  19. package/dist/components/conversation/model-select/model-select.class.js +2 -2
  20. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +5 -0
  21. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
  22. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +1 -1
  23. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -0
  24. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +1 -1
  25. package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
  26. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +6 -0
  27. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  28. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +9 -2
  29. package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -2
  30. package/dist/components/conversation/widget-renderer/default-registry.js +1 -1
  31. package/dist/components/conversation/widget-renderer/registry.d.ts +1 -27
  32. package/dist/components/conversation/widget-renderer/registry.js +1 -1
  33. package/dist/components/conversation/widget-renderer/resolve.d.ts +1 -29
  34. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  35. package/dist/components/conversation/widget-renderer/widget-renderer.class.d.ts +1 -1
  36. package/dist/components/conversation/widget-renderer/widget-renderer.class.js +1 -1
  37. package/dist/components/forms/catalog-picker-base.d.ts +3 -1
  38. package/dist/components/forms/catalog-picker-base.js +3 -3
  39. package/dist/components/forms/combobox/combobox.class.d.ts +9 -2
  40. package/dist/components/forms/combobox/combobox.class.js +2 -2
  41. package/dist/components/forms/date-picker/date-input.class.d.ts +9 -2
  42. package/dist/components/forms/date-picker/date-input.class.js +2 -2
  43. package/dist/components/forms/input/input-shared.d.ts +9 -2
  44. package/dist/components/forms/input/input-shared.js +2 -2
  45. package/dist/components/forms/input/time-input.class.d.ts +9 -2
  46. package/dist/components/forms/input/time-input.class.js +2 -2
  47. package/dist/components/forms/input/time-input.styles.js +1 -1
  48. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +18 -3
  49. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  50. package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -2
  51. package/dist/components/forms/phone-input/phone-input.class.js +2 -2
  52. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  53. package/dist/components/forms/select/select.class.d.ts +9 -2
  54. package/dist/components/forms/select/select.class.js +2 -2
  55. package/dist/components/forms/textarea/textarea.class.d.ts +9 -2
  56. package/dist/components/forms/textarea/textarea.class.js +2 -2
  57. package/dist/components/forms/token-input/token-input.class.d.ts +9 -2
  58. package/dist/components/forms/token-input/token-input.class.js +2 -2
  59. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  60. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +5 -2
  61. package/dist/components/layout/dock-panel/dock-panel.styles.js +1 -1
  62. package/dist/components/layout/menu/menu-item.class.d.ts +7 -4
  63. package/dist/components/layout/menu/menu-item.class.js +3 -2
  64. package/dist/components/layout/multi-split/multi-split.class.d.ts +73 -6
  65. package/dist/components/layout/multi-split/multi-split.class.js +4 -4
  66. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  67. package/dist/components/layout/page/page.class.d.ts +7 -0
  68. package/dist/components/layout/page/page.styles.js +1 -1
  69. package/dist/components/media/flag/language-map.js +1 -1
  70. package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +1 -5
  71. package/dist/components/media/image-viewer/image-viewer-panorama.js +1 -8
  72. package/dist/components/media/image-viewer/image-viewer.class.d.ts +1 -1
  73. package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
  74. package/dist/components/media/map/map-control-options.d.ts +7 -3
  75. package/dist/components/media/map/map-control-options.js +1 -1
  76. package/dist/components/media/map/map-controls-lifecycle.js +1 -1
  77. package/dist/components/media/map/map-feature-loader.js +1 -1
  78. package/dist/components/media/map/map-loader.d.ts +10 -4
  79. package/dist/components/media/map/map-loader.js +1 -1
  80. package/dist/components/media/map/map-scene-admission.js +1 -0
  81. package/dist/components/media/map/map-scene-completion-adapter.js +1 -0
  82. package/dist/components/media/map/map-scene-completion-camera.js +1 -0
  83. package/dist/components/media/map/map-scene-configuration-controller.js +1 -0
  84. package/dist/components/media/map/map-scene-configuration.d.ts +15 -0
  85. package/dist/components/media/map/map-scene-configuration.js +1 -0
  86. package/dist/components/media/map/map-scene-controls.js +1 -0
  87. package/dist/components/media/map/map-scene-errors.js +1 -0
  88. package/dist/components/media/map/map-scene-line-layer.js +1 -0
  89. package/dist/components/media/map/map-scene-lines.js +1 -0
  90. package/dist/components/media/map/map-scene-owner.js +1 -0
  91. package/dist/components/media/map/map-scene-position-registry.js +1 -0
  92. package/dist/components/media/map/map-scene-render-controller.js +1 -0
  93. package/dist/components/media/map/map-scene-render-input.js +1 -0
  94. package/dist/components/media/map/map-scene-source-snapshot.js +1 -0
  95. package/dist/components/media/map/map-scene-status.js +1 -0
  96. package/dist/components/media/map/map-scene-types.d.ts +55 -0
  97. package/dist/components/media/map/map.class.d.ts +60 -12
  98. package/dist/components/media/map/map.class.js +23 -6
  99. package/dist/components/media/map/map.styles.js +1 -1
  100. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +1 -1
  101. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  102. package/dist/components/media/video/video.class.d.ts +1 -1
  103. package/dist/components/media/video/video.class.js +1 -1
  104. package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -1
  105. package/dist/components/retrieval/graph/graph-curvature.js +1 -0
  106. package/dist/components/retrieval/graph/graph-engine-columns.js +1 -1
  107. package/dist/components/retrieval/graph/graph-model.d.ts +4 -0
  108. package/dist/components/retrieval/graph/graph-node-renderer.d.ts +13 -0
  109. package/dist/components/retrieval/graph/graph-node-renderer.js +1 -0
  110. package/dist/components/retrieval/graph/graph-source-controller.js +1 -1
  111. package/dist/components/retrieval/graph/graph-spatial-controller.js +3 -1
  112. package/dist/components/retrieval/graph/graph-spatial.js +1 -1
  113. package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -1
  114. package/dist/components/retrieval/graph/graph.class.d.ts +11 -3
  115. package/dist/components/retrieval/graph/graph.class.js +4 -4
  116. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +8 -2
  117. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +4 -2
  118. package/dist/events.d.ts +36 -1
  119. package/dist/framework-types.d.ts +1 -1
  120. package/dist/internal/collection-policy.js +1 -0
  121. package/dist/internal/collection-snapshot.js +1 -1
  122. package/dist/internal/default-strings/media.generated.js +1 -1
  123. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  124. package/dist/internal/engine-3d-loader.d.ts +8 -2
  125. package/dist/internal/engine-3d-loader.js +1 -1
  126. package/dist/internal/form-control.styles.js +1 -1
  127. package/dist/internal/locale-loaders.generated.js +1 -1
  128. package/dist/internal/localization-runtime.js +1 -1
  129. package/dist/internal/localization-types.d.ts +1 -1
  130. package/dist/internal/localization.js +1 -1
  131. package/dist/internal/map-camera-follow-controller.d.ts +9 -0
  132. package/dist/internal/map-camera-follow-controller.js +1 -0
  133. package/dist/internal/map-camera-follow-data.js +1 -0
  134. package/dist/internal/map-camera-follow-scene.js +1 -0
  135. package/dist/internal/map-camera-session-controller.d.ts +59 -0
  136. package/dist/internal/map-camera-session-controller.js +1 -0
  137. package/dist/internal/map-camera-session-data.d.ts +16 -0
  138. package/dist/internal/map-camera-session-data.js +1 -0
  139. package/dist/internal/map-camera-session.js +1 -0
  140. package/dist/internal/map-scene-session.js +1 -0
  141. package/dist/internal/media-panorama.d.ts +5 -0
  142. package/dist/internal/media-panorama.js +8 -0
  143. package/dist/internal/package-metadata.js +1 -1
  144. package/dist/internal/sequence-playback-binding.js +1 -0
  145. package/dist/internal/typed-columns.d.ts +3 -1
  146. package/dist/internal/typed-columns.js +1 -1
  147. package/dist/internal/variants.d.ts +7 -0
  148. package/dist/internal/widget-default-registry.js +1 -0
  149. package/dist/internal/widget-document.d.ts +29 -0
  150. package/dist/internal/widget-document.js +1 -0
  151. package/dist/internal/widget-type-registry.d.ts +27 -0
  152. package/dist/internal/widget-type-registry.js +1 -0
  153. package/dist/lyra.d.ts +1 -1
  154. package/dist/lyra.js +1 -1
  155. package/dist/map-camera-session.d.ts +10 -0
  156. package/dist/map-camera-session.js +1 -0
  157. package/dist/sequence-time-binding.d.ts +3 -0
  158. package/dist/sequence-time-binding.js +1 -0
  159. package/dist/simulation-clock.d.ts +3 -0
  160. package/dist/simulation-clock.js +1 -0
  161. package/dist/time-index.d.ts +3 -0
  162. package/dist/time-index.js +1 -0
  163. package/llms/components/lr-artifact-panel.md +8 -3
  164. package/llms/components/lr-combobox.md +2 -0
  165. package/llms/components/lr-country-picker.md +2 -0
  166. package/llms/components/lr-currency-picker.md +2 -0
  167. package/llms/components/lr-date-picker.md +2 -0
  168. package/llms/components/lr-dock-panel.md +5 -2
  169. package/llms/components/lr-graph.md +121 -3
  170. package/llms/components/lr-input.md +2 -0
  171. package/llms/components/lr-knowledge-graph-explorer.md +6 -1
  172. package/llms/components/lr-locale-picker.md +8 -1
  173. package/llms/components/lr-map.md +315 -7
  174. package/llms/components/lr-markdown-core.md +2 -1
  175. package/llms/components/lr-markdown.md +12 -1
  176. package/llms/components/lr-menu.md +5 -2
  177. package/llms/components/lr-model-select.md +2 -0
  178. package/llms/components/lr-multi-split.md +53 -4
  179. package/llms/components/lr-native-time-input.md +2 -0
  180. package/llms/components/lr-number-input.md +2 -0
  181. package/llms/components/lr-page.md +9 -1
  182. package/llms/components/lr-phone-input.md +2 -0
  183. package/llms/components/lr-select.md +2 -0
  184. package/llms/components/lr-sequence-playback.md +44 -0
  185. package/llms/components/lr-streaming-text-core.md +3 -2
  186. package/llms/components/lr-streaming-text.md +4 -1
  187. package/llms/components/lr-suggestion-chips.md +6 -2
  188. package/llms/components/lr-textarea.md +2 -0
  189. package/llms/components/lr-time-input.md +2 -0
  190. package/llms/components/lr-time-zone-picker.md +2 -0
  191. package/llms/components/lr-token-input.md +2 -0
  192. package/llms/components/lr-unit-picker.md +2 -0
  193. package/llms/components/lr-voice-picker.md +2 -0
  194. package/llms/peers.md +7 -7
  195. package/llms/shared/imports-and-registration.md +1 -1
  196. package/llms/shared/localization-and-rtl.md +15 -1
  197. package/llms/shared/testing-and-utilities.md +184 -0
  198. package/llms/shared.md +200 -2
  199. package/locales.json +1 -1
  200. package/package.json +37 -21
  201. package/registrations.json +1 -1
  202. package/skills/lyra-ui/lyra-gen.md +2 -0
  203. /package/dist/{components/media/image-viewer/image-viewer-panorama.styles.js → internal/media-panorama.styles.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{repeat}from"lit/directives/repeat.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";import{FormControlController,reflectFormName}from"../../../internal/form-control-controller.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{LyraFormControlElement}from"../../../internal/form-control-element.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{captureComposedFocusRepair,applyComposedFocusRepair}from"../../../internal/focus-navigation.js";import{VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{nextId}from"../../../internal/a11y.js";import{closeIcon}from"../../../internal/icons.js";import{autocorrectConverter,normalizeAutocorrect,spellcheckConverter}from"../../../internal/converters.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./token-input.styles.js";import{createStringArrayFormDataState,getFormOwner,isBarredFromValidation,readStringArrayFormDataState,setFormOwner}from"../../../internal/form-associated.js";import{LYRA_DEFAULT_selectSelectedOverflow,LYRA_DEFAULT_tokenInputEditWithContext,LYRA_DEFAULT_tokenInputRequired}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_removeWithContext}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();const delimiterConverter={fromAttribute:value=>value===null?",":value===""||value==="none"?null:value};function normalizeStringArray(value){if(!Array.isArray(value))return Object.freeze([]);try{const normalized=[];for(const entry of value)typeof entry=="string"&&normalized.push(entry);return Object.freeze(normalized)}catch{return Object.freeze([])}}const stringArrayConverter={fromAttribute:value=>{if(value===null)return null;try{const parsed=JSON.parse(value);return normalizeStringArray(parsed)}catch{return[]}},toAttribute:value=>value==null?null:JSON.stringify(value)};class LyraTokenInput extends LyraFormControlElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,removeWithContext:LYRA_DEFAULT_removeWithContext,selectSelectedOverflow:LYRA_DEFAULT_selectSelectedOverflow,tokenInputEditWithContext:LYRA_DEFAULT_tokenInputEditWithContext,tokenInputRequired:LYRA_DEFAULT_tokenInputRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},readonly:{type:Boolean,reflect:!0,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,converter:stringArrayConverter,noAccessor:!0}}}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get editable(){return this._editable}set editable(next){const old=this._editable;this._editable=!!next,this._editable||this.discardTransientState(!1),this.requestUpdate("editable",old)}tokenElement(index){return[...this.renderRoot.querySelectorAll('[part="token"]')].find(element=>this.tokenIndices.get(element)===index)}get visibleTokenEntries(){if(this.tokenEntriesFor!==this.value){this.tokenEntriesFor=this.value;const occurrences=new Map;this.tokenEntries=this.value.map((token,index)=>{const count=occurrences.get(token)??0;return occurrences.set(token,count+1),{token,index,key:`${token.length}:${token}:${count}`}})}const limit=finiteCount(this.maxTokensVisible,0);if(!limit||this.tokenEntries.length<=limit)return this.tokenEntries;const retained=new Set,focused=shadowFocusTarget(this)?.closest('[part="token"]'),focusedIndex=focused?this.tokenIndices.get(focused)??-1:-1;for(const index of[this.editingIndex,this.focusTokenPending,this.tokenFocusRepairPending?.index??-1,this.editable?this.activeTokenIndex:-1,focusedIndex])index>=0&&index<this.value.length&&retained.size<limit&&retained.add(index);for(let index=0;index<limit&&retained.size<limit;index++)retained.add(index);return[...retained].sort((a,b)=>a-b).map(index=>this.tokenEntries[index])}tokenEventIndex(event){const token=event.composedPath().find(target=>target.nodeType===1&&target.getAttribute("part")==="token");return token?this.tokenIndices.get(token)??-1:-1}syncExternalDescription(){const target=this.isConnected?this.inputEl:void 0;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0);const normalized=normalizeStringArray(next);this.captureTokenFocusRepair(normalized),this.editingIndex>=0&&normalized!==old&&(this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1),this._value=normalized,this.requestUpdate("value",old),this.internals&&this.syncValidity()}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=normalizeStringArray(next),this.reflectingDefaultValue=!0;try{next==null?this.removeAttribute("value"):this.setAttribute("value",JSON.stringify(this._defaultValue))}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",reflectFormName(this,this._name),this.syncValidity(),this.requestUpdate("name",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.syncValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled,wasEffectivelyDisabled=this.effectiveDisabled;this._disabled=!!next,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.toggleAttribute("disabled",this._disabled),this._fieldsetDisabled=this.validityController?.fieldsetDisabled(this._fieldsetDisabled)??this._fieldsetDisabled,this.syncValidity(),this.requestUpdate("disabled",old)}get readonly(){return this._readonly}set readonly(next){const old=this._readonly,nextValue=!!next;!old&&nextValue&&this.discardTransientState(!0),this._readonly=nextValue,this.toggleAttribute("readonly",this._readonly),this.syncValidity(),this.requestUpdate("readonly",old)}constructor(){super(),this.label="",this.hint="",this.errorText="",this.placeholder="",this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.accessibleLabel="",this.size="m",this.pill=!1,this.allowDuplicates=!1,this._editable=!1,this.delimiter=",",this.maxTokensVisible=0,this.tokenIndices=new WeakMap,this.tokenEntries=[],this.renderedTokenValues=[],this.onTokenClick=event=>{const index=this.tokenEventIndex(event);if(index<0)return;const target=event.composedPath().find(target2=>target2.nodeType===1&&(target2.getAttribute("part")==="remove"||target2.getAttribute("part")==="token-label"));target?.getAttribute("part")==="remove"?this.removeToken(index):target&&this.startEdit(index)},this.onTokenFocus=event=>{const index=this.tokenEventIndex(event);index>=0&&this.rovingIndex!==index&&(this.rovingIndex=index)},this.onTokenKey=event=>{if(event.target.getAttribute("part")!=="token-label")return;const index=this.tokenEventIndex(event);index>=0&&this.onTokenKeyDown(event,index)},this.draft="",this.touched=!1,this.editingIndex=-1,this.editDraft="",this.rovingIndex=0,this.focusEditorPending=!1,this.focusTokenPending=-1,this.editorBlurRelayed=!1,this.slotPresence=new SlotPresenceController(this),this.labelId=nextId("token-input-label"),this.hintId=nextId("token-input-hint"),this.errorId=nextId("token-input-error"),this._value=Object.freeze([]),this._defaultValue=Object.freeze([]),this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this._fieldsetDisabled=!1,this._name="",this._required=!1,this._disabled=!1,this._readonly=!1,this.markInteracted=()=>{this.touched||(this.touched=!0,this.syncValidity())},this.onEditInput=event=>{event.stopPropagation(),!(this.liveDisabled||this.readonly)&&(this.editDraft=event.target.value)},this.onEditFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}this.editorBlurRelayed=!1,relayNativeEvent(this,event)},this.onEditKeyDown=event=>{event.isComposing||event.keyCode===229||(event.key==="Enter"?(event.preventDefault(),this.commitEdit(!0)):event.key==="Escape"&&(event.preventDefault(),event.stopPropagation(),this.cancelEdit()))},this.onEditBlur=event=>{if(this.editorBlurRelayed){event.stopPropagation();return}this.editorBlurRelayed=!0,event.stopPropagation(),queueMicrotask(()=>{!this.isConnected||!this.editable||this.liveDisabled?this.discardTransientState(!1):this.commitEdit(!1),relayNativeEvent(this,event)})},this.onInput=event=>{event.stopPropagation(),!(this.liveDisabled||this.readonly)&&(this.draft=event.target.value)},this.onKeyDown=event=>{event.isComposing||event.keyCode===229||this.liveDisabled||(event.key==="Enter"||this.delimiter!==null&&event.key===this.delimiter?this.draft.trim()?(event.preventDefault(),this.addDraft()):event.key==="Enter"&&submitOnEnter(this,event):event.key==="Tab"?this.draft.trim()&&this.addDraft():event.key==="Backspace"&&!this.draft&&this.value.length&&this.editingIndex<0&&this.removeToken(this.value.length-1))},this.onBlur=event=>{this.liveDisabled||(this.draft.trim()&&this.addDraft(),this.touched=!0),this.syncValidity(),relayNativeEvent(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.validityController=new FormControlController(this,{invalid:init=>this.emit("lr-invalid",null,init),interacted:this.markInteracted,customError:()=>this.validityController.customValidityMessage}),this.internals=this.validityController.formInternals}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncValidity()}disconnectedCallback(){this.releaseExternalDescription(),this.tokenFocusRepairPending=void 0,this.discardTransientState(!0),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncExternalDescription()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formDisabledCallback(disabled){if(this.validityController?.reflectingDisabled)return;const wasEffectivelyDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.syncValidity(),this.requestUpdate()}[VALIDITY_ANCHOR](){return this.inputEl??this.renderRoot?.querySelector('[part="input-wrapper"]')??null}checkValidity(){return this.validityController.checkValidity()}reportValidity(){return this.validityController.syncConstraints(),this.touched=!0,this.syncValidity(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidity()}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.inputEl?.focus(options)}blur(){const active=shadowFocusTarget(this);active&&typeof active.blur=="function"&&active.blur()}click(){this.liveDisabled||this.inputEl?.focus()}select(){this.inputEl?.select()}get selectionStart(){return this.inputEl?.selectionStart??null}set selectionStart(value){this.inputEl&&(this.inputEl.selectionStart=value??0)}get selectionEnd(){return this.inputEl?.selectionEnd??null}set selectionEnd(value){this.inputEl&&(this.inputEl.selectionEnd=value??0)}get selectionDirection(){return this.inputEl?.selectionDirection??null}set selectionDirection(value){this.inputEl&&(this.inputEl.selectionDirection=value??"none")}setSelectionRange(selectionStart,selectionEnd,selectionDirection="none"){this.inputEl?.setSelectionRange(selectionStart,selectionEnd,selectionDirection??"none")}setRangeText(replacement,start,end,selectMode="preserve"){const input=this.inputEl;input&&(setNativeRangeText(input,replacement,start,end,selectMode),this.draft=input.value)}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncValidity(){const barred=this.barredFromValidation,missing=!barred&&this.required&&this.value.length===0;this.validityController.setValidity(missing?{valueMissing:!0}:{},missing?this.localize("tokenInputRequired"):""),this.toggleAttribute("data-invalid",!barred&&this.touched&&!this.internals.validity.valid),syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred});const data=new FormData;this.name&&this.value.forEach(token=>data.append(this.name,token)),this.internals.setFormValue(this.name?data:null,createStringArrayFormDataState(this.name,this.value))}updateValue(next){const previousValue=Object.freeze([...this.value]);this.value=next,this.syncValidity();const detail=()=>Object.freeze({value:Object.freeze([...this.value]),previousValue});dispatchNativeInputEvent(this),this.emit("lr-input",detail()),dispatchNativeEvent(this,"change"),this.emit("lr-change",detail())}addDraft(){if(this.liveDisabled||this.readonly)return;const candidates=(this.delimiter?this.draft.split(this.delimiter):[this.draft]).map(token=>token.trim()).filter(Boolean),next=[...this.value],seen=this.allowDuplicates?null:new Set(next),added=[];for(const token of candidates)seen?.has(token)||(seen?.add(token),next.push(token),added.push(token));if(added.length===0){this.draft="";return}const addDetail=()=>Object.freeze({value:added[added.length-1],values:Object.freeze([...added])});this.emit("lr-token-add-request",addDetail(),{cancelable:!0}).defaultPrevented||(this.updateValue(next),this.draft="")}discardTransientState(clearDraft){this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1,this.focusTokenPending=-1,clearDraft&&(this.draft="",this.inputEl&&(this.inputEl.value=""))}retireDisabledInteraction(){this.tokenFocusRepairPending=void 0,this.discardTransientState(!0);const active=shadowFocusTarget(this);active&&typeof active.blur=="function"&&active.blur()}captureTokenFocusRepair(next){this.tokenFocusRepairPending=void 0;const active=shadowFocusTarget(this),token=typeof active?.closest=="function"?active.closest('[part~="token"]'):null;if(!active||!token)return;const index=this.tokenIndices.get(token)??-1;if(!Number.isInteger(index)||index<0||next.length>=this.renderedTokenValues.length&&next[index]===this.renderedTokenValues[index])return;const repair=captureComposedFocusRepair(this,active);if(!repair)return;const targetIndex=Math.min(index,Math.max(0,next.length-1));this.rovingIndex=targetIndex,this.tokenFocusRepairPending={index:targetIndex,surface:active.matches('[part~="remove"]')?"remove":"label",repair}}removeToken(index){if(this.liveDisabled||this.readonly)return;const removed=this.value[index];removed===void 0||this.emit("lr-token-remove-request",{value:removed,index},{cancelable:!0}).defaultPrevented||(this.editingIndex>=0&&(this.editingIndex=-1,this.editDraft=""),this.updateValue(this.value.filter((_token,i)=>i!==index)))}get activeTokenIndex(){return this.value.length?Math.min(Math.max(this.rovingIndex,0),this.value.length-1):-1}startEdit(index){this.liveDisabled||this.readonly||!this.editable||index<0||index>=this.value.length||(this.editingIndex=index,this.editDraft=this.value[index],this.rovingIndex=index,this.editorBlurRelayed=!1,this.focusEditorPending=!0)}cancelEdit(){this.editingIndex<0||(this.focusTokenPending=this.editingIndex,this.editingIndex=-1,this.editDraft="")}commitEdit(restoreFocus){if(this.liveDisabled||this.readonly){this.discardTransientState(!1);return}const index=this.editingIndex;if(index<0)return;const previousValue=this.value[index],next=this.editDraft.trim();if(previousValue===void 0||!next||next===previousValue||!this.allowDuplicates&&this.value.some((token,i)=>i!==index&&token===next)){restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="";return}this.emit("lr-token-edit-request",{value:next,previousValue,index},{cancelable:!0}).defaultPrevented||(restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="",this.updateValue(this.value.map((token,i)=>i===index?next:token)))}moveRovingFocus(index){if(!this.value.length)return;const clamped=Math.min(Math.max(index,0),this.value.length-1);this.rovingIndex=clamped,this.focusTokenPending=clamped}onTokenKeyDown(event,index){if(this.liveDisabled)return;const rtl=this.effectiveDirection==="rtl",forward=rtl?"ArrowLeft":"ArrowRight",backward=rtl?"ArrowRight":"ArrowLeft";event.key==="Enter"||event.key===" "||event.key==="F2"?(event.preventDefault(),this.startEdit(index)):event.key===forward?(event.preventDefault(),this.moveRovingFocus(index+1)):event.key===backward?(event.preventDefault(),this.moveRovingFocus(index-1)):event.key==="Home"?(event.preventDefault(),this.moveRovingFocus(0)):event.key==="End"&&(event.preventDefault(),this.moveRovingFocus(this.value.length-1))}stopInternalChange(event){event.stopPropagation()}formResetCallback(){this.restoreLiveValueFromDefault(),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=[...this._defaultValue]}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=readStringArrayFormDataState(state2),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}updated(changed){if(super.updated(changed),this.syncExternalDescription(),this.focusEditorPending){this.focusEditorPending=!1;const editor=this.renderRoot?.querySelector('[part="token-editor"]');editor?.focus(),editor?.select()}if(this.focusTokenPending>=0){const index=this.focusTokenPending;this.focusTokenPending=-1;const label=this.tokenElement(index)?.querySelector('[part="token-label"]');label?.focus(),label?.scrollIntoView({block:"nearest",inline:"nearest"})}const pending=this.tokenFocusRepairPending;if(this.tokenFocusRepairPending=void 0,pending){const token=this.tokenElement(pending.index),target=(pending.surface==="remove"?token?.querySelector('[part~="remove"]'):token?.querySelector('[part~="token-label"]'))??token?.querySelector('[part~="remove"]')??this.inputEl??null;applyComposedFocusRepair(pending.repair,target)&&target?.scrollIntoView({block:"nearest",inline:"nearest"})}}renderRemoveButton(token){return html`<button
1
+ import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{repeat}from"lit/directives/repeat.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";import{FormControlController,reflectFormName}from"../../../internal/form-control-controller.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{LyraFormControlElement}from"../../../internal/form-control-element.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{captureComposedFocusRepair,applyComposedFocusRepair}from"../../../internal/focus-navigation.js";import{VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{nextId}from"../../../internal/a11y.js";import{closeIcon}from"../../../internal/icons.js";import{autocorrectConverter,normalizeAutocorrect,spellcheckConverter}from"../../../internal/converters.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./token-input.styles.js";import{createStringArrayFormDataState,getFormOwner,isBarredFromValidation,readStringArrayFormDataState,setFormOwner}from"../../../internal/form-associated.js";import{LYRA_DEFAULT_selectSelectedOverflow,LYRA_DEFAULT_tokenInputEditWithContext,LYRA_DEFAULT_tokenInputRequired}from"../../../internal/default-strings/forms.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_removeWithContext}from"../../../internal/default-strings/shared.generated.js";installFormControlLabelSupport();const delimiterConverter={fromAttribute:value=>value===null?",":value===""||value==="none"?null:value};function normalizeStringArray(value){if(!Array.isArray(value))return Object.freeze([]);try{const normalized=[];for(const entry of value)typeof entry=="string"&&normalized.push(entry);return Object.freeze(normalized)}catch{return Object.freeze([])}}const stringArrayConverter={fromAttribute:value=>{if(value===null)return null;try{const parsed=JSON.parse(value);return normalizeStringArray(parsed)}catch{return[]}},toAttribute:value=>value==null?null:JSON.stringify(value)};class LyraTokenInput extends LyraFormControlElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,removeWithContext:LYRA_DEFAULT_removeWithContext,selectSelectedOverflow:LYRA_DEFAULT_selectSelectedOverflow,tokenInputEditWithContext:LYRA_DEFAULT_tokenInputEditWithContext,tokenInputRequired:LYRA_DEFAULT_tokenInputRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},readonly:{type:Boolean,reflect:!0,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,converter:stringArrayConverter,noAccessor:!0}}}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get editable(){return this._editable}set editable(next){const old=this._editable;this._editable=!!next,this._editable||this.discardTransientState(!1),this.requestUpdate("editable",old)}tokenElement(index){return[...this.renderRoot.querySelectorAll('[part="token"]')].find(element=>this.tokenIndices.get(element)===index)}get visibleTokenEntries(){if(this.tokenEntriesFor!==this.value){this.tokenEntriesFor=this.value;const occurrences=new Map;this.tokenEntries=this.value.map((token,index)=>{const count=occurrences.get(token)??0;return occurrences.set(token,count+1),{token,index,key:`${token.length}:${token}:${count}`}})}const limit=finiteCount(this.maxTokensVisible,0);if(!limit||this.tokenEntries.length<=limit)return this.tokenEntries;const retained=new Set,focused=shadowFocusTarget(this)?.closest('[part="token"]'),focusedIndex=focused?this.tokenIndices.get(focused)??-1:-1;for(const index of[this.editingIndex,this.focusTokenPending,this.tokenFocusRepairPending?.index??-1,this.editable?this.activeTokenIndex:-1,focusedIndex])index>=0&&index<this.value.length&&retained.size<limit&&retained.add(index);for(let index=0;index<limit&&retained.size<limit;index++)retained.add(index);return[...retained].sort((a,b)=>a-b).map(index=>this.tokenEntries[index])}tokenEventIndex(event){const token=event.composedPath().find(target=>target.nodeType===1&&target.getAttribute("part")==="token");return token?this.tokenIndices.get(token)??-1:-1}syncExternalDescription(){const target=this.isConnected?this.inputEl:void 0;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0);const normalized=normalizeStringArray(next);this.captureTokenFocusRepair(normalized),this.editingIndex>=0&&normalized!==old&&(this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1),this._value=normalized,this.requestUpdate("value",old),this.internals&&this.syncValidity()}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=normalizeStringArray(next),this.reflectingDefaultValue=!0;try{next==null?this.removeAttribute("value"):this.setAttribute("value",JSON.stringify(this._defaultValue))}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",reflectFormName(this,this._name),this.syncValidity(),this.requestUpdate("name",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.syncValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled,wasEffectivelyDisabled=this.effectiveDisabled;this._disabled=!!next,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.toggleAttribute("disabled",this._disabled),this._fieldsetDisabled=this.validityController?.fieldsetDisabled(this._fieldsetDisabled)??this._fieldsetDisabled,this.syncValidity(),this.requestUpdate("disabled",old)}get readonly(){return this._readonly}set readonly(next){const old=this._readonly,nextValue=!!next;!old&&nextValue&&this.discardTransientState(!0),this._readonly=nextValue,this.toggleAttribute("readonly",this._readonly),this.syncValidity(),this.requestUpdate("readonly",old)}constructor(){super(),this.label="",this.labelDisplay="visible",this.hint="",this.errorText="",this.placeholder="",this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.accessibleLabel="",this.size="m",this.pill=!1,this.allowDuplicates=!1,this._editable=!1,this.delimiter=",",this.maxTokensVisible=0,this.tokenIndices=new WeakMap,this.tokenEntries=[],this.renderedTokenValues=[],this.onTokenClick=event=>{const index=this.tokenEventIndex(event);if(index<0)return;const target=event.composedPath().find(target2=>target2.nodeType===1&&(target2.getAttribute("part")==="remove"||target2.getAttribute("part")==="token-label"));target?.getAttribute("part")==="remove"?this.removeToken(index):target&&this.startEdit(index)},this.onTokenFocus=event=>{const index=this.tokenEventIndex(event);index>=0&&this.rovingIndex!==index&&(this.rovingIndex=index)},this.onTokenKey=event=>{if(event.target.getAttribute("part")!=="token-label")return;const index=this.tokenEventIndex(event);index>=0&&this.onTokenKeyDown(event,index)},this.draft="",this.touched=!1,this.editingIndex=-1,this.editDraft="",this.rovingIndex=0,this.focusEditorPending=!1,this.focusTokenPending=-1,this.editorBlurRelayed=!1,this.slotPresence=new SlotPresenceController(this),this.labelId=nextId("token-input-label"),this.hintId=nextId("token-input-hint"),this.errorId=nextId("token-input-error"),this._value=Object.freeze([]),this._defaultValue=Object.freeze([]),this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this._fieldsetDisabled=!1,this._name="",this._required=!1,this._disabled=!1,this._readonly=!1,this.markInteracted=()=>{this.touched||(this.touched=!0,this.syncValidity())},this.onEditInput=event=>{event.stopPropagation(),!(this.liveDisabled||this.readonly)&&(this.editDraft=event.target.value)},this.onEditFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}this.editorBlurRelayed=!1,relayNativeEvent(this,event)},this.onEditKeyDown=event=>{event.isComposing||event.keyCode===229||(event.key==="Enter"?(event.preventDefault(),this.commitEdit(!0)):event.key==="Escape"&&(event.preventDefault(),event.stopPropagation(),this.cancelEdit()))},this.onEditBlur=event=>{if(this.editorBlurRelayed){event.stopPropagation();return}this.editorBlurRelayed=!0,event.stopPropagation(),queueMicrotask(()=>{!this.isConnected||!this.editable||this.liveDisabled?this.discardTransientState(!1):this.commitEdit(!1),relayNativeEvent(this,event)})},this.onInput=event=>{event.stopPropagation(),!(this.liveDisabled||this.readonly)&&(this.draft=event.target.value)},this.onKeyDown=event=>{event.isComposing||event.keyCode===229||this.liveDisabled||(event.key==="Enter"||this.delimiter!==null&&event.key===this.delimiter?this.draft.trim()?(event.preventDefault(),this.addDraft()):event.key==="Enter"&&submitOnEnter(this,event):event.key==="Tab"?this.draft.trim()&&this.addDraft():event.key==="Backspace"&&!this.draft&&this.value.length&&this.editingIndex<0&&this.removeToken(this.value.length-1))},this.onBlur=event=>{this.liveDisabled||(this.draft.trim()&&this.addDraft(),this.touched=!0),this.syncValidity(),relayNativeEvent(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.validityController=new FormControlController(this,{invalid:init=>this.emit("lr-invalid",null,init),interacted:this.markInteracted,customError:()=>this.validityController.customValidityMessage}),this.internals=this.validityController.formInternals}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncValidity()}disconnectedCallback(){this.releaseExternalDescription(),this.tokenFocusRepairPending=void 0,this.discardTransientState(!0),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncExternalDescription()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formDisabledCallback(disabled){if(this.validityController?.reflectingDisabled)return;const wasEffectivelyDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.syncValidity(),this.requestUpdate()}[VALIDITY_ANCHOR](){return this.inputEl??this.renderRoot?.querySelector('[part="input-wrapper"]')??null}checkValidity(){return this.validityController.checkValidity()}reportValidity(){return this.validityController.syncConstraints(),this.touched=!0,this.syncValidity(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidity()}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.inputEl?.focus(options)}blur(){const active=shadowFocusTarget(this);active&&typeof active.blur=="function"&&active.blur()}click(){this.liveDisabled||this.inputEl?.focus()}select(){this.inputEl?.select()}get selectionStart(){return this.inputEl?.selectionStart??null}set selectionStart(value){this.inputEl&&(this.inputEl.selectionStart=value??0)}get selectionEnd(){return this.inputEl?.selectionEnd??null}set selectionEnd(value){this.inputEl&&(this.inputEl.selectionEnd=value??0)}get selectionDirection(){return this.inputEl?.selectionDirection??null}set selectionDirection(value){this.inputEl&&(this.inputEl.selectionDirection=value??"none")}setSelectionRange(selectionStart,selectionEnd,selectionDirection="none"){this.inputEl?.setSelectionRange(selectionStart,selectionEnd,selectionDirection??"none")}setRangeText(replacement,start,end,selectMode="preserve"){const input=this.inputEl;input&&(setNativeRangeText(input,replacement,start,end,selectMode),this.draft=input.value)}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncValidity(){const barred=this.barredFromValidation,missing=!barred&&this.required&&this.value.length===0;this.validityController.setValidity(missing?{valueMissing:!0}:{},missing?this.localize("tokenInputRequired"):""),this.toggleAttribute("data-invalid",!barred&&this.touched&&!this.internals.validity.valid),syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred});const data=new FormData;this.name&&this.value.forEach(token=>data.append(this.name,token)),this.internals.setFormValue(this.name?data:null,createStringArrayFormDataState(this.name,this.value))}updateValue(next){const previousValue=Object.freeze([...this.value]);this.value=next,this.syncValidity();const detail=()=>Object.freeze({value:Object.freeze([...this.value]),previousValue});dispatchNativeInputEvent(this),this.emit("lr-input",detail()),dispatchNativeEvent(this,"change"),this.emit("lr-change",detail())}addDraft(){if(this.liveDisabled||this.readonly)return;const candidates=(this.delimiter?this.draft.split(this.delimiter):[this.draft]).map(token=>token.trim()).filter(Boolean),next=[...this.value],seen=this.allowDuplicates?null:new Set(next),added=[];for(const token of candidates)seen?.has(token)||(seen?.add(token),next.push(token),added.push(token));if(added.length===0){this.draft="";return}const addDetail=()=>Object.freeze({value:added[added.length-1],values:Object.freeze([...added])});this.emit("lr-token-add-request",addDetail(),{cancelable:!0}).defaultPrevented||(this.updateValue(next),this.draft="")}discardTransientState(clearDraft){this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1,this.focusTokenPending=-1,clearDraft&&(this.draft="",this.inputEl&&(this.inputEl.value=""))}retireDisabledInteraction(){this.tokenFocusRepairPending=void 0,this.discardTransientState(!0);const active=shadowFocusTarget(this);active&&typeof active.blur=="function"&&active.blur()}captureTokenFocusRepair(next){this.tokenFocusRepairPending=void 0;const active=shadowFocusTarget(this),token=typeof active?.closest=="function"?active.closest('[part~="token"]'):null;if(!active||!token)return;const index=this.tokenIndices.get(token)??-1;if(!Number.isInteger(index)||index<0||next.length>=this.renderedTokenValues.length&&next[index]===this.renderedTokenValues[index])return;const repair=captureComposedFocusRepair(this,active);if(!repair)return;const targetIndex=Math.min(index,Math.max(0,next.length-1));this.rovingIndex=targetIndex,this.tokenFocusRepairPending={index:targetIndex,surface:active.matches('[part~="remove"]')?"remove":"label",repair}}removeToken(index){if(this.liveDisabled||this.readonly)return;const removed=this.value[index];removed===void 0||this.emit("lr-token-remove-request",{value:removed,index},{cancelable:!0}).defaultPrevented||(this.editingIndex>=0&&(this.editingIndex=-1,this.editDraft=""),this.updateValue(this.value.filter((_token,i)=>i!==index)))}get activeTokenIndex(){return this.value.length?Math.min(Math.max(this.rovingIndex,0),this.value.length-1):-1}startEdit(index){this.liveDisabled||this.readonly||!this.editable||index<0||index>=this.value.length||(this.editingIndex=index,this.editDraft=this.value[index],this.rovingIndex=index,this.editorBlurRelayed=!1,this.focusEditorPending=!0)}cancelEdit(){this.editingIndex<0||(this.focusTokenPending=this.editingIndex,this.editingIndex=-1,this.editDraft="")}commitEdit(restoreFocus){if(this.liveDisabled||this.readonly){this.discardTransientState(!1);return}const index=this.editingIndex;if(index<0)return;const previousValue=this.value[index],next=this.editDraft.trim();if(previousValue===void 0||!next||next===previousValue||!this.allowDuplicates&&this.value.some((token,i)=>i!==index&&token===next)){restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="";return}this.emit("lr-token-edit-request",{value:next,previousValue,index},{cancelable:!0}).defaultPrevented||(restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="",this.updateValue(this.value.map((token,i)=>i===index?next:token)))}moveRovingFocus(index){if(!this.value.length)return;const clamped=Math.min(Math.max(index,0),this.value.length-1);this.rovingIndex=clamped,this.focusTokenPending=clamped}onTokenKeyDown(event,index){if(this.liveDisabled)return;const rtl=this.effectiveDirection==="rtl",forward=rtl?"ArrowLeft":"ArrowRight",backward=rtl?"ArrowRight":"ArrowLeft";event.key==="Enter"||event.key===" "||event.key==="F2"?(event.preventDefault(),this.startEdit(index)):event.key===forward?(event.preventDefault(),this.moveRovingFocus(index+1)):event.key===backward?(event.preventDefault(),this.moveRovingFocus(index-1)):event.key==="Home"?(event.preventDefault(),this.moveRovingFocus(0)):event.key==="End"&&(event.preventDefault(),this.moveRovingFocus(this.value.length-1))}stopInternalChange(event){event.stopPropagation()}formResetCallback(){this.restoreLiveValueFromDefault(),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=[...this._defaultValue]}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=readStringArrayFormDataState(state2),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}updated(changed){if(super.updated(changed),this.syncExternalDescription(),this.focusEditorPending){this.focusEditorPending=!1;const editor=this.renderRoot?.querySelector('[part="token-editor"]');editor?.focus(),editor?.select()}if(this.focusTokenPending>=0){const index=this.focusTokenPending;this.focusTokenPending=-1;const label=this.tokenElement(index)?.querySelector('[part="token-label"]');label?.focus(),label?.scrollIntoView({block:"nearest",inline:"nearest"})}const pending=this.tokenFocusRepairPending;if(this.tokenFocusRepairPending=void 0,pending){const token=this.tokenElement(pending.index),target=(pending.surface==="remove"?token?.querySelector('[part~="remove"]'):token?.querySelector('[part~="token-label"]'))??token?.querySelector('[part~="remove"]')??this.inputEl??null;applyComposedFocusRepair(pending.repair,target)&&target?.scrollIntoView({block:"nearest",inline:"nearest"})}}renderRemoveButton(token){return html`<button
2
2
  part="remove"
3
3
  type="button"
4
4
  aria-label=${this.localize("removeWithContext",void 0,{label:token})}
@@ -88,4 +88,4 @@ import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{repe
88
88
  <div part="error" id=${this.errorId} ?hidden=${!hasError}>
89
89
  ${this.errorText}<slot name="error"></slot>
90
90
  </div>
91
- </div>`}}__decorate([property()],LyraTokenInput.prototype,"label",void 0),__decorate([property()],LyraTokenInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraTokenInput.prototype,"errorText",void 0),__decorate([property()],LyraTokenInput.prototype,"placeholder",void 0),__decorate([property({converter:spellcheckConverter})],LyraTokenInput.prototype,"spellcheck",void 0),__decorate([property()],LyraTokenInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraTokenInput.prototype,"autocorrect",null),__decorate([property({attribute:"aria-label"})],LyraTokenInput.prototype,"accessibleLabel",void 0),__decorate([property({reflect:!0})],LyraTokenInput.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTokenInput.prototype,"pill",void 0),__decorate([property({attribute:"allow-duplicates",type:Boolean})],LyraTokenInput.prototype,"allowDuplicates",void 0),__decorate([property({attribute:"editable",type:Boolean,reflect:!0})],LyraTokenInput.prototype,"editable",null),__decorate([property({attribute:"delimiter",converter:delimiterConverter})],LyraTokenInput.prototype,"delimiter",void 0),__decorate([property({type:Number,attribute:"max-tokens-visible"})],LyraTokenInput.prototype,"maxTokensVisible",void 0),__decorate([state()],LyraTokenInput.prototype,"draft",void 0),__decorate([state()],LyraTokenInput.prototype,"touched",void 0),__decorate([state()],LyraTokenInput.prototype,"editingIndex",void 0),__decorate([state()],LyraTokenInput.prototype,"editDraft",void 0),__decorate([state()],LyraTokenInput.prototype,"rovingIndex",void 0),__decorate([query("#input")],LyraTokenInput.prototype,"inputEl",void 0),__decorate([property({attribute:!1})],LyraTokenInput.prototype,"value",null);export{LyraTokenInput};
91
+ </div>`}}__decorate([property()],LyraTokenInput.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraTokenInput.prototype,"labelDisplay",void 0),__decorate([property()],LyraTokenInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraTokenInput.prototype,"errorText",void 0),__decorate([property()],LyraTokenInput.prototype,"placeholder",void 0),__decorate([property({converter:spellcheckConverter})],LyraTokenInput.prototype,"spellcheck",void 0),__decorate([property()],LyraTokenInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraTokenInput.prototype,"autocorrect",null),__decorate([property({attribute:"aria-label"})],LyraTokenInput.prototype,"accessibleLabel",void 0),__decorate([property({reflect:!0})],LyraTokenInput.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTokenInput.prototype,"pill",void 0),__decorate([property({attribute:"allow-duplicates",type:Boolean})],LyraTokenInput.prototype,"allowDuplicates",void 0),__decorate([property({attribute:"editable",type:Boolean,reflect:!0})],LyraTokenInput.prototype,"editable",null),__decorate([property({attribute:"delimiter",converter:delimiterConverter})],LyraTokenInput.prototype,"delimiter",void 0),__decorate([property({type:Number,attribute:"max-tokens-visible"})],LyraTokenInput.prototype,"maxTokensVisible",void 0),__decorate([state()],LyraTokenInput.prototype,"draft",void 0),__decorate([state()],LyraTokenInput.prototype,"touched",void 0),__decorate([state()],LyraTokenInput.prototype,"editingIndex",void 0),__decorate([state()],LyraTokenInput.prototype,"editDraft",void 0),__decorate([state()],LyraTokenInput.prototype,"rovingIndex",void 0),__decorate([query("#input")],LyraTokenInput.prototype,"inputEl",void 0),__decorate([property({attribute:!1})],LyraTokenInput.prototype,"value",null);export{LyraTokenInput};
@@ -1 +1 @@
1
- import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{formControlTextWrap,formControlFocusHalo,formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box; --_lr-token-input-min-input-inline-size: var(--lr-size-4rem); --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-xs); --_lr-token-input-font-size: var(--lr-font-size-md-sm); --_lr-token-input-token-padding: var(--lr-space-2xs) var(--lr-space-xs); --_lr-token-input-gap: var(--lr-space-xs); --_lr-token-input-token-gap: var(--lr-space-2xs); --_lr-token-input-radius: var(--lr-radius); --_lr-token-input-control-min-height: var(--lr-form-control-height); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); } :host([pill]) { --_lr-token-input-radius: var(--lr-radius-pill); } :host([size="2xs"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-size-0-0625rem); --_lr-token-input-font-size: var(--lr-font-size-2xs); --_lr-token-input-token-padding: 0 var(--lr-space-2xs); } :host([size="xs"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-size-0-125rem); --_lr-token-input-font-size: var(--lr-font-size-xs); --_lr-token-input-token-padding: var(--lr-size-1px) var(--lr-space-2xs); } :host([size="s"]), :host([size="small"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-xs); --_lr-token-input-font-size: var(--lr-font-size-sm); --_lr-token-input-token-padding: var(--lr-space-2xs) var(--lr-space-xs); } :host([size="l"]), :host([size="large"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-m); --_lr-token-input-font-size: var(--lr-font-size-lg); --_lr-token-input-token-padding: var(--lr-space-xs) var(--lr-space-s); } :host([size="xl"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-l); --_lr-token-input-font-size: var(--lr-font-size-xl); --_lr-token-input-token-padding: var(--lr-space-s) var(--lr-space-m); } [part="form-control"] { display: grid; min-inline-size: 0; max-inline-size: 100%; gap: var(--lr-token-input-gap, var(--_lr-token-input-gap)); } [part="form-control-label"] { color: var(--lr-color-text); font-weight: var(--lr-font-weight-semibold); } :host([required]) [part="form-control-label"] > span[aria-hidden="true"] { display: none; } ${formControlRequiredMarker} [part='input-wrapper'] { display: flex; flex-wrap: wrap; min-inline-size: 0; max-inline-size: 100%; overflow-x: hidden; overflow-y: auto; align-items: center; gap: var(--lr-token-input-gap, var(--_lr-token-input-gap)); min-block-size: var( --lr-token-input-control-height, var( --lr-token-input-control-min-height, var(--_lr-token-input-control-min-height) ) ); block-size: var(--lr-token-input-control-height, auto); padding: var(--lr-token-input-padding, var(--_lr-token-input-padding)); font-size: var( --lr-token-input-font-size, var(--_lr-token-input-font-size) ); border: var(--lr-border-width-thin) solid var(--lr-token-input-border-color, var(--lr-color-border)); border-radius: var(--lr-token-input-radius, var(--_lr-token-input-radius)); background: var(--lr-token-input-fill, var(--lr-color-surface)); } [part="input-wrapper"]:focus-within { border-color: var( --lr-token-input-focus-border-color, var(--lr-color-brand) ); ${focusRing} ${formControlFocusHalo} } [part="input"] { flex: 1 1 var(--lr-token-input-input-inline-size, var(--lr-size-8rem)); min-inline-size: var( --lr-token-input-min-input-inline-size, var(--_lr-token-input-min-input-inline-size) ); padding-block: 0; border: 0; outline: 0; background: transparent; color: var(--lr-color-text); font: inherit; } [part="input"]::placeholder { color: var(--lr-color-text-quiet); } [part="start"], [part="end"] { flex: 0 0 auto; display: inline-flex; align-items: center; color: var(--lr-color-text-quiet); } [part="start"][hidden], [part="end"][hidden] { display: none; } [part="token"] { display: inline-flex; min-inline-size: 0; max-inline-size: 100%; overflow: hidden; align-items: center; gap: var(--lr-token-input-token-gap, var(--_lr-token-input-token-gap)); padding: var( --lr-token-input-token-padding, var(--_lr-token-input-token-padding) ); border-radius: var(--lr-token-input-radius, var(--_lr-token-input-radius)); background: var(--lr-token-input-token-bg, var(--lr-color-brand-quiet)); color: var(--lr-color-text); } [part="token"] > span:first-child { min-inline-size: 0; } [part="token"] > span:first-child, [part="token-label"] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part="remove"] { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; ${iconHitTarget} border: 0; padding: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part="remove"]:hover { background: var( --lr-token-input-remove-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ); } [part="remove"]:active { background: var( --lr-token-input-remove-pressed-bg, color-mix( in oklab, var( --lr-token-input-remove-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); } [part="remove"]:focus-visible { ${focusRing} } [part="remove"][aria-disabled="true"] { cursor: default; opacity: var(--lr-opacity-disabled); } [part="remove"][aria-disabled="true"]:hover, [part="remove"][aria-disabled="true"]:active { background: transparent; } [part="token-label"] { align-content: center; ${iconHitTarget} border-radius: var(--lr-token-input-radius, var(--_lr-token-input-radius)); cursor: pointer; transition: background-color var(--lr-transition-fast); } :host(:where(:not(:disabled))) [part="token-label"]:hover { background: var( --lr-token-input-edit-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ); } :host(:where(:not(:disabled))) [part="token-label"]:active { background: var( --lr-token-input-edit-pressed-bg, color-mix( in oklab, var( --lr-token-input-edit-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); } [part="token-label"]:focus-visible { ${focusRing} } :host(:disabled) [part="token-label"] { cursor: default; } [part="token-editor"] { inline-size: var(--lr-token-input-editor-inline-size, var(--lr-size-6rem)); max-inline-size: 100%; border: 0; outline: 0; padding: 0; background: transparent; color: inherit; font: inherit; } [part="token-editor"]::placeholder { color: var(--lr-color-text-quiet); } [part="hint"], [part="error"] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } [part="error"] { color: var(--lr-color-danger); } :host([data-invalid]) [part="input-wrapper"] { border-color: var( --lr-token-input-invalid-border-color, var(--lr-color-danger) ); } :host(:disabled) { opacity: var(--lr-opacity-disabled); } [part="form-control-label"], [part="hint"], [part="error"] { ${formControlTextWrap} } `;export{styles};
1
+ import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{formControlTextWrap,formControlFocusHalo,formControlRequiredMarker,formControlLabelDisplay}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box; --_lr-token-input-min-input-inline-size: var(--lr-size-4rem); --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-xs); --_lr-token-input-font-size: var(--lr-font-size-md-sm); --_lr-token-input-token-padding: var(--lr-space-2xs) var(--lr-space-xs); --_lr-token-input-gap: var(--lr-space-xs); --_lr-token-input-token-gap: var(--lr-space-2xs); --_lr-token-input-radius: var(--lr-radius); --_lr-token-input-control-min-height: var(--lr-form-control-height); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); } :host([pill]) { --_lr-token-input-radius: var(--lr-radius-pill); } :host([size="2xs"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-size-0-0625rem); --_lr-token-input-font-size: var(--lr-font-size-2xs); --_lr-token-input-token-padding: 0 var(--lr-space-2xs); } :host([size="xs"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-size-0-125rem); --_lr-token-input-font-size: var(--lr-font-size-xs); --_lr-token-input-token-padding: var(--lr-size-1px) var(--lr-space-2xs); } :host([size="s"]), :host([size="small"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-xs); --_lr-token-input-font-size: var(--lr-font-size-sm); --_lr-token-input-token-padding: var(--lr-space-2xs) var(--lr-space-xs); } :host([size="l"]), :host([size="large"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-m); --_lr-token-input-font-size: var(--lr-font-size-lg); --_lr-token-input-token-padding: var(--lr-space-xs) var(--lr-space-s); } :host([size="xl"]) { --_lr-token-input-padding: var(--lr-form-control-padding-block) var(--lr-space-l); --_lr-token-input-font-size: var(--lr-font-size-xl); --_lr-token-input-token-padding: var(--lr-space-s) var(--lr-space-m); } [part="form-control"] { display: grid; min-inline-size: 0; max-inline-size: 100%; gap: var(--lr-token-input-gap, var(--_lr-token-input-gap)); } [part="form-control-label"] { color: var(--lr-color-text); font-weight: var(--lr-font-weight-semibold); } :host([required]) [part="form-control-label"] > span[aria-hidden="true"] { display: none; } ${formControlRequiredMarker} ${formControlLabelDisplay} [part='input-wrapper'] { display: flex; flex-wrap: wrap; min-inline-size: 0; max-inline-size: 100%; overflow-x: hidden; overflow-y: auto; align-items: center; gap: var(--lr-token-input-gap, var(--_lr-token-input-gap)); min-block-size: var( --lr-token-input-control-height, var( --lr-token-input-control-min-height, var(--_lr-token-input-control-min-height) ) ); block-size: var(--lr-token-input-control-height, auto); padding: var(--lr-token-input-padding, var(--_lr-token-input-padding)); font-size: var( --lr-token-input-font-size, var(--_lr-token-input-font-size) ); border: var(--lr-border-width-thin) solid var(--lr-token-input-border-color, var(--lr-color-border)); border-radius: var(--lr-token-input-radius, var(--_lr-token-input-radius)); background: var(--lr-token-input-fill, var(--lr-color-surface)); } [part="input-wrapper"]:focus-within { border-color: var( --lr-token-input-focus-border-color, var(--lr-color-brand) ); ${focusRing} ${formControlFocusHalo} } [part="input"] { flex: 1 1 var(--lr-token-input-input-inline-size, var(--lr-size-8rem)); min-inline-size: var( --lr-token-input-min-input-inline-size, var(--_lr-token-input-min-input-inline-size) ); padding-block: 0; border: 0; outline: 0; background: transparent; color: var(--lr-color-text); font: inherit; } [part="input"]::placeholder { color: var(--lr-color-text-quiet); } [part="start"], [part="end"] { flex: 0 0 auto; display: inline-flex; align-items: center; color: var(--lr-color-text-quiet); } [part="start"][hidden], [part="end"][hidden] { display: none; } [part="token"] { display: inline-flex; min-inline-size: 0; max-inline-size: 100%; overflow: hidden; align-items: center; gap: var(--lr-token-input-token-gap, var(--_lr-token-input-token-gap)); padding: var( --lr-token-input-token-padding, var(--_lr-token-input-token-padding) ); border-radius: var(--lr-token-input-radius, var(--_lr-token-input-radius)); background: var(--lr-token-input-token-bg, var(--lr-color-brand-quiet)); color: var(--lr-color-text); } [part="token"] > span:first-child { min-inline-size: 0; } [part="token"] > span:first-child, [part="token-label"] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part="remove"] { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; ${iconHitTarget} border: 0; padding: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part="remove"]:hover { background: var( --lr-token-input-remove-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ); } [part="remove"]:active { background: var( --lr-token-input-remove-pressed-bg, color-mix( in oklab, var( --lr-token-input-remove-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); } [part="remove"]:focus-visible { ${focusRing} } [part="remove"][aria-disabled="true"] { cursor: default; opacity: var(--lr-opacity-disabled); } [part="remove"][aria-disabled="true"]:hover, [part="remove"][aria-disabled="true"]:active { background: transparent; } [part="token-label"] { align-content: center; ${iconHitTarget} border-radius: var(--lr-token-input-radius, var(--_lr-token-input-radius)); cursor: pointer; transition: background-color var(--lr-transition-fast); } :host(:where(:not(:disabled))) [part="token-label"]:hover { background: var( --lr-token-input-edit-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ); } :host(:where(:not(:disabled))) [part="token-label"]:active { background: var( --lr-token-input-edit-pressed-bg, color-mix( in oklab, var( --lr-token-input-edit-hover-bg, var(--lr-token-input-action-hover-bg, var(--lr-color-brand-quiet)) ), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); } [part="token-label"]:focus-visible { ${focusRing} } :host(:disabled) [part="token-label"] { cursor: default; } [part="token-editor"] { inline-size: var(--lr-token-input-editor-inline-size, var(--lr-size-6rem)); max-inline-size: 100%; border: 0; outline: 0; padding: 0; background: transparent; color: inherit; font: inherit; } [part="token-editor"]::placeholder { color: var(--lr-color-text-quiet); } [part="hint"], [part="error"] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } [part="error"] { color: var(--lr-color-danger); } :host([data-invalid]) [part="input-wrapper"] { border-color: var( --lr-token-input-invalid-border-color, var(--lr-color-danger) ); } :host(:disabled) { opacity: var(--lr-opacity-disabled); } [part="form-control-label"], [part="hint"], [part="error"] { ${formControlTextWrap} } `;export{styles};
@@ -83,8 +83,11 @@ readonly expanded:boolean;}export interface LyraDockPanelEventMap{'lr-resize-req
83
83
  * (drag affordance vs. button feedback).
84
84
  * @cssprop [--lr-dock-panel-handle-active-color=color-mix(in oklab, var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active))] -
85
85
  * Background of `handle` while actively dragged/pressed.
86
- * @cssprop [--lr-dock-panel-handle-hit-area=var(--lr-space-m)] - Requested resize target width;
87
- * the target is at least `--lr-icon-button-size` and stays inside the panel's clipped edge.
86
+ * @cssprop [--lr-dock-panel-handle-hit-area=var(--lr-space-m)] - Resize target width along the
87
+ * panel's inner edge, inside its clipped box and over its content. Precise pointers get exactly
88
+ * this width, so content beside the edge stays clickable (set it to the visible line, e.g. `3px`,
89
+ * to give the content every pixel); coarse or hover-less pointers get at least
90
+ * `--lr-icon-button-size`.
88
91
  * @status stable
89
92
  * @since 4.0.0
90
93
  */
@@ -1 +1 @@
1
- import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; box-sizing: border-box; --_lr-dock-panel-collapsed-size: var(--lr-icon-button-size); position: relative; } :host([placement="start"]), :host([placement="end"]) { block-size: 100%; } :host([placement="top"]), :host([placement="bottom"]) { inline-size: 100%; } :host([placement="start"][collapsed]), :host([placement="end"][collapsed]) { min-inline-size: var( --lr-dock-panel-collapsed-size, var(--_lr-dock-panel-collapsed-size) ); } :host([placement="top"][collapsed]), :host([placement="bottom"][collapsed]) { min-block-size: var( --lr-dock-panel-collapsed-size, var(--_lr-dock-panel-collapsed-size) ); } [part="base"] { position: relative; inline-size: 100%; block-size: 100%; background: var(--lr-color-surface); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); overflow: hidden; } [part="content"] { inline-size: 100%; block-size: 100%; overflow: auto; } [part="content"][hidden] { display: none; } [part="handle"] { position: absolute; background: var(--lr-color-border); touch-action: none; transition: background var(--lr-transition-fast); } [part="handle"]:hover { background: var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)); } [part="handle"]:focus-visible { background: var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)); outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-width)); } [part="handle"]:active { background: var( --lr-dock-panel-handle-active-color, color-mix( in oklab, var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); } [part="handle"]::before { content: ""; position: absolute; inline-size: max(var(--lr-icon-button-size), var(--lr-dock-panel-handle-hit-area, var(--lr-space-m))); block-size: 100%; inset-block-start: 0; inset-inline-start: 0; } :host([placement="start"]) [part="handle"]::before { inset-inline-start: auto; inset-inline-end: 0; } :host([placement="top"]) [part="handle"]::before, :host([placement="bottom"]) [part="handle"]::before { inline-size: 100%; block-size: max(var(--lr-icon-button-size), var(--lr-dock-panel-handle-hit-area, var(--lr-space-m))); inset-inline-start: 0; inset-block-start: 0; } :host([placement="top"]) [part="handle"]::before { inset-block-start: auto; inset-block-end: 0; } :host([placement="start"]) [part="handle"] { inset-block: 0; inset-inline-end: 0; inline-size: var(--lr-size-3px); cursor: col-resize; } :host([placement="end"]) [part="handle"] { inset-block: 0; inset-inline-start: 0; inline-size: var(--lr-size-3px); cursor: col-resize; } :host([placement="top"]) [part="handle"] { inset-inline: 0; inset-block-end: 0; block-size: var(--lr-size-3px); cursor: row-resize; } :host([placement="bottom"]) [part="handle"] { inset-inline: 0; inset-block-start: 0; block-size: var(--lr-size-3px); cursor: row-resize; } [part="collapse-toggle"] { position: absolute; display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); ${iconHitTarget} padding: 0; border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); cursor: pointer; font-size: var(--lr-font-size-xs); line-height: var(--lr-line-height-none); transition: background var(--lr-transition-fast), color var(--lr-transition-fast); z-index: var(--lr-layer-content); } [part="collapse-toggle"]:hover { background: var( --lr-dock-panel-collapse-toggle-hover-bg, var(--lr-color-brand-quiet) ); color: var( --lr-dock-panel-collapse-toggle-hover-color, var(--lr-color-brand) ); } [part="collapse-toggle"]:active { background: color-mix( in oklab, var( --lr-dock-panel-collapse-toggle-hover-bg, var(--lr-color-brand-quiet) ), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); color: var( --lr-dock-panel-collapse-toggle-hover-color, var(--lr-color-brand) ); } [part="collapse-toggle"]:focus-visible { ${focusRing} } :host([placement="start"]) [part="collapse-toggle"] { inset-inline-end: var(--lr-space-xs); inset-block-start: 50%; transform: translateY(-50%); } :host([placement="end"]) [part="collapse-toggle"] { inset-inline-start: var(--lr-space-xs); inset-block-start: 50%; transform: translateY(-50%); } :host([placement="top"]) [part="collapse-toggle"] { inset-block-end: var(--lr-space-xs); inset-inline-start: 50%; transform: translateX(-50%); } :host([placement="bottom"]) [part="collapse-toggle"] { inset-block-start: var(--lr-space-xs); inset-inline-start: 50%; transform: translateX(-50%); } :host(:dir(rtl)[placement="top"]) [part="collapse-toggle"], :host(:dir(rtl)[placement="bottom"]) [part="collapse-toggle"] { transform: translateX(50%); } :host([placement="start"]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host([placement="start"][collapsed]) [part="collapse-toggle"] span { transform: rotate(0deg); } :host([placement="end"]) [part="collapse-toggle"] span { transform: rotate(0deg); } :host([placement="end"][collapsed]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host(:dir(rtl)[placement="start"]) [part="collapse-toggle"] span { transform: rotate(0deg); } :host(:dir(rtl)[placement="start"][collapsed]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host(:dir(rtl)[placement="end"]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host(:dir(rtl)[placement="end"][collapsed]) [part="collapse-toggle"] span { transform: rotate(0deg); } @media (prefers-reduced-motion: reduce) { [part="collapse-toggle"], [part="handle"] { transition: none !important; } } `;export{styles};
1
+ import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; box-sizing: border-box; --_lr-dock-panel-collapsed-size: var(--lr-icon-button-size); position: relative; } :host([placement="start"]), :host([placement="end"]) { block-size: 100%; } :host([placement="top"]), :host([placement="bottom"]) { inline-size: 100%; } :host([placement="start"][collapsed]), :host([placement="end"][collapsed]) { min-inline-size: var( --lr-dock-panel-collapsed-size, var(--_lr-dock-panel-collapsed-size) ); } :host([placement="top"][collapsed]), :host([placement="bottom"][collapsed]) { min-block-size: var( --lr-dock-panel-collapsed-size, var(--_lr-dock-panel-collapsed-size) ); } [part="base"] { position: relative; inline-size: 100%; block-size: 100%; background: var(--lr-color-surface); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); overflow: hidden; } [part="content"] { inline-size: 100%; block-size: 100%; overflow: auto; } [part="content"][hidden] { display: none; } [part="handle"] { position: absolute; background: var(--lr-color-border); touch-action: none; transition: background var(--lr-transition-fast); } [part="handle"]:hover { background: var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)); } [part="handle"]:focus-visible { background: var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)); outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-width)); } [part="handle"]:active { background: var( --lr-dock-panel-handle-active-color, color-mix( in oklab, var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); } [part="handle"]::before { content: ""; position: absolute; --_lr-dock-panel-hit-area: var(--lr-dock-panel-handle-hit-area, var(--lr-space-m)); inline-size: var(--_lr-dock-panel-hit-area); block-size: 100%; inset-block-start: 0; inset-inline-start: 0; } :host([placement="start"]) [part="handle"]::before { inset-inline-start: auto; inset-inline-end: 0; } :host([placement="top"]) [part="handle"]::before, :host([placement="bottom"]) [part="handle"]::before { inline-size: 100%; block-size: var(--_lr-dock-panel-hit-area); inset-inline-start: 0; inset-block-start: 0; } :host([placement="top"]) [part="handle"]::before { inset-block-start: auto; inset-block-end: 0; } @media (hover: none), (pointer: coarse) { [part="handle"]::before { --_lr-dock-panel-hit-area: max( var(--lr-icon-button-size), var(--lr-dock-panel-handle-hit-area, var(--lr-space-m)) ); } } :host([placement="start"]) [part="handle"] { inset-block: 0; inset-inline-end: 0; inline-size: var(--lr-size-3px); cursor: col-resize; } :host([placement="end"]) [part="handle"] { inset-block: 0; inset-inline-start: 0; inline-size: var(--lr-size-3px); cursor: col-resize; } :host([placement="top"]) [part="handle"] { inset-inline: 0; inset-block-end: 0; block-size: var(--lr-size-3px); cursor: row-resize; } :host([placement="bottom"]) [part="handle"] { inset-inline: 0; inset-block-start: 0; block-size: var(--lr-size-3px); cursor: row-resize; } [part="collapse-toggle"] { position: absolute; display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); ${iconHitTarget} padding: 0; border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); cursor: pointer; font-size: var(--lr-font-size-xs); line-height: var(--lr-line-height-none); transition: background var(--lr-transition-fast), color var(--lr-transition-fast); z-index: var(--lr-layer-content); } [part="collapse-toggle"]:hover { background: var( --lr-dock-panel-collapse-toggle-hover-bg, var(--lr-color-brand-quiet) ); color: var( --lr-dock-panel-collapse-toggle-hover-color, var(--lr-color-brand) ); } [part="collapse-toggle"]:active { background: color-mix( in oklab, var( --lr-dock-panel-collapse-toggle-hover-bg, var(--lr-color-brand-quiet) ), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); color: var( --lr-dock-panel-collapse-toggle-hover-color, var(--lr-color-brand) ); } [part="collapse-toggle"]:focus-visible { ${focusRing} } :host([placement="start"]) [part="collapse-toggle"] { inset-inline-end: var(--lr-space-xs); inset-block-start: 50%; transform: translateY(-50%); } :host([placement="end"]) [part="collapse-toggle"] { inset-inline-start: var(--lr-space-xs); inset-block-start: 50%; transform: translateY(-50%); } :host([placement="top"]) [part="collapse-toggle"] { inset-block-end: var(--lr-space-xs); inset-inline-start: 50%; transform: translateX(-50%); } :host([placement="bottom"]) [part="collapse-toggle"] { inset-block-start: var(--lr-space-xs); inset-inline-start: 50%; transform: translateX(-50%); } :host(:dir(rtl)[placement="top"]) [part="collapse-toggle"], :host(:dir(rtl)[placement="bottom"]) [part="collapse-toggle"] { transform: translateX(50%); } :host([placement="start"]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host([placement="start"][collapsed]) [part="collapse-toggle"] span { transform: rotate(0deg); } :host([placement="end"]) [part="collapse-toggle"] span { transform: rotate(0deg); } :host([placement="end"][collapsed]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host(:dir(rtl)[placement="start"]) [part="collapse-toggle"] span { transform: rotate(0deg); } :host(:dir(rtl)[placement="start"][collapsed]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host(:dir(rtl)[placement="end"]) [part="collapse-toggle"] span { transform: rotate(180deg); } :host(:dir(rtl)[placement="end"][collapsed]) [part="collapse-toggle"] span { transform: rotate(0deg); } @media (prefers-reduced-motion: reduce) { [part="collapse-toggle"], [part="handle"] { transition: none !important; } } `;export{styles};
@@ -210,8 +210,11 @@ loading:boolean;
210
210
  * `[part="base"]` renders as a real `<a href=…>` instead of a `<span>`, and activation (click,
211
211
  * or the parent's Enter/Space handling, which forwards through `click()` for a link item so the
212
212
  * anchor's own native default action runs) navigates there in addition to firing the usual
213
- * `select()`/`lr-select` contract. An unsafe/unparseable `href` falls back to the plain `<span>`,
214
- * matching `lr-button`'s identical fallback. Mirrors `wa-dropdown-item`'s link-item support. */
213
+ * `select()`/`lr-select` contract. The anchor carries the row's accessible name as its own
214
+ * `aria-label` (a non-empty host `aria-label` wins, otherwise the visible label) and keeps it
215
+ * live when either changes, because its visible label sits behind the decorative label wrapper.
216
+ * An unsafe/unparseable `href` falls back to the plain `<span>`, matching `lr-button`'s
217
+ * identical fallback. Mirrors `wa-dropdown-item`'s link-item support. */
215
218
  href?:string;
216
219
  /** Native anchor `target`, used only while `href` resolves to a link. Setting this to `'_blank'`
217
220
  * (or any other target) always contributes `noopener noreferrer` to the rendered anchor's `rel`
@@ -224,7 +227,7 @@ rel?:string;
224
227
  /** Native anchor `download` attribute, used only while `href` resolves to a link. Narrows the
225
228
  * safe-URL allowlist to `safeDownloadHref`'s, which drops `mailto:` — a mail handoff names no
226
229
  * retrievable bytes, so it cannot be a download target. */
227
- download?:string;private get resolvedRel();private get resolvedHref();private hasIconSlot;private hasDetailsSlot;private hasSuffixSlot;private detailsSlot?;private submenuAssigned;private submenuExpanded;private submenuKind;private slottedLabel;private submenuPanel;private submenuPanelAttached;private submenuPanelGeneration;private nativeStateObserver?;private readonly labelTextObserver;private labelObservationGeneration;private announcedNativeState;private owningMenu;private readonly ownedName;private writingComputedName;private panelName;
230
+ download?:string;private get resolvedRel();private get resolvedHref();private hasIconSlot;private hasDetailsSlot;private hasSuffixSlot;private detailsSlot?;private submenuAssigned;private submenuExpanded;private submenuKind;private slottedLabel;private submenuPanel;private submenuPanelAttached;private submenuPanelGeneration;private nativeStateObserver?;private readonly labelTextObserver;private labelObservationGeneration;private announcedNativeState;private owningMenu;private readonly ownedName;private writingComputedName;private panelName;private renderedLinkName;
228
231
  /** Whether a nested `<lr-menu>` or direct mapped items are assigned to this item's `submenu`
229
232
  * slot, making it a submenu parent. */
230
233
  get hasSubmenu():boolean;
@@ -257,7 +260,7 @@ select():void;private proposeChecked;
257
260
  openSubmenu(focus?:MenuFocusTarget):Promise<void>;
258
261
  /** Closes this item's submenu (and, through it, any of its own descendants). A no-op without
259
262
  * one. Focus is left alone — the caller that moved it knows where it belongs. */
260
- closeSubmenu():Promise<void>;private onIconSlotChange;private onDetailsSlotChange;private syncDetailsSlot;private onSuffixSlotChange;private defaultLabelSlot;private isDefaultLabelBranch;private labelForwardingSlots;private isLabelSubtreeExcluded;private readSlottedLabel;private syncSlottedLabel;private onLabelSlotChange;private onForwardedLabelSlotChange;private onSubmenuSlotChange;private syncSubmenuSlot;private connectSubmenuPanel;private isCurrentSubmenuPanel;protected updated(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;private onPanelStateChange;private applyComputedName;private applyPanelName;
263
+ closeSubmenu():Promise<void>;private onIconSlotChange;private onDetailsSlotChange;private syncDetailsSlot;private onSuffixSlotChange;private defaultLabelSlot;private isDefaultLabelBranch;private labelForwardingSlots;private isLabelSubtreeExcluded;private readSlottedLabel;private syncSlottedLabel;private get linkName();private onLabelSlotChange;private onForwardedLabelSlotChange;private onSubmenuSlotChange;private syncSubmenuSlot;private connectSubmenuPanel;private isCurrentSubmenuPanel;protected updated(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;private onPanelStateChange;private applyComputedName;private applyPanelName;
261
264
  /** Text label used by type-ahead and Shoelace-compatible integrations. Kept live by the label
262
265
  * observer, so a read right after a label edit may lag it by one microtask. */
263
266
  getTextLabel():string;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-menu-item':LyraMenuItem;}}
@@ -12,7 +12,7 @@ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{html as s
12
12
  aria-hidden="true"
13
13
  focusable="false"
14
14
  ><polyline points="5 12.5 10 17.5 19 6.5"></polyline></svg>
15
- `}class LyraMenuItem extends LyraElement{static{this.knownUnobservedAttributes=["submenu-open"]}static{this.styles=[LyraElement.styles,sizes,styles]}get resolvedRel(){return resolveGuardedRel(this.rel,this.target)}get resolvedHref(){return(this.download!==void 0?safeDownloadHref(this.href):safeLinkHref(this.href))??void 0}get isLinkItem(){return this.resolvedHref!==void 0}get hasSubmenu(){return this.submenuAssigned}get submenuOpen(){return this.submenuExpanded}[menuItemOwner](owner,expectedOwner){owner===null&&expectedOwner&&this.owningMenu!==expectedOwner||(this.owningMenu=owner)}set submenuOpen(next){!!next!==this.submenuExpanded&&(next?this.openSubmenu("none"):this.closeSubmenu())}get interactionDisabled(){return this.disabled||this.loading}constructor(){super(),this.value="",this.size="m",this.disabled=!1,this.variant="default",this.type="normal",this.checked=!1,this.loading=!1,this.hasIconSlot=!1,this.hasDetailsSlot=!1,this.hasSuffixSlot=!1,this.submenuAssigned=!1,this.submenuExpanded=!1,this.slottedLabel="",this.submenuPanel=null,this.submenuPanelAttached=!1,this.submenuPanelGeneration=0,this.labelTextObserver=new AccessibleTextController(this,[],()=>this.syncSlottedLabel(),["data-hidden","label","slot"]),this.labelObservationGeneration=0,this.announcedNativeState="",this.owningMenu=null,this.ownedName={owns:!1,value:null},this.writingComputedName=!1,this.panelName={owns:!1,value:null},this.onNativeStateMutation=()=>{const signature=this.nativeStateSignature();signature!==this.announcedNativeState&&(this.announcedNativeState=signature,this.emitStateChange())},this.onIconSlotChange=()=>{this.hasIconSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="icon"||el.getAttribute("slot")==="prefix")},this.onDetailsSlotChange=e=>{this.syncDetailsSlot(e.target)},this.onSuffixSlotChange=()=>{this.hasSuffixSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="suffix")},this.onLabelSlotChange=event=>{this.labelTextObserver.bind(),this.syncSlottedLabel(event.target)},this.onForwardedLabelSlotChange=event=>{const slot=event.target;this.labelForwardingSlots().includes(slot)&&(this.labelTextObserver.bind(),this.syncSlottedLabel())},this.onSubmenuSlotChange=e=>{this.syncSubmenuSlot(e.target)},this.onPanelStateChange=open=>{this.submenuExpanded=open},this.addEventListener("mousedown",event=>{this.interactionDisabled&&event.preventDefault()})}connectedCallback(){super.connectedCallback();const initialLabel=this.readSlottedLabel(null,!1);initialLabel!==this.slottedLabel&&(this.slottedLabel=initialLabel),this.applyComputedName(),this.tabIndex!==0&&(this.tabIndex=-1),this.announcedNativeState=this.nativeStateSignature();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.nativeStateObserver=new MutationObserverCtor(this.onNativeStateMutation),this.nativeStateObserver.observe(this,{attributes:!0,attributeFilter:["hidden","inert","aria-hidden"]})),this.addEventListener("slotchange",this.onForwardedLabelSlotChange);const labelGeneration=++this.labelObservationGeneration;this.updateComplete.then(()=>{if(!this.isConnected||labelGeneration!==this.labelObservationGeneration)return;this.labelTextObserver.bind(),this.syncSlottedLabel();const submenuSlot=this.renderRoot.querySelector('slot[name="submenu"]');submenuSlot&&this.syncSubmenuSlot(submenuSlot)})}attributeChangedCallback(name,oldValue,value){name==="aria-label"&&this.writingComputedName||super.attributeChangedCallback(name,oldValue,value)}disconnectedCallback(){super.disconnectedCallback(),this.submenuPanelGeneration+=1,this.submenuExpanded=!1,this.nativeStateObserver?.disconnect(),this.nativeStateObserver=void 0,this.labelObservationGeneration+=1,this.removeEventListener("slotchange",this.onForwardedLabelSlotChange),this.submenuPanel&&this.submenuPanelAttached&&(this.submenuPanel[submenuPanelController].detach(this),this.submenuPanelAttached=!1)}adoptedCallback(){super.adoptedCallback(),this.labelTextObserver.adopted()}nativeStateSignature(){return`${this.hidden}|${this.inert}|${this.getAttribute("aria-hidden")}`}emitStateChange(){this.emit("lr-menu-item-state-change",{disabled:this.interactionDisabled,hidden:!!this.hidden,inert:this.inert})}willUpdate(changed){super.willUpdate(changed);const isCheckbox=this.type==="checkbox"&&!this.submenuAssigned,isRadio=this.type==="radio"&&!this.submenuAssigned;this.setAttribute("role",isCheckbox?"menuitemcheckbox":isRadio?"menuitemradio":"menuitem"),isCheckbox||isRadio?this.setAttribute("aria-checked",this.checked?"true":"false"):this.removeAttribute("aria-checked"),this.submenuAssigned?(this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",this.submenuExpanded?"true":"false")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded")),this.applyComputedName(),this.toggleAttribute("submenu-open",this.submenuExpanded),this.setAttribute("aria-disabled",String(this.interactionDisabled)),this.interactionDisabled&&(changed.has("disabled")||changed.has("loading"))&&(this.tabIndex=-1,activeElementIn(this.ownerDocument)===this&&this.blur()),(changed.has("disabled")||changed.has("loading"))&&this.emitStateChange()}click(){this.interactionDisabled||this.renderRoot.querySelector('[part~="base"]')?.click()}select(){if(!this.interactionDisabled){if(this.submenuPanel){this.openSubmenu("none");return}if(this.type==="checkbox"){const checked=!this.checked;this.proposeChecked(checked)&&(this.checked=checked)}else this.type==="radio"&&!this.checked&&this.proposeChecked(!0)&&(this.checked=!0,this.owningMenu?.uncheckRadioGroup(this,this.group));this.owningMenu?.activate(this)}}proposeChecked(checked){const value=this.value;return!this.emit("lr-menu-item-change-request",{value,checked},{cancelable:!0}).defaultPrevented}async openSubmenu(focus="first"){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||this.interactionDisabled||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],shown=controller.show(focus);this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await shown,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}async closeSubmenu(){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],hidden=controller.hide();this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await hidden,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}syncDetailsSlot(slot){const meaningful=node=>node.nodeType===Node.TEXT_NODE?(node.textContent??"").trim()!=="":node.nodeType!==Node.ELEMENT_NODE?!1:node instanceof HTMLSlotElement?node.assignedNodes({flatten:!0}).some(meaningful):!0;this.hasDetailsSlot=slot.assignedNodes({flatten:!0}).some(meaningful)}defaultLabelSlot(){return this.renderRoot?.querySelector("slot:not([name])")??null}isDefaultLabelBranch(node){let top=node;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode!==this?!1:top.nodeType!==1||(top.getAttribute("slot")??"")===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>this.isDefaultLabelBranch(slot))}isLabelSubtreeExcluded(element){return!(element.getRootNode()===this.renderRoot&&element.matches('[part~="label"][aria-hidden="true"][inert]:not([hidden])'))&&isAccessibilitySubtreeExcluded(element)}readSlottedLabel(slot=this.defaultLabelSlot(),requireRendered=!0){const nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes).filter(node=>this.isDefaultLabelBranch(node));return composedAccessibilityText(nodes,{ancestorBoundary:this,isSubtreeExcluded:element=>this.isLabelSubtreeExcluded(element),requireRendered,ignoreInheritedVisibility:!0}).replace(/\s+/g," ").trim()}syncSlottedLabel(slot=this.defaultLabelSlot()){const next=this.readSlottedLabel(slot);next!==this.slottedLabel&&(this.slottedLabel=next),this.applyComputedName(),this.applyPanelName()}syncSubmenuSlot(submenuSlot){if(!submenuSlot.isConnected||submenuSlot.getRootNode()!==this.renderRoot)return;const assigned=submenuSlot.assignedElements({flatten:!0}),authoredPanel=assigned.find(element=>element.localName===tag("menu")),hasDirectItems=assigned.some(element=>element.localName===tag("menu-item")||element.localName===tag("dropdown-item")),kind=authoredPanel?"panel":hasDirectItems?"items":void 0;if(this.submenuKind=kind,this.submenuAssigned=kind!==void 0,kind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");generated&&this.connectSubmenuPanel(generated);return}this.connectSubmenuPanel(authoredPanel??null)}connectSubmenuPanel(next){const samePanel=next===this.submenuPanel;if(samePanel&&(next===null||this.submenuPanelAttached))return;const previous=this.submenuPanel;if(++this.submenuPanelGeneration,previous&&this.submenuPanelAttached&&previous[submenuPanelController].detach(this),this.submenuPanelAttached=!1,samePanel||(this.submenuPanel=next,this.panelName={owns:!1,value:null}),!this.submenuPanel){this.submenuExpanded=!1;return}const controller=this.submenuPanel[submenuPanelController];controller.attach(this,this.onPanelStateChange),this.submenuPanelAttached=!0,this.submenuExpanded=controller.open,this.applyPanelName()}isCurrentSubmenuPanel(panel,generation){return this.isConnected&&this.submenuPanel===panel&&this.submenuPanelGeneration===generation}updated(changed){if(super.updated(changed),changed.has("submenuKind")&&this.submenuKind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");this.connectSubmenuPanel(generated)}}firstUpdated(changed){super.firstUpdated(changed);const detailsSlot=this.detailsSlot;queueMicrotask(()=>{this.onIconSlotChange(),this.onSuffixSlotChange(),collectInitialSlotAssignment(detailsSlot,s=>this.syncDetailsSlot(s))})}applyComputedName(){this.writingComputedName=!0;try{syncOwnedAriaLabel(this,this.slottedLabel,this.ownedName,this.hasAttribute("aria-labelledby"))}finally{this.writingComputedName=!1}}applyPanelName(){const panel=this.submenuPanel;panel&&syncOwnedAriaLabel(panel,this.slottedLabel,this.panelName,panel.hasAttribute("label"))}getTextLabel(){return this.slottedLabel}get spinnerParts(){return"spinner spinner__base"}render(){const baseContent=html`
15
+ `}class LyraMenuItem extends LyraElement{static{this.knownUnobservedAttributes=["submenu-open"]}static{this.styles=[LyraElement.styles,sizes,styles]}get resolvedRel(){return resolveGuardedRel(this.rel,this.target)}get resolvedHref(){return(this.download!==void 0?safeDownloadHref(this.href):safeLinkHref(this.href))??void 0}get isLinkItem(){return this.resolvedHref!==void 0}get hasSubmenu(){return this.submenuAssigned}get submenuOpen(){return this.submenuExpanded}[menuItemOwner](owner,expectedOwner){owner===null&&expectedOwner&&this.owningMenu!==expectedOwner||(this.owningMenu=owner)}set submenuOpen(next){!!next!==this.submenuExpanded&&(next?this.openSubmenu("none"):this.closeSubmenu())}get interactionDisabled(){return this.disabled||this.loading}constructor(){super(),this.value="",this.size="m",this.disabled=!1,this.variant="default",this.type="normal",this.checked=!1,this.loading=!1,this.hasIconSlot=!1,this.hasDetailsSlot=!1,this.hasSuffixSlot=!1,this.submenuAssigned=!1,this.submenuExpanded=!1,this.slottedLabel="",this.submenuPanel=null,this.submenuPanelAttached=!1,this.submenuPanelGeneration=0,this.labelTextObserver=new AccessibleTextController(this,[],()=>this.syncSlottedLabel(),["data-hidden","label","slot"]),this.labelObservationGeneration=0,this.announcedNativeState="",this.owningMenu=null,this.ownedName={owns:!1,value:null},this.writingComputedName=!1,this.panelName={owns:!1,value:null},this.onNativeStateMutation=()=>{const signature=this.nativeStateSignature();signature!==this.announcedNativeState&&(this.announcedNativeState=signature,this.emitStateChange())},this.onIconSlotChange=()=>{this.hasIconSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="icon"||el.getAttribute("slot")==="prefix")},this.onDetailsSlotChange=e=>{this.syncDetailsSlot(e.target)},this.onSuffixSlotChange=()=>{this.hasSuffixSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="suffix")},this.onLabelSlotChange=event=>{this.labelTextObserver.bind(),this.syncSlottedLabel(event.target)},this.onForwardedLabelSlotChange=event=>{const slot=event.target;this.labelForwardingSlots().includes(slot)&&(this.labelTextObserver.bind(),this.syncSlottedLabel())},this.onSubmenuSlotChange=e=>{this.syncSubmenuSlot(e.target)},this.onPanelStateChange=open=>{this.submenuExpanded=open},this.addEventListener("mousedown",event=>{this.interactionDisabled&&event.preventDefault()})}connectedCallback(){super.connectedCallback();const initialLabel=this.readSlottedLabel(null,!1);initialLabel!==this.slottedLabel&&(this.slottedLabel=initialLabel),this.applyComputedName(),this.tabIndex!==0&&(this.tabIndex=-1),this.announcedNativeState=this.nativeStateSignature();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.nativeStateObserver=new MutationObserverCtor(this.onNativeStateMutation),this.nativeStateObserver.observe(this,{attributes:!0,attributeFilter:["hidden","inert","aria-hidden"]})),this.addEventListener("slotchange",this.onForwardedLabelSlotChange);const labelGeneration=++this.labelObservationGeneration;this.updateComplete.then(()=>{if(!this.isConnected||labelGeneration!==this.labelObservationGeneration)return;this.labelTextObserver.bind(),this.syncSlottedLabel();const submenuSlot=this.renderRoot.querySelector('slot[name="submenu"]');submenuSlot&&this.syncSubmenuSlot(submenuSlot)})}attributeChangedCallback(name,oldValue,value){name==="aria-label"&&this.writingComputedName||super.attributeChangedCallback(name,oldValue,value)}disconnectedCallback(){super.disconnectedCallback(),this.submenuPanelGeneration+=1,this.submenuExpanded=!1,this.nativeStateObserver?.disconnect(),this.nativeStateObserver=void 0,this.labelObservationGeneration+=1,this.removeEventListener("slotchange",this.onForwardedLabelSlotChange),this.submenuPanel&&this.submenuPanelAttached&&(this.submenuPanel[submenuPanelController].detach(this),this.submenuPanelAttached=!1)}adoptedCallback(){super.adoptedCallback(),this.labelTextObserver.adopted()}nativeStateSignature(){return`${this.hidden}|${this.inert}|${this.getAttribute("aria-hidden")}`}emitStateChange(){this.emit("lr-menu-item-state-change",{disabled:this.interactionDisabled,hidden:!!this.hidden,inert:this.inert})}willUpdate(changed){super.willUpdate(changed);const isCheckbox=this.type==="checkbox"&&!this.submenuAssigned,isRadio=this.type==="radio"&&!this.submenuAssigned;this.setAttribute("role",isCheckbox?"menuitemcheckbox":isRadio?"menuitemradio":"menuitem"),isCheckbox||isRadio?this.setAttribute("aria-checked",this.checked?"true":"false"):this.removeAttribute("aria-checked"),this.submenuAssigned?(this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",this.submenuExpanded?"true":"false")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded")),this.applyComputedName(),this.toggleAttribute("submenu-open",this.submenuExpanded),this.setAttribute("aria-disabled",String(this.interactionDisabled)),this.interactionDisabled&&(changed.has("disabled")||changed.has("loading"))&&(this.tabIndex=-1,activeElementIn(this.ownerDocument)===this&&this.blur()),(changed.has("disabled")||changed.has("loading"))&&this.emitStateChange()}click(){this.interactionDisabled||this.renderRoot.querySelector('[part~="base"]')?.click()}select(){if(!this.interactionDisabled){if(this.submenuPanel){this.openSubmenu("none");return}if(this.type==="checkbox"){const checked=!this.checked;this.proposeChecked(checked)&&(this.checked=checked)}else this.type==="radio"&&!this.checked&&this.proposeChecked(!0)&&(this.checked=!0,this.owningMenu?.uncheckRadioGroup(this,this.group));this.owningMenu?.activate(this)}}proposeChecked(checked){const value=this.value;return!this.emit("lr-menu-item-change-request",{value,checked},{cancelable:!0}).defaultPrevented}async openSubmenu(focus="first"){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||this.interactionDisabled||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],shown=controller.show(focus);this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await shown,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}async closeSubmenu(){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],hidden=controller.hide();this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await hidden,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}syncDetailsSlot(slot){const meaningful=node=>node.nodeType===Node.TEXT_NODE?(node.textContent??"").trim()!=="":node.nodeType!==Node.ELEMENT_NODE?!1:node instanceof HTMLSlotElement?node.assignedNodes({flatten:!0}).some(meaningful):!0;this.hasDetailsSlot=slot.assignedNodes({flatten:!0}).some(meaningful)}defaultLabelSlot(){return this.renderRoot?.querySelector("slot:not([name])")??null}isDefaultLabelBranch(node){let top=node;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode!==this?!1:top.nodeType!==1||(top.getAttribute("slot")??"")===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>this.isDefaultLabelBranch(slot))}isLabelSubtreeExcluded(element){return!(element.getRootNode()===this.renderRoot&&element.matches('[part~="label"][aria-hidden="true"][inert]:not([hidden])'))&&isAccessibilitySubtreeExcluded(element)}readSlottedLabel(slot=this.defaultLabelSlot(),requireRendered=!0){const nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes).filter(node=>this.isDefaultLabelBranch(node));return composedAccessibilityText(nodes,{ancestorBoundary:this,isSubtreeExcluded:element=>this.isLabelSubtreeExcluded(element),requireRendered,ignoreInheritedVisibility:!0}).replace(/\s+/g," ").trim()}syncSlottedLabel(slot=this.defaultLabelSlot()){const next=this.readSlottedLabel(slot);next!==this.slottedLabel&&(this.slottedLabel=next),this.applyComputedName(),this.applyPanelName(),this.isLinkItem&&this.linkName!==this.renderedLinkName&&this.requestUpdate()}get linkName(){return this.getAttribute("aria-label")?.trim()||this.slottedLabel||void 0}syncSubmenuSlot(submenuSlot){if(!submenuSlot.isConnected||submenuSlot.getRootNode()!==this.renderRoot)return;const assigned=submenuSlot.assignedElements({flatten:!0}),authoredPanel=assigned.find(element=>element.localName===tag("menu")),hasDirectItems=assigned.some(element=>element.localName===tag("menu-item")||element.localName===tag("dropdown-item")),kind=authoredPanel?"panel":hasDirectItems?"items":void 0;if(this.submenuKind=kind,this.submenuAssigned=kind!==void 0,kind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");generated&&this.connectSubmenuPanel(generated);return}this.connectSubmenuPanel(authoredPanel??null)}connectSubmenuPanel(next){const samePanel=next===this.submenuPanel;if(samePanel&&(next===null||this.submenuPanelAttached))return;const previous=this.submenuPanel;if(++this.submenuPanelGeneration,previous&&this.submenuPanelAttached&&previous[submenuPanelController].detach(this),this.submenuPanelAttached=!1,samePanel||(this.submenuPanel=next,this.panelName={owns:!1,value:null}),!this.submenuPanel){this.submenuExpanded=!1;return}const controller=this.submenuPanel[submenuPanelController];controller.attach(this,this.onPanelStateChange),this.submenuPanelAttached=!0,this.submenuExpanded=controller.open,this.applyPanelName()}isCurrentSubmenuPanel(panel,generation){return this.isConnected&&this.submenuPanel===panel&&this.submenuPanelGeneration===generation}updated(changed){if(super.updated(changed),changed.has("submenuKind")&&this.submenuKind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");this.connectSubmenuPanel(generated)}}firstUpdated(changed){super.firstUpdated(changed);const detailsSlot=this.detailsSlot;queueMicrotask(()=>{this.onIconSlotChange(),this.onSuffixSlotChange(),collectInitialSlotAssignment(detailsSlot,s=>this.syncDetailsSlot(s))})}applyComputedName(){this.writingComputedName=!0;try{syncOwnedAriaLabel(this,this.slottedLabel,this.ownedName,this.hasAttribute("aria-labelledby"))}finally{this.writingComputedName=!1}}applyPanelName(){const panel=this.submenuPanel;panel&&syncOwnedAriaLabel(panel,this.slottedLabel,this.panelName,panel.hasAttribute("label"))}getTextLabel(){return this.slottedLabel}get spinnerParts(){return"spinner spinner__base"}render(){const baseContent=html`
16
16
  <span part="icon" aria-hidden="true" inert ?hidden=${!this.hasIconSlot}>
17
17
  <slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
18
18
  <span part="prefix"
@@ -45,12 +45,13 @@ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{html as s
45
45
  ${this.submenuAssigned?html`<span part="submenu-icon" aria-hidden="true"
46
46
  >${chevronIcon()}</span
47
47
  >`:nothing}
48
- `,href=this.resolvedHref,base=href!==void 0?html`<a
48
+ `,href=this.resolvedHref,linkName=href!==void 0?this.linkName:void 0;this.renderedLinkName=linkName;const base=href!==void 0?html`<a
49
49
  part="base"
50
50
  href=${href}
51
51
  target=${this.target||nothing}
52
52
  rel=${this.resolvedRel??nothing}
53
53
  download=${this.download!==void 0?this.download??"":nothing}
54
+ aria-label=${linkName??nothing}
54
55
  tabindex="-1"
55
56
  @click=${()=>this.select()}
56
57
  >
@@ -12,9 +12,17 @@ export type LyraMultiSplitCollapseMode='start'|'end'|'none';
12
12
  export type LyraMultiSplitCollapseState='wide'|'rail'|'floating';
13
13
  /** What can be *assigned* to `collapseState` -- `'auto'` is a write-only
14
14
  * sentinel; see the `collapseState` accessor doc. */
15
- export type LyraMultiSplitCollapseStateInput=LyraMultiSplitCollapseState|'auto';export interface LyraMultiSplitCollapseChangeDetail{readonly state:LyraMultiSplitCollapseState;}export interface LyraMultiSplitToggleDetail{
15
+ export type LyraMultiSplitCollapseStateInput=LyraMultiSplitCollapseState|'auto';export interface LyraMultiSplitCollapseChangeDetail{readonly state:LyraMultiSplitCollapseState;}export interface LyraMultiSplitPanelCollapseChangeDetail{
16
+ /** The `panel-id` of the panel that was folded or unfolded.*/
17
+ readonly panelId:string;
18
+ /** Whether that panel is now collapsed to its rail.*/
19
+ readonly collapsed:boolean;
20
+ /** Every currently collapsed panel's `panel-id`, in DOM order.*/
21
+ readonly collapsedPanels:readonly string[];
22
+ /** The settled `sizes` after the freed or reclaimed share was redistributed.*/
23
+ readonly sizes:readonly number[];}export interface LyraMultiSplitToggleDetail{
16
24
  /** Whether the floating drawer is (or, on a cancelable proposal, would be) open.*/
17
- readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly sizes:readonly number[];}export interface LyraMultiSplitOrientationChangeDetail{readonly orientation:LyraOrientation;}export interface LyraMultiSplitEventMap{'lr-resize-request':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-resize':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-resize-change':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-multi-split-collapse-change':CustomEvent<LyraMultiSplitCollapseChangeDetail>;'lr-toggle-request':CustomEvent<LyraMultiSplitToggleDetail>;'lr-toggle':CustomEvent<LyraMultiSplitToggleDetail>;'lr-multi-split-constraints-invalid':CustomEvent<LyraMultiSplitConstraintIssueDetail>;'lr-multi-split-orientation-change':CustomEvent<LyraMultiSplitOrientationChangeDetail>;}
25
+ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly sizes:readonly number[];}export interface LyraMultiSplitOrientationChangeDetail{readonly orientation:LyraOrientation;}export interface LyraMultiSplitEventMap{'lr-resize-request':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-resize':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-resize-change':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-multi-split-collapse-change':CustomEvent<LyraMultiSplitCollapseChangeDetail>;'lr-multi-split-panel-collapse-change':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitPanelCollapseChangeDetail>>;'lr-toggle-request':CustomEvent<LyraMultiSplitToggleDetail>;'lr-toggle':CustomEvent<LyraMultiSplitToggleDetail>;'lr-multi-split-constraints-invalid':CustomEvent<LyraMultiSplitConstraintIssueDetail>;'lr-multi-split-orientation-change':CustomEvent<LyraMultiSplitOrientationChangeDetail>;}
18
26
  /**
19
27
  * `<lr-multi-split>` — resizable panels for dashboard layouts. Direct light-DOM
20
28
  * children are the panels; a divider is auto-inserted between each pair. Give every panel a
@@ -83,6 +91,15 @@ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly
83
91
  * open or closed, the divider beside the floating pane releases its gutter
84
92
  * and hairline, so the other pane(s) take the full track.
85
93
  *
94
+ * Separately, any panel -- not only an edge pane, and at any container width -- can be folded
95
+ * to a narrow rail strip by a host control through `collapsedPanels` or
96
+ * `collapsePanel()`/`expandPanel()`/`togglePanel()`, keyed by `panel-id`. The folded panel keeps
97
+ * rendering (the host draws its strip content: a rotated label, an expand button) while its share
98
+ * moves to the open panels within their `panelConstraints`, the dividers beside it keep resizing
99
+ * its open neighbours, and the collapsed set persists with the sizes under `storageKey`. The
100
+ * responsive pane above is independent of it: while that pane is `'rail'`/`'floating'` its own
101
+ * state governs it, and a per-panel fold of the same panel resumes once it is `'wide'` again.
102
+ *
86
103
  * Public collection properties take bounded, clone-owned readonly snapshots. Create a new
87
104
  * collection and reassign it after changes; mutating the assigned array does not update the view.
88
105
  *
@@ -110,6 +127,11 @@ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly
110
127
  * Forced writes while no eligible collapsing pane exists are inert and do
111
128
  * not fire. Not fired for a redundant reassignment to the state already in
112
129
  * effect.
130
+ * @event lr-multi-split-panel-collapse-change - `detail: { panelId, collapsed, collapsedPanels,
131
+ * sizes }` (`LyraMultiSplitPanelCollapseChangeDetail`), fired when `collapsePanel()`,
132
+ * `expandPanel()` or `togglePanel()` folds or unfolds a panel, after the redistributed `sizes`
133
+ * are applied and persisted and the panel's `data-panel-collapsed` marker is set. Not fired when
134
+ * a consumer assigns `collapsedPanels` (or `sizes`) directly, nor when a stored layout restores.
113
135
  * @event lr-toggle-request - Cancelable proposal before an interactive overlay state change.
114
136
  * Detail carries the proposed `expanded` state. Direct property writes and
115
137
  * forced responsive closes do not propose an interactive change.
@@ -130,7 +152,10 @@ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly
130
152
  * `aria-disabled="true"` and is drag/keyboard-inert
131
153
  * while its adjacent panel is collapsed (`'rail'`/`'floating'`). While that panel is `'floating'`
132
154
  * the divider also takes no track and paints no line, but stays focusable as the collapse-focus
133
- * fallback; beside a `'rail'` panel it keeps both.
155
+ * fallback; beside a `'rail'` panel it keeps both. Beside a per-panel collapsed panel (see
156
+ * `collapsedPanels`) a divider instead resizes the nearest open panel on each side, and
157
+ * `aria-valuenow` reports that leading open panel; it is disabled only when one side has no
158
+ * open panel left.
134
159
  * @csspart backdrop - The `'floating'` drawer's scrim. Only rendered while `collapseState === 'floating'` and `open`.
135
160
  * @cssprop [--lr-multi-split-overlay-color=var(--lr-color-overlay)] - The `'floating'` drawer scrim's color, applied to `[part="backdrop"]`.
136
161
  * @cssprop [--lr-multi-split-divider-target-size=max(var(--lr-icon-button-size),var(--lr-size-3px))] -
@@ -148,6 +173,9 @@ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly
148
173
  * @cssprop [--lr-multi-split-divider-active-color=color-mix(in oklab,var(--lr-color-brand),var(--lr-color-mix-partner) var(--lr-color-mix-active))] -
149
174
  * The divider hairline's color while a resize gesture is pressed (pointer capture holds this
150
175
  * through the whole drag).
176
+ * @cssprop [--lr-multi-split-collapsed-panel-size=var(--lr-size-2-5rem)] - The rail a per-panel
177
+ * collapsed panel (`collapsedPanels`) clamps to along the resize axis: its inline size in a
178
+ * horizontal split, its block size in a vertical one. Set it on the split or an ancestor.
151
179
  * @cssprop [--lr-multi-split-floating-panel-inset=0] - The `'floating'` drawer's distance from
152
180
  * `[part="base"]`'s edges, applied to both block insets and to whichever logical inline edge
153
181
  * `collapse` anchors the drawer to. Unset, the drawer stays flush with the container exactly as
@@ -320,7 +348,28 @@ for:string;
320
348
  * and the total panel count (`lr-multi-split` supports N panels, so a single fixed string can't
321
349
  * express every divider's label; a function can). Unset (the default) keeps today's exact
322
350
  * localized `Resize divider between panel {a} and panel {b}` template (see `this.localize()`). */
323
- dividerLabel?:(index:number,panelCount:number)=>string;private panelCount;private sizesReconciledForMembership;private _collapseState;private _forced;private pinnedBand?;private overlayActive;private justOpened;private overlayHandle?;private readonly nativeModal;private readonly modalSurface;private nativeModalView?;private nativeModalResizeObserver?;private floatingFrame?;private readonly floatingGeometry;private openingBlockSize;private stopNativeModalGeometry;private nativeModalLabel;private readonly syncNativeModalGeometry;private triggerAria?;private triggerPanel?;private generatedTriggerPanelId?;private overlayReturnTarget;private overlayOpener;private floatingDialogPanel;private floatingDialogPreviousRole;private floatingDialogPreviousAriaModal;private drags;private readonly dragController;private ownedPanels;private readonly panelOwnership;private panelOwnershipObserver?;private constraintIssueKey;private constraintConfigVersion;private renderConstraintBounds;private initializedSizes;private measuredInlineSize;private _effectiveOrientation;private baseEl?;private collapseResizeObserver?;private collapseObservedElement?;private collapseObserverOwnerDocument?;private collapseObserverGeneration;private gutterResizeObserver?;private gutterObserverFrame?;private gutterObserverDocument?;private gutterObservedDividers;private gutterObservedContainerSize;private orientationBreakpoints;private collapseBreakpoints;connectedCallback():void;private seedInlineSize;disconnectedCallback():void;adoptedCallback():void;protected firstUpdated(changed:PropertyValues):void;
351
+ dividerLabel?:(index:number,panelCount:number)=>string;
352
+ /** The `panel-id`s of the panels folded to a narrow rail strip, independent of container width
353
+ * and of the responsive `collapse` pane. Empty by default: no panel folds and the split behaves
354
+ * exactly as before this property existed.
355
+ *
356
+ * A collapsed panel stays rendered and in the accessibility tree; it is clamped along the
357
+ * resize axis to `--lr-multi-split-collapsed-panel-size` and marked `data-panel-collapsed`, so
358
+ * the panel's own content can switch to its strip presentation (a rotated label, an expand
359
+ * control) and should take its full content out of the tab order itself, for example with
360
+ * `inert` on the hidden region. Its share of the track is redistributed to the open panels in
361
+ * proportion to their sizes, never past a panel's `panelConstraints` maximum; its `sizes`
362
+ * entry reads `0` while folded, and expanding restores the share it had when it folded,
363
+ * reclaimed from the open panels' room above their minimums. A divider beside a collapsed panel
364
+ * resizes the nearest open panel on each side, and is disabled only when one side has none.
365
+ *
366
+ * Requires every panel to carry a unique, nonempty, whitespace-stable `panel-id` (the same
367
+ * identity `storageKey` uses); otherwise the set is ignored. Unknown ids are ignored, and at least
368
+ * one panel always stays open: a set naming every panel leaves the last one open. Assigning this
369
+ * property is silent, like assigning `sizes`; `collapsePanel()`/`expandPanel()`/`togglePanel()`
370
+ * apply a change immediately, persist it under `storageKey`, and announce it. A valid stored
371
+ * layout restores the collapsed set too, unless this property already names panels. */
372
+ collapsedPanels:readonly string[];private panelCount;private sizesReconciledForMembership;private appliedCollapsed;private readonly expandedSizes;private _collapseState;private _forced;private pinnedBand?;private overlayActive;private justOpened;private overlayHandle?;private readonly nativeModal;private readonly modalSurface;private nativeModalView?;private nativeModalResizeObserver?;private floatingFrame?;private readonly floatingGeometry;private openingBlockSize;private stopNativeModalGeometry;private nativeModalLabel;private readonly syncNativeModalGeometry;private triggerAria?;private triggerPanel?;private generatedTriggerPanelId?;private overlayReturnTarget;private overlayOpener;private floatingDialogPanel;private floatingDialogPreviousRole;private floatingDialogPreviousAriaModal;private drags;private readonly dragController;private ownedPanels;private readonly panelOwnership;private panelOwnershipObserver?;private constraintIssueKey;private constraintConfigVersion;private renderConstraintBounds;private initializedSizes;private measuredInlineSize;private _effectiveOrientation;private baseEl?;private collapseResizeObserver?;private collapseObservedElement?;private collapseObserverOwnerDocument?;private collapseObserverGeneration;private gutterResizeObserver?;private gutterObserverFrame?;private gutterObserverDocument?;private gutterObservedDividers;private gutterObservedContainerSize;private orientationBreakpoints;private collapseBreakpoints;connectedCallback():void;private seedInlineSize;disconnectedCallback():void;adoptedCallback():void;protected firstUpdated(changed:PropertyValues):void;
324
373
  /** Both branches here derive one reactive property from another with no
325
374
  * DOM measurement involved, so they belong in `willUpdate()` rather than
326
375
  * `updated()`: setting a reactive property from `updated()`/
@@ -373,11 +422,29 @@ collapsePane():void;
373
422
  * Named `togglePane()` (with `expandPane()`/`collapsePane()`) because `collapse` is already this
374
423
  * component's pane-selection property, mirroring `<lr-page>`'s `showNavigation()` trio.
375
424
  */
376
- togglePane():void;private get paneExpanded();private applyPaneIntent;private releaseCollapsePin;private pinMeasurementWidth;
425
+ togglePane():void;
426
+ /**
427
+ * Folds one panel to its rail strip at any container width (see `collapsedPanels`). `panel` is
428
+ * the panel's `panel-id` or the panel element itself. Applies synchronously: the freed share is
429
+ * redistributed, the layout persists under `storageKey`, the panel is decorated, and then
430
+ * `lr-multi-split-panel-collapse-change` fires. Returns whether anything changed: `false` for an
431
+ * unknown panel, one already collapsed, the last open panel, or a split whose panels lack valid
432
+ * `panel-id`s. Called before the first update, it only records the request, silently.
433
+ *
434
+ * Named `collapsePanel()` (with `expandPanel()`/`togglePanel()`) to stay distinct from
435
+ * `collapsePane()`, which drives the single responsive `collapse` pane.
436
+ */
437
+ collapsePanel(panel:string|HTMLElement):boolean;
438
+ /** Unfolds a collapsed panel back to the share it had when it folded, taken from the open
439
+ * panels' room above their minimums. Same identity, persistence and event rules as
440
+ * `collapsePanel()`. */
441
+ expandPanel(panel:string|HTMLElement):boolean;
442
+ /** Collapses an open panel or expands a collapsed one; see `collapsePanel()`.*/
443
+ togglePanel(panel:string|HTMLElement):boolean;private panelIdOf;private setPanelCollapsed;private targetCollapsedIds;private indexesOf;private collapsedIndexes;private syncCollapsedLayout;private foldSizes;private distributeShare;private dividerPair;private get paneExpanded();private applyPaneIntent;private releaseCollapsePin;private pinMeasurementWidth;
377
444
  /** The live layout and resize axis after applying `orientationBreakpoint` — identical to
378
445
  * `orientation` whenever `orientationBreakpoint` is unset (or set to something that doesn't
379
446
  * resolve to a length). Also reflected as the `data-effective-orientation` host attribute (only
380
447
  * present while `orientationBreakpoint` resolves, mirroring `data-collapse-state`'s
381
448
  * only-present-while-active contract) so CSS can
382
449
  * target the live axis directly instead of every consumer duplicating this fallback. */
383
- get effectiveOrientation():LyraOrientation;private get responsiveObservationEnabled();private updateEffectiveOrientation;private currentMeasuredWidth;private effectiveCollapseStateFor;private applyEffectiveCollapseTransition;private relocateFocusOutOfCollapsingPanel;private collapseFocusFallbacks;private setOpen;requestUpdate(name?:PropertyKey,oldValue?:unknown,options?:PropertyDeclaration):void;private setRequestedCollapseState;private get storageFullKey();private panelIdsFor;private reconcileIdentitySizes;private reconcileSizesByPanelId;private validInitialSizes;private validLiveSizes;private resolveDefaultSizes;private initializeSizes;private loadPersisted;private persist;private ensureSizes;private readPanelStyle;private samePanelStyle;private snapshotPanelOwnership;private adoptPanelOwnership;private applyOwnedPanelStyle;private applyOwnedPanelStyleValue;private applyOwnedPanelHidden;private applyOwnedPanelCollapseState;private restorePanelOwnership;private panelProjectionDiverged;private resetPanelOwnershipObserver;private observeOwnedPanels;private samePanelSequence;private syncPanelMembership;private releaseOwnedPanels;private onSlotChange;private getContainerSize;private resetGutterObserver;private updateGutterBudget;private syncGutterObserver;private get collapsingIndex();private get collapseActive();private isDividerDisabled;private updateCollapseState;private armCollapseObserver;private resetCollapseObserver;private syncCollapseObserver;private get safeMin();private normalizedDefaultMin;private resolveConstraintBounds;private hasClampConstraint;private minSideExpr;private maxSideExpr;private clampPair;private requestResize;private settle;private applyDelta;private get floatingPanelEl();private activateFloatingOverlay;private deactivateFloatingOverlay;private onBackdropClick;private onModalLayerClick;private onPointerDown;private onPointerMove;private onPointerUp;private endDragGestures;private onDividerKeyDown;private dividerName;private dividerValueRange;protected updated(changed:PropertyValues):void;private resolveExternalTrigger;private syncExternalTriggerA11y;private releaseExternalTriggerA11y;private decorateOwnedPanels;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-multi-split':LyraMultiSplit;}}
450
+ get effectiveOrientation():LyraOrientation;private get responsiveObservationEnabled();private updateEffectiveOrientation;private currentMeasuredWidth;private effectiveCollapseStateFor;private applyEffectiveCollapseTransition;private relocateFocusOutOfCollapsingPanel;private collapseFocusFallbacks;private setOpen;requestUpdate(name?:PropertyKey,oldValue?:unknown,options?:PropertyDeclaration):void;private setRequestedCollapseState;private get storageFullKey();private panelIdsFor;private reconcileIdentitySizes;private reconcileSizesByPanelId;private validInitialSizes;private validLiveSizes;private resolveDefaultSizes;private acceptFoldedSizes;private initializeSizes;private loadPersisted;private persist;private ensureSizes;private readPanelStyle;private samePanelStyle;private snapshotPanelOwnership;private adoptPanelOwnership;private applyOwnedPanelStyle;private applyOwnedPanelStyleValue;private applyOwnedPanelHidden;private applyOwnedPanelAttribute;private restorePanelOwnership;private panelProjectionDiverged;private resetPanelOwnershipObserver;private observeOwnedPanels;private samePanelSequence;private syncPanelMembership;private releaseOwnedPanels;private onSlotChange;private getContainerSize;private resetGutterObserver;private updateGutterBudget;private syncGutterObserver;private get collapsingIndex();private get collapseActive();private isDividerDisabled;private updateCollapseState;private armCollapseObserver;private resetCollapseObserver;private syncCollapseObserver;private get safeMin();private normalizedDefaultMin;private resolveConstraintBounds;private hasClampConstraint;private minSideExpr;private maxSideExpr;private clampPair;private requestResize;private settle;private applyDelta;private get floatingPanelEl();private activateFloatingOverlay;private deactivateFloatingOverlay;private onBackdropClick;private onModalLayerClick;private onPointerDown;private onPointerMove;private onPointerUp;private endDragGestures;private onDividerKeyDown;private dividerName;private dividerValueRange;protected updated(changed:PropertyValues):void;private resolveExternalTrigger;private syncExternalTriggerA11y;private releaseExternalTriggerA11y;private decorateOwnedPanels;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-multi-split':LyraMultiSplit;}}