@openproject/primer-view-components 0.95.0 → 0.96.0-rc.0d6e19868

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 (39) hide show
  1. package/app/assets/javascripts/primer_view_components.js +11 -1
  2. package/app/assets/javascripts/primer_view_components.js.map +1 -1
  3. package/app/assets/styles/primer_view_components.css +1 -1
  4. package/app/assets/styles/primer_view_components.css.map +1 -1
  5. package/app/components/primer/alpha/action_list.css +1 -1
  6. package/app/components/primer/alpha/action_list.css.json +2 -0
  7. package/app/components/primer/alpha/action_menu/action_menu_element.js +38 -21
  8. package/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.d.ts +1 -1
  9. package/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.js +6 -7
  10. package/app/components/primer/beta/button.css +1 -1
  11. package/app/components/primer/beta/button.css.json +16 -1
  12. package/app/components/primer/open_project/keybinding_hint/chords.d.ts +5 -0
  13. package/app/components/primer/open_project/keybinding_hint/chords.js +29 -0
  14. package/app/components/primer/open_project/keybinding_hint/key_names.d.ts +16 -0
  15. package/app/components/primer/open_project/keybinding_hint/key_names.js +107 -0
  16. package/app/components/primer/open_project/keybinding_hint/localized_names.d.ts +22 -0
  17. package/app/components/primer/open_project/keybinding_hint/localized_names.js +47 -0
  18. package/app/components/primer/open_project/keybinding_hint/names_from_scope.d.ts +21 -0
  19. package/app/components/primer/open_project/keybinding_hint/names_from_scope.js +81 -0
  20. package/app/components/primer/open_project/keybinding_hint/platform.d.ts +10 -0
  21. package/app/components/primer/open_project/keybinding_hint/platform.js +24 -0
  22. package/app/components/primer/open_project/keybinding_hint/platform_override.d.ts +2 -0
  23. package/app/components/primer/open_project/keybinding_hint/platform_override.js +4 -0
  24. package/app/components/primer/open_project/keybinding_hint.css +1 -0
  25. package/app/components/primer/open_project/keybinding_hint.css.json +10 -0
  26. package/app/components/primer/open_project/keybinding_hint_element.d.ts +31 -0
  27. package/app/components/primer/open_project/keybinding_hint_element.js +183 -0
  28. package/app/components/primer/primer.d.ts +1 -0
  29. package/app/components/primer/primer.js +1 -0
  30. package/package.json +6 -5
  31. package/static/arguments.json +40 -0
  32. package/static/audited_at.json +1 -0
  33. package/static/classes.json +12 -0
  34. package/static/classnames.cjs +4 -0
  35. package/static/classnames.js +4 -0
  36. package/static/constants.json +27 -0
  37. package/static/info_arch.json +194 -6
  38. package/static/previews.json +138 -0
  39. package/static/statuses.json +1 -0
@@ -1 +1 @@
1
- :root{--actionListContent-paddingBlock:var(--control-medium-paddingBlock)}action-list,nav-list{display:block}.ActionListHeader{margin-bottom:var(--base-size-16);margin-left:var(--base-size-8)}.ActionListWrap{list-style:none}.ActionListWrap--inset,.ActionListWrap--inset[popover]{padding:var(--base-size-8)}.ActionListWrap--divided .ActionListItem-label:before{height:1px}.ActionListWrap--divided .ActionListItem-label:before,:is(.ActionListWrap--divided .ActionListItem-descriptionWrap--inline):before{position:absolute;top:calc(var(--actionListContent-paddingBlock)*-1);display:block;width:100%;content:"";background:var(--borderColor-muted)}:is(.ActionListWrap--divided .ActionListItem-descriptionWrap--inline):before{height:var(--borderWidth-thin)}:is(.ActionListWrap--divided .ActionListItem-descriptionWrap--inline) .ActionListItem-label:before{content:unset}.ActionList-sectionDivider+.ActionListItem .ActionListItem-descriptionWrap--inline:before,.ActionList-sectionDivider+.ActionListItem .ActionListItem-label:before,.ActionListItem:first-of-type .ActionListItem-descriptionWrap--inline:before,.ActionListItem:first-of-type .ActionListItem-label:before,:is(.ActionListWrap--divided .ActionListItem--navActive) .ActionListItem-label:before,:is(.ActionListWrap--divided .ActionListItem--navActive)+.ActionListItem .ActionListItem-label:before{visibility:hidden}.ActionListItem{position:relative;list-style:none;background-color:var(--control-transparent-bgColor-rest);border-radius:var(--borderRadius-medium)}.ActionListItem:active,.ActionListItem:hover{cursor:pointer}@media (hover:hover){.ActionListItem:hover .ActionListItem-descriptionWrap--inline:before,.ActionListItem:hover .ActionListItem-label:before,.ActionListItem:hover+.ActionListItem .ActionListItem-descriptionWrap--inline:before,.ActionListItem:hover+.ActionListItem .ActionListItem-label:before{visibility:hidden}}.ActionListItem[hidden]+.ActionList-sectionDivider{display:none}.ActionListItem.ActionListItem--hasSubItem>.ActionListContent{z-index:1}@media (hover:hover){:is(.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):hover{background-color:var(--control-transparent-bgColor-hover)}}:is(.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active{background-color:var(--control-transparent-bgColor-active)}@media (hover:hover){:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):hover{cursor:pointer;background-color:var(--control-transparent-bgColor-hover)}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):hover:not(.ActionListItem--navActive,:focus-visible){outline:solid var(--borderWidth-thin) #0000;outline-offset:calc(var(--borderWidth-thin)*-1);box-shadow:var(--boxShadow-thin) var(--control-transparent-borderColor-active)}}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active{background:var(--control-transparent-bgColor-active)}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active:not(.ActionListItem--navActive){outline:solid var(--borderWidth-thin) #0000;outline-offset:calc(var(--borderWidth-thin)*-1);box-shadow:var(--boxShadow-thin) var(--control-transparent-borderColor-active)}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active .ActionListItem-label:before,:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active+.ActionListItem .ActionListItem-label:before{visibility:hidden}.ActionListItem[aria-selected=true]{font-weight:var(--base-text-weight-normal);background:var(--control-transparent-bgColor-selected)}@media (hover:hover){.ActionListItem[aria-selected=true]:hover{background-color:var(--control-transparent-bgColor-hover)}}.ActionListItem[aria-selected=true]+.ActionListItem:before,.ActionListItem[aria-selected=true]:before{visibility:hidden}.ActionListItem[aria-selected=true]:after{position:absolute;top:calc(50% - 12px);left:calc(var(--base-size-4)*-1);width:var(--base-size-4);height:var(--base-size-24);content:"";background:var(--borderColor-accent-emphasis);border-radius:var(--borderRadius-medium)}.ActionListItem.ActionListItem--navActive{outline:2px solid #0000}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--subItem) .ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger){background:var(--control-transparent-bgColor-selected)}@media (hover:hover){.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger):hover{background-color:var(--control-transparent-bgColor-hover)}}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger)+.ActionListItem:before,.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger):before{visibility:hidden}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger):after{position:absolute;top:calc(50% - 12px);left:calc(var(--base-size-8)*-1);width:var(--base-size-4);height:var(--base-size-24);content:"";background:var(--borderColor-accent-emphasis);border-radius:var(--borderRadius-medium)}:is(:is(.ActionListItem.ActionListItem--disabled,.ActionListItem[aria-disabled=true]) .ActionListContent) :is(.ActionListItem-description,.ActionListItem-label){color:var(--control-fgColor-disabled)}:is(:is(.ActionListItem.ActionListItem--disabled,.ActionListItem[aria-disabled=true]) .ActionListContent) .ActionListItem-visual{fill:var(--control-fgColor-disabled)}@media (hover:hover){:is(.ActionListItem.ActionListItem--disabled,.ActionListItem[aria-disabled=true]):hover{cursor:not-allowed;background-color:initial}}.ActionListItem.ActionListItem--danger .ActionListItem-label,.ActionListItem.ActionListItem--danger .ActionListItem-visual{color:var(--control-danger-fgColor-rest)}@media (hover:hover){.ActionListItem.ActionListItem--danger:hover{background:var(--control-danger-bgColor-hover)}.ActionListItem.ActionListItem--danger:hover :is(.ActionListItem-description,.ActionListItem-label,.ActionListItem-visual){color:var(--control-danger-fgColor-hover)}}:is(.ActionListItem.ActionListItem--danger .ActionListContent):active{background:var(--control-danger-bgColor-active)}:is(.ActionListItem.ActionListItem--danger .ActionListContent):active :is(.ActionListItem-description,.ActionListItem-label,.ActionListItem-visual){color:var(--control-danger-fgColor-hover)}.ActionListContent{position:relative;display:grid;width:100%;padding-block:var(--actionListContent-paddingBlock);padding-inline:var(--control-medium-paddingInline-condensed);color:var(--control-fgColor-rest);text-align:left;-webkit-user-select:none;user-select:none;background-color:initial;border:none;border-radius:var(--borderRadius-medium);transition:background 33.333ms linear;touch-action:manipulation;-webkit-tap-highlight-color:transparent;grid-template-rows:min-content;grid-template-areas:"leadingAction leadingVisual label trailingVisual trailingAction";grid-template-columns:min-content min-content minmax(0,auto) min-content min-content;align-items:start}.ActionListContent>:not(:last-child){margin-right:var(--control-medium-gap)}.ActionListContent:hover{-webkit-text-decoration:none;text-decoration:none}.ActionListContent[aria-disabled=true] :is(.ActionListItem-description,.ActionListItem-label){color:var(--control-fgColor-disabled)}.ActionListContent[aria-disabled=true] .ActionListItem-visual{fill:var(--control-fgColor-disabled)}@media (hover:hover){.ActionListContent[aria-disabled=true]:hover{cursor:not-allowed;background-color:initial}}@media screen and (prefers-reduced-motion:no-preference){.ActionListContent[aria-expanded]+.ActionList--subGroup{transition:opacity .16s cubic-bezier(.25,1,.5,1),transform .16s cubic-bezier(.25,1,.5,1)}}:is(.ActionListContent[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-24)}:is(.ActionListContent.ActionListContent--visual16[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-32)}:is(.ActionListContent.ActionListContent--visual20[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-36)}:is(.ActionListContent.ActionListContent--visual24[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-40)}.ActionListContent[aria-expanded=true] .ActionListItem-collapseIcon{transition:transform .12s linear;transform:scaleY(-1)}.ActionListContent[aria-expanded=true]+.ActionList--subGroup{height:auto;overflow:visible;visibility:visible;opacity:1;transform:translateY(0)}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=true]>.ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListContent[aria-expanded=false] .ActionListItem-collapseIcon{transition:transform .12s linear;transform:scaleY(1)}.ActionListContent[aria-expanded=false]+.ActionList--subGroup{height:0;overflow:hidden;visibility:hidden;opacity:0;transform:translateY(calc(var(--base-size-16)*-1))}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]{background:var(--control-transparent-bgColor-selected)}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false] .ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]+.ActionListItem:before,.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]:before{visibility:hidden}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]:after{position:absolute;top:calc(50% - 12px);left:calc(var(--base-size-8)*-1);width:var(--base-size-4);height:var(--base-size-24);content:"";background:var(--borderColor-accent-emphasis);border-radius:var(--borderRadius-medium)}:is(.ActionListContent[aria-checked=true],.ActionListContent[aria-selected=true]) .FormControl-checkbox{background:var(--control-checked-bgColor-rest);border-color:var(--control-checked-borderColor-rest);transition:background-color,border-color 80ms cubic-bezier(.32,0,.67,0) 0s}:is(:is(.ActionListContent[aria-checked=true],.ActionListContent[aria-selected=true]) .FormControl-checkbox):before{visibility:visible;transition:visibility 0s linear 0s;animation:checkmarkIn 80ms cubic-bezier(.65,0,.35,1) 80ms forwards}:is(.ActionListContent[aria-checked=true],.ActionListContent[aria-selected=true]) .ActionListItem-singleSelectCheckmark{visibility:visible}:is(.ActionListContent[aria-checked=false],.ActionListContent[aria-selected=false]) .ActionListItem-singleSelectCheckmark{visibility:hidden;transition:visibility 0s linear .2s}.ActionListContent.ActionListContent--sizeLarge{--actionListContent-paddingBlock:var(--control-large-paddingBlock)}.ActionListContent.ActionListContent--sizeXLarge{--actionListContent-paddingBlock:var(--control-xlarge-paddingBlock)}@media (pointer:coarse){.ActionListContent{--actionListContent-paddingBlock:var(--control-large-paddingBlock)}}.ActionListContent.ActionListContent--blockDescription .ActionListItem-visual{place-self:start}.ActionListItem-action--leading{grid-area:leadingAction}.ActionListItem-visual--leading{grid-area:leadingVisual}.ActionListItem-visual--trailing{grid-area:trailingVisual}.ActionListItem-action--trailing{grid-area:trailingAction}.ActionListItem-visual--leading svg{fill:currentcolor}.ActionListItem-descriptionWrap{grid-area:label;display:flex;flex-direction:column;gap:var(--base-size-4)}.ActionListItem-descriptionWrap .ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListItem-descriptionWrap--inline{position:relative;flex-direction:row;align-items:baseline;gap:var(--base-size-8)}.ActionListItem-description{font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-normal);line-height:var(--text-body-lineHeight-small);color:var(--fgColor-muted)}.ActionListItem-action,.ActionListItem-visual{display:flex;min-height:var(--base-size-20);color:var(--fgColor-muted);pointer-events:none;fill:var(--fgColor-muted);align-items:center}.ActionListItem-label{position:relative;font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-normal);line-height:var(--text-body-lineHeight-medium);color:var(--fgColor-default);grid-area:label}.ActionListItem-label--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ActionListItem--subItem>.ActionListContent>.ActionListItem-label{font-size:var(--text-body-size-small);line-height:var(--text-body-lineHeight-small)}.ActionListItem--withActions{display:flex;flex-wrap:nowrap;align-items:center}.ActionListItem-trailingAction{border-top-left-radius:0;border-bottom-left-radius:0}.ActionListItem--trailingActionHover .ActionListItem-trailingAction{visibility:hidden}:is(.ActionListItem--trailingActionHover:hover,.ActionListItem--trailingActionHover:focus-within) .ActionListItem-trailingAction{visibility:visible}.ActionList-sectionDivider:not(:empty){display:flex;font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-semibold);line-height:var(--text-body-lineHeight-small);color:var(--fgColor-muted);flex-direction:column;padding-inline:var(--actionListContent-paddingBlock);padding-block:var(--base-size-8)}.ActionList-sectionDivider:empty{display:block;height:var(--borderWidth-thin);padding:0;margin-block-start:calc(var(--base-size-8) - var(--borderWidth-thin));margin-block-end:var(--base-size-8);margin-inline:calc(var(--base-size-8)*-1);list-style:none;background:var(--borderColor-muted);border:0}.ActionList-sectionDivider .ActionList-sectionDivider-title{font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-semibold);color:var(--fgColor-muted);align-self:flex-start}.ActionList-sectionDivider--filled{margin-block-start:calc(var(--base-size-8) - var(--borderWidth-thin));margin-block-end:var(--base-size-8);margin-inline:calc(var(--base-size-8)*-1);background:var(--bgColor-muted);border-top:solid var(--borderWidth-thin) var(--borderColor-muted,var(--color-action-list-item-inline-divider));border-bottom:solid var(--borderWidth-thin) var(--borderColor-muted,var(--color-action-list-item-inline-divider))}.ActionList-sectionDivider--filled:empty{height:var(--base-size-8);box-sizing:border-box}.ActionList-sectionDivider--filled:first-child{margin-block-start:0}
1
+ :root{--actionListContent-paddingBlock:var(--control-medium-paddingBlock)}action-list,nav-list{display:block}.ActionListHeader{margin-bottom:var(--base-size-16);margin-left:var(--base-size-8)}.ActionListWrap{list-style:none}.ActionListWrap--inset,.ActionListWrap--inset[popover]{padding:var(--base-size-8)}.ActionListWrap--divided .ActionListItem-label:before{height:1px}.ActionListWrap--divided .ActionListItem-label:before,:is(.ActionListWrap--divided .ActionListItem-descriptionWrap--inline):before{position:absolute;top:calc(var(--actionListContent-paddingBlock)*-1);display:block;width:100%;content:"";background:var(--borderColor-muted)}:is(.ActionListWrap--divided .ActionListItem-descriptionWrap--inline):before{height:var(--borderWidth-thin)}:is(.ActionListWrap--divided .ActionListItem-descriptionWrap--inline) .ActionListItem-label:before{content:unset}.ActionList-sectionDivider+.ActionListItem .ActionListItem-descriptionWrap--inline:before,.ActionList-sectionDivider+.ActionListItem .ActionListItem-label:before,.ActionListItem:first-of-type .ActionListItem-descriptionWrap--inline:before,.ActionListItem:first-of-type .ActionListItem-label:before,:is(.ActionListWrap--divided .ActionListItem--navActive) .ActionListItem-label:before,:is(.ActionListWrap--divided .ActionListItem--navActive)+.ActionListItem .ActionListItem-label:before{visibility:hidden}.ActionListItem{position:relative;list-style:none;background-color:var(--control-transparent-bgColor-rest);border-radius:var(--borderRadius-medium)}.ActionListItem:active,.ActionListItem:hover{cursor:pointer}@media (hover:hover){.ActionListItem:hover .ActionListItem-descriptionWrap--inline:before,.ActionListItem:hover .ActionListItem-label:before,.ActionListItem:hover+.ActionListItem .ActionListItem-descriptionWrap--inline:before,.ActionListItem:hover+.ActionListItem .ActionListItem-label:before{visibility:hidden}}.ActionListItem[hidden]+.ActionList-sectionDivider{display:none}.ActionListItem.ActionListItem--hasSubItem>.ActionListContent{z-index:1}@media (hover:hover){:is(.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):hover{background-color:var(--control-transparent-bgColor-hover)}}:is(.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active{background-color:var(--control-transparent-bgColor-active)}@media (hover:hover){:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):hover{cursor:pointer;background-color:var(--control-transparent-bgColor-hover)}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):hover:not(.ActionListItem--navActive,:focus-visible){outline:solid var(--borderWidth-thin) #0000;outline-offset:calc(var(--borderWidth-thin)*-1);box-shadow:var(--boxShadow-thin) var(--control-transparent-borderColor-active)}}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active{background:var(--control-transparent-bgColor-active)}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active:not(.ActionListItem--navActive){outline:solid var(--borderWidth-thin) #0000;outline-offset:calc(var(--borderWidth-thin)*-1);box-shadow:var(--boxShadow-thin) var(--control-transparent-borderColor-active)}:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active .ActionListItem-label:before,:is(.ActionListItem:not(.ActionListItem--hasSubItem),.ActionListItem.ActionListItem--hasSubItem>.ActionListContent):active+.ActionListItem .ActionListItem-label:before{visibility:hidden}.ActionListItem[aria-selected=true]{font-weight:var(--base-text-weight-normal);background:var(--control-transparent-bgColor-selected)}@media (hover:hover){.ActionListItem[aria-selected=true]:hover{background-color:var(--control-transparent-bgColor-hover)}}.ActionListItem[aria-selected=true]+.ActionListItem:before,.ActionListItem[aria-selected=true]:before{visibility:hidden}.ActionListItem[aria-selected=true]:after{position:absolute;top:calc(50% - 12px);left:calc(var(--base-size-4)*-1);width:var(--base-size-4);height:var(--base-size-24);content:"";background:var(--borderColor-accent-emphasis);border-radius:var(--borderRadius-medium)}.ActionListItem.ActionListItem--navActive{outline:2px solid #0000}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--subItem) .ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger){background:var(--control-transparent-bgColor-selected)}@media (hover:hover){.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger):hover{background-color:var(--control-transparent-bgColor-hover)}}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger)+.ActionListItem:before,.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger):before{visibility:hidden}.ActionListItem.ActionListItem--navActive:not(.ActionListItem--danger):after{position:absolute;top:calc(50% - 12px);left:calc(var(--base-size-8)*-1);width:var(--base-size-4);height:var(--base-size-24);content:"";background:var(--borderColor-accent-emphasis);border-radius:var(--borderRadius-medium)}:is(:is(.ActionListItem.ActionListItem--disabled,.ActionListItem[aria-disabled=true]) .ActionListContent) :is(.ActionListItem-description,.ActionListItem-label){color:var(--control-fgColor-disabled)}:is(:is(.ActionListItem.ActionListItem--disabled,.ActionListItem[aria-disabled=true]) .ActionListContent) .ActionListItem-visual{fill:var(--control-fgColor-disabled)}@media (hover:hover){:is(.ActionListItem.ActionListItem--disabled,.ActionListItem[aria-disabled=true]):hover{cursor:not-allowed;background-color:initial}}.ActionListItem.ActionListItem--danger .ActionListItem-label,.ActionListItem.ActionListItem--danger .ActionListItem-visual{color:var(--control-danger-fgColor-rest)}@media (hover:hover){.ActionListItem.ActionListItem--danger:hover{background:var(--control-danger-bgColor-hover)}.ActionListItem.ActionListItem--danger:hover :is(.ActionListItem-description,.ActionListItem-label,.ActionListItem-visual){color:var(--control-danger-fgColor-hover)}.ActionListItem.ActionListItem--danger:hover [data-kbd-chord]{background-color:var(--bgColor-default);transition:none}}:is(.ActionListItem.ActionListItem--danger .ActionListContent):active{background:var(--control-danger-bgColor-active)}:is(.ActionListItem.ActionListItem--danger .ActionListContent):active :is(.ActionListItem-description,.ActionListItem-label,.ActionListItem-visual){color:var(--control-danger-fgColor-hover)}:is(.ActionListItem.ActionListItem--danger .ActionListContent):active [data-kbd-chord]{background-color:var(--bgColor-default);transition:none}.ActionListContent{position:relative;display:grid;width:100%;padding-block:var(--actionListContent-paddingBlock);padding-inline:var(--control-medium-paddingInline-condensed);color:var(--control-fgColor-rest);text-align:left;-webkit-user-select:none;user-select:none;background-color:initial;border:none;border-radius:var(--borderRadius-medium);transition:background 33.333ms linear;touch-action:manipulation;-webkit-tap-highlight-color:transparent;grid-template-rows:min-content;grid-template-areas:"leadingAction leadingVisual label trailingVisual trailingAction";grid-template-columns:min-content min-content minmax(0,auto) min-content min-content;align-items:start}.ActionListContent>:not(:last-child){margin-right:var(--control-medium-gap)}.ActionListContent:hover{-webkit-text-decoration:none;text-decoration:none}.ActionListContent[aria-disabled=true] :is(.ActionListItem-description,.ActionListItem-label){color:var(--control-fgColor-disabled)}.ActionListContent[aria-disabled=true] .ActionListItem-visual{fill:var(--control-fgColor-disabled)}@media (hover:hover){.ActionListContent[aria-disabled=true]:hover{cursor:not-allowed;background-color:initial}}@media screen and (prefers-reduced-motion:no-preference){.ActionListContent[aria-expanded]+.ActionList--subGroup{transition:opacity .16s cubic-bezier(.25,1,.5,1),transform .16s cubic-bezier(.25,1,.5,1)}}:is(.ActionListContent[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-24)}:is(.ActionListContent.ActionListContent--visual16[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-32)}:is(.ActionListContent.ActionListContent--visual20[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-36)}:is(.ActionListContent.ActionListContent--visual24[aria-expanded]+.ActionList--subGroup) .ActionListContent{padding-left:var(--base-size-40)}.ActionListContent[aria-expanded=true] .ActionListItem-collapseIcon{transition:transform .12s linear;transform:scaleY(-1)}.ActionListContent[aria-expanded=true]+.ActionList--subGroup{height:auto;overflow:visible;visibility:visible;opacity:1;transform:translateY(0)}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=true]>.ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListContent[aria-expanded=false] .ActionListItem-collapseIcon{transition:transform .12s linear;transform:scaleY(1)}.ActionListContent[aria-expanded=false]+.ActionList--subGroup{height:0;overflow:hidden;visibility:hidden;opacity:0;transform:translateY(calc(var(--base-size-16)*-1))}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]{background:var(--control-transparent-bgColor-selected)}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false] .ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]+.ActionListItem:before,.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]:before{visibility:hidden}.ActionListContent.ActionListContent--hasActiveSubItem[aria-expanded=false]:after{position:absolute;top:calc(50% - 12px);left:calc(var(--base-size-8)*-1);width:var(--base-size-4);height:var(--base-size-24);content:"";background:var(--borderColor-accent-emphasis);border-radius:var(--borderRadius-medium)}:is(.ActionListContent[aria-checked=true],.ActionListContent[aria-selected=true]) .FormControl-checkbox{background:var(--control-checked-bgColor-rest);border-color:var(--control-checked-borderColor-rest);transition:background-color,border-color 80ms cubic-bezier(.32,0,.67,0) 0s}:is(:is(.ActionListContent[aria-checked=true],.ActionListContent[aria-selected=true]) .FormControl-checkbox):before{visibility:visible;transition:visibility 0s linear 0s;animation:checkmarkIn 80ms cubic-bezier(.65,0,.35,1) 80ms forwards}:is(.ActionListContent[aria-checked=true],.ActionListContent[aria-selected=true]) .ActionListItem-singleSelectCheckmark{visibility:visible}:is(.ActionListContent[aria-checked=false],.ActionListContent[aria-selected=false]) .ActionListItem-singleSelectCheckmark{visibility:hidden;transition:visibility 0s linear .2s}.ActionListContent.ActionListContent--sizeLarge{--actionListContent-paddingBlock:var(--control-large-paddingBlock)}.ActionListContent.ActionListContent--sizeXLarge{--actionListContent-paddingBlock:var(--control-xlarge-paddingBlock)}@media (pointer:coarse){.ActionListContent{--actionListContent-paddingBlock:var(--control-large-paddingBlock)}}.ActionListContent.ActionListContent--blockDescription .ActionListItem-visual{place-self:start}.ActionListItem-action--leading{grid-area:leadingAction}.ActionListItem-visual--leading{grid-area:leadingVisual}.ActionListItem-visual--trailing{grid-area:trailingVisual}.ActionListItem-action--trailing{grid-area:trailingAction}.ActionListItem-visual--leading svg{fill:currentcolor}.ActionListItem-descriptionWrap{grid-area:label;display:flex;flex-direction:column;gap:var(--base-size-4)}.ActionListItem-descriptionWrap .ActionListItem-label{font-weight:var(--base-text-weight-semibold)}.ActionListItem-descriptionWrap--inline{position:relative;flex-direction:row;align-items:baseline;gap:var(--base-size-8)}.ActionListItem-description{font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-normal);line-height:var(--text-body-lineHeight-small);color:var(--fgColor-muted)}.ActionListItem-action,.ActionListItem-visual{display:flex;min-height:var(--base-size-20);color:var(--fgColor-muted);pointer-events:none;fill:var(--fgColor-muted);align-items:center}.ActionListItem-label{position:relative;font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-normal);line-height:var(--text-body-lineHeight-medium);color:var(--fgColor-default);grid-area:label}.ActionListItem-label--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ActionListItem--subItem>.ActionListContent>.ActionListItem-label{font-size:var(--text-body-size-small);line-height:var(--text-body-lineHeight-small)}.ActionListItem--withActions{display:flex;flex-wrap:nowrap;align-items:center}.ActionListItem-trailingAction{border-top-left-radius:0;border-bottom-left-radius:0}.ActionListItem--trailingActionHover .ActionListItem-trailingAction{visibility:hidden}:is(.ActionListItem--trailingActionHover:hover,.ActionListItem--trailingActionHover:focus-within) .ActionListItem-trailingAction{visibility:visible}.ActionList-sectionDivider:not(:empty){display:flex;font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-semibold);line-height:var(--text-body-lineHeight-small);color:var(--fgColor-muted);flex-direction:column;padding-inline:var(--actionListContent-paddingBlock);padding-block:var(--base-size-8)}.ActionList-sectionDivider:empty{display:block;height:var(--borderWidth-thin);padding:0;margin-block-start:calc(var(--base-size-8) - var(--borderWidth-thin));margin-block-end:var(--base-size-8);margin-inline:calc(var(--base-size-8)*-1);list-style:none;background:var(--borderColor-muted);border:0}.ActionList-sectionDivider .ActionList-sectionDivider-title{font-size:var(--text-body-size-small);font-weight:var(--base-text-weight-semibold);color:var(--fgColor-muted);align-self:flex-start}.ActionList-sectionDivider--filled{margin-block-start:calc(var(--base-size-8) - var(--borderWidth-thin));margin-block-end:var(--base-size-8);margin-inline:calc(var(--base-size-8)*-1);background:var(--bgColor-muted);border-top:solid var(--borderWidth-thin) var(--borderColor-muted,var(--color-action-list-item-inline-divider));border-bottom:solid var(--borderWidth-thin) var(--borderColor-muted,var(--color-action-list-item-inline-divider))}.ActionList-sectionDivider--filled:empty{height:var(--base-size-8);box-sizing:border-box}.ActionList-sectionDivider--filled:first-child{margin-block-start:0}
@@ -53,8 +53,10 @@
53
53
  ".ActionListItem.ActionListItem--danger .ActionListItem-visual",
54
54
  ".ActionListItem.ActionListItem--danger:hover",
55
55
  ".ActionListItem.ActionListItem--danger:hover :is(.ActionListItem-description,.ActionListItem-label,.ActionListItem-visual)",
56
+ ".ActionListItem.ActionListItem--danger:hover [data-kbd-chord]",
56
57
  ":is(.ActionListItem.ActionListItem--danger .ActionListContent):active",
57
58
  ":is(.ActionListItem.ActionListItem--danger .ActionListContent):active :is(.ActionListItem-description,.ActionListItem-label,.ActionListItem-visual)",
59
+ ":is(.ActionListItem.ActionListItem--danger .ActionListContent):active [data-kbd-chord]",
58
60
  ".ActionListContent",
59
61
  ".ActionListContent>:not(:last-child)",
60
62
  ".ActionListContent:hover",
@@ -15,7 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
16
16
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
17
  };
18
- var _ActionMenuElement_instances, _a, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_invokerBeingClicked, _ActionMenuElement_intersectionObserver, _ActionMenuElement_focusZoneStack, _ActionMenuElement_updateLevels, _ActionMenuElement_softDisableItems, _ActionMenuElement_potentiallyDisallowActivation, _ActionMenuElement_isAnchorActivationViaSpace, _ActionMenuElement_isClipboardActivationViaKeyboard, _ActionMenuElement_isActivation, _ActionMenuElement_handleItemKeyboardEvent, _ActionMenuElement_handleToggleEvent, _ActionMenuElement_handleInvokerActivated, _ActionMenuElement_handleDialogItemActivated, _ActionMenuElement_handleItemActivated, _ActionMenuElement_handleIncludeFragmentReplaced, _ActionMenuElement_handleFocusOut, _ActionMenuElement_show, _ActionMenuElement_hide, _ActionMenuElement_isOpen, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_firstItem_get, _ActionMenuElement_subMenuForItem, _ActionMenuElement_itemForSubMenu;
18
+ var _ActionMenuElement_instances, _a, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_invokerBeingClicked, _ActionMenuElement_intersectionObserver, _ActionMenuElement_focusZoneStack, _ActionMenuElement_updateLevels, _ActionMenuElement_softDisableItems, _ActionMenuElement_potentiallyDisallowActivation, _ActionMenuElement_isAnchorActivationViaSpace, _ActionMenuElement_isClipboardActivationViaKeyboard, _ActionMenuElement_isActivation, _ActionMenuElement_handleItemKeyboardEvent, _ActionMenuElement_handleBeforeToggleEvent, _ActionMenuElement_handleToggleEvent, _ActionMenuElement_toggledMenu, _ActionMenuElement_handleInvokerActivated, _ActionMenuElement_handleDialogItemActivated, _ActionMenuElement_handleItemActivated, _ActionMenuElement_handleIncludeFragmentReplaced, _ActionMenuElement_handleFocusOut, _ActionMenuElement_show, _ActionMenuElement_hide, _ActionMenuElement_isOpen, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_firstItem_get, _ActionMenuElement_subMenuForItem, _ActionMenuElement_itemForSubMenu;
19
19
  var ActionMenuElement_1;
20
20
  import { controller, target } from '@github/catalyst';
21
21
  import '@oddbird/popover-polyfill';
@@ -103,6 +103,7 @@ let ActionMenuElement = ActionMenuElement_1 = _a = class ActionMenuElement exten
103
103
  this.addEventListener('mouseover', this, { signal });
104
104
  this.addEventListener('focusout', this, { signal });
105
105
  this.addEventListener('mousedown', this, { signal });
106
+ this.addEventListener('beforetoggle', this, { signal, capture: true });
106
107
  this.addEventListener('toggle', this, { signal, capture: true });
107
108
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_setDynamicLabel).call(this);
108
109
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_updateInput).call(this);
@@ -152,6 +153,10 @@ let ActionMenuElement = ActionMenuElement_1 = _a = class ActionMenuElement exten
152
153
  handleEvent(event) {
153
154
  const targetIsInvoker = this.invokerElement?.contains(event.target);
154
155
  const eventIsActivation = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivation).call(this, event);
156
+ if (event.type === 'beforetoggle' && event instanceof ToggleEvent) {
157
+ __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleBeforeToggleEvent).call(this, event);
158
+ return;
159
+ }
155
160
  if (event.type === 'toggle' && event instanceof ToggleEvent) {
156
161
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleToggleEvent).call(this, event);
157
162
  return;
@@ -356,38 +361,50 @@ _ActionMenuElement_handleItemKeyboardEvent = function _ActionMenuElement_handleI
356
361
  subMenu?.showPopover();
357
362
  break;
358
363
  }
359
- case 'ArrowLeft':
360
- if (item.closest('role[menu]') !== this.list) {
361
- const overlay = item.closest('anchored-position');
362
- overlay?.hidePopover();
364
+ case 'ArrowLeft': {
365
+ const overlay = item.closest('anchored-position');
366
+ if (overlay && overlay !== this.overlay) {
367
+ overlay.hidePopover();
363
368
  }
364
369
  break;
370
+ }
365
371
  }
366
372
  };
373
+ _ActionMenuElement_handleBeforeToggleEvent = function _ActionMenuElement_handleBeforeToggleEvent(event) {
374
+ if (event.newState !== 'closed')
375
+ return;
376
+ const menu = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_toggledMenu).call(this, event);
377
+ if (!menu)
378
+ return;
379
+ __classPrivateFieldGet(this, _ActionMenuElement_focusZoneStack, "f").pop(menu);
380
+ // The primary menu's popover hands focus back to the invoker itself
381
+ if (menu === this.overlay)
382
+ return;
383
+ // A nested popover does not hand focus back when it closes, so a sub-menu closed
384
+ // with ArrowLeft or Escape would leave focus on the body and the focusout handler
385
+ // would then close the whole menu. Move focus to the sub-menu's item before the
386
+ // sub-menu hides, while focus is still inside it. Doing this synchronously, rather
387
+ // than in the async toggle event, keeps focus from ever reaching the body.
388
+ if (!menu.contains(document.activeElement))
389
+ return;
390
+ __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_itemForSubMenu).call(this, menu)?.focus();
391
+ };
367
392
  _ActionMenuElement_handleToggleEvent = function _ActionMenuElement_handleToggleEvent(event) {
368
- const subMenu = event.target;
369
- // Ignore toggle events from non-anchored-position elements (e.g. tooltips inside the menu)
370
- if (!(event.target instanceof AnchoredPositionElement))
393
+ const menu = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_toggledMenu).call(this, event);
394
+ if (!menu)
371
395
  return;
372
396
  if (event.newState === 'open') {
373
397
  // allow tabbing away from primary menu, but trap focus in sub-menus
374
- const isPrimaryMenu = subMenu === this.overlay;
375
- __classPrivateFieldGet(this, _ActionMenuElement_focusZoneStack, "f").push(subMenu, { trapFocus: !isPrimaryMenu });
398
+ const isPrimaryMenu = menu === this.overlay;
399
+ __classPrivateFieldGet(this, _ActionMenuElement_focusZoneStack, "f").push(menu, { trapFocus: !isPrimaryMenu });
376
400
  window.requestAnimationFrame(() => {
377
- const firstItem = subMenu.querySelector(ActionMenuElement_1.menuItemSelectors.join(','));
401
+ const firstItem = menu.querySelector(ActionMenuElement_1.menuItemSelectors.join(','));
378
402
  firstItem?.focus();
379
403
  });
380
404
  }
381
- else {
382
- // Note that this will also cause focus to return to the invoker button, which is
383
- // desirable
384
- __classPrivateFieldGet(this, _ActionMenuElement_focusZoneStack, "f").pop(subMenu);
385
- const item = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_itemForSubMenu).call(this, subMenu);
386
- const openPopover = document.querySelector(':popover-open');
387
- if (item && !openPopover) {
388
- item.focus();
389
- }
390
- }
405
+ };
406
+ _ActionMenuElement_toggledMenu = function _ActionMenuElement_toggledMenu(event) {
407
+ return event.target instanceof AnchoredPositionElement ? event.target : null;
391
408
  };
392
409
  _ActionMenuElement_handleInvokerActivated = function _ActionMenuElement_handleInvokerActivated(event) {
393
410
  event.preventDefault();
@@ -1,7 +1,7 @@
1
1
  import AnchoredPositionElement from '../../anchored_position';
2
2
  type StackEntry = {
3
3
  element: AnchoredPositionElement;
4
- abortController?: AbortController;
4
+ abortController: AbortController;
5
5
  };
6
6
  export declare class ActionMenuFocusZoneStack {
7
7
  #private;
@@ -29,11 +29,11 @@ export class ActionMenuFocusZoneStack {
29
29
  if (target) {
30
30
  while (__classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").length > 0 && this.current?.element !== target) {
31
31
  const entry = __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").pop();
32
- entry?.abortController?.abort();
32
+ entry?.abortController.abort();
33
33
  }
34
34
  }
35
35
  const entry = __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").pop();
36
- entry?.abortController?.abort();
36
+ entry?.abortController.abort();
37
37
  }
38
38
  elementIsMenuItem(element) {
39
39
  return __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_instances, "a", _ActionMenuFocusZoneStack_validItemRoles_get).includes(element.getAttribute('role') || '');
@@ -50,13 +50,12 @@ _ActionMenuFocusZoneStack_stack = new WeakMap(), _ActionMenuFocusZoneStack_insta
50
50
  return this.elementIsMenuItem(element) && element.closest('anchored-position') === containerEl;
51
51
  },
52
52
  });
53
+ // focusTrap() returns nothing when given a signal, so hand back the focus zone's
54
+ // controller in both cases. Aborting it tears down the focus trap as well.
53
55
  if (trapFocus) {
54
- const { signal: focusZoneSignal } = focusZoneAbortController;
55
- return focusTrap(containerEl, undefined, focusZoneSignal);
56
- }
57
- else {
58
- return focusZoneAbortController;
56
+ focusTrap(containerEl, undefined, focusZoneAbortController.signal);
59
57
  }
58
+ return focusZoneAbortController;
60
59
  }, _ActionMenuFocusZoneStack_validItemRoles_get = function _ActionMenuFocusZoneStack_validItemRoles_get() {
61
60
  return ActionMenuElement.validItemRoles;
62
61
  };
@@ -1 +1 @@
1
- :root{--duration-fast:80ms;--easing-easeInOut:cubic-bezier(0.65,0,0.35,1)}.Button{position:relative;display:inline-flex;min-width:max-content;height:var(--control-medium-size);padding:0 var(--control-medium-paddingInline-normal);font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-medium);color:var(--button-default-fgColor-rest);text-align:center;cursor:pointer;flex-direction:row;-webkit-user-select:none;user-select:none;background-color:initial;border:var(--borderWidth-thin) solid;border-color:#0000;border-radius:var(--borderRadius-medium);transition:var(--duration-fast) var(--easing-easeInOut);transition-property:color,fill,background-color,border-color;justify-content:space-between;align-items:center;gap:var(--base-size-4)}@media (pointer:coarse){:is(.Button:before){position:absolute;top:50%;left:50%;width:100%;height:100%;min-height:48px;content:"";transform:translateX(-50%) translateY(-50%);min-width:48px}}.Button:hover{transition-duration:var(--duration-fast)}.Button:active{transition:none}.Button:disabled,.Button[aria-disabled=true]{cursor:not-allowed;box-shadow:none}.Button.Button--iconOnly{color:var(--fgColor-muted)}:is(a.Button,summary.Button):hover{-webkit-text-decoration:none;text-decoration:none}.Button-content{flex:1 0 auto;display:grid;grid-template-areas:"leadingVisual text trailingVisual";grid-template-columns:min-content minmax(0,auto) min-content;align-items:center;place-content:center}.Button-content>:not(:last-child){margin-right:var(--control-medium-gap)}.Button-content--alignStart{justify-content:start}.Button-visual{display:flex;pointer-events:none}.Button-visual .Counter{color:inherit;background-color:var(--buttonCounter-default-bgColor-rest)}.Button-label{line-height:var(--text-body-lineHeight-medium);white-space:nowrap;grid-area:text}.Button-leadingVisual{grid-area:leadingVisual}.Button-leadingVisual svg{fill:currentcolor}.Button-trailingVisual{grid-area:trailingVisual}.Button-trailingAction{margin-right:calc(var(--base-size-4)*-1)}.Button--small{min-width:var(--control-small-size);height:var(--control-small-size);padding:0 var(--control-small-paddingInline-condensed);font-size:var(--text-body-size-small);gap:var(--control-small-gap)}.Button--small .Button-label{line-height:var(--text-body-lineHeight-small)}:is(.Button--small .Button-content)>:not(:last-child){margin-right:var(--control-small-gap)}.Button--large{height:var(--control-large-size);padding:0 var(--control-large-paddingInline-spacious);gap:var(--control-large-gap)}.Button--large .Button-label{line-height:var(--text-body-lineHeight-large)}:is(.Button--large .Button-content)>:not(:last-child){margin-right:var(--control-large-gap)}.Button--fullWidth{width:100%}.Button--labelWrap{min-width:fit-content;height:unset;min-height:var(--control-medium-size)}.Button--labelWrap .Button-content{flex:1 1 auto;align-self:stretch;padding-block:calc(var(--control-medium-paddingBlock) - var(--base-size-2))}.Button--labelWrap .Button-label{white-space:unset}.Button--labelWrap.Button--small{height:unset;min-height:var(--control-small-size)}.Button--labelWrap.Button--small .Button-content{padding-block:calc(var(--control-small-paddingBlock) - var(--base-size-2))}.Button--labelWrap.Button--large{height:unset;min-height:var(--control-large-size);padding-inline:var(--control-large-paddingInline-spacious)}.Button--labelWrap.Button--large .Button-content{padding-block:calc(var(--control-large-paddingBlock) - var(--base-size-2))}.Button--primary{color:var(--button-primary-fgColor-rest);fill:var(--button-primary-iconColor-rest);background-color:var(--button-primary-bgColor-rest);border-color:var(--button-primary-borderColor-rest);box-shadow:var(--shadow-resting-small,var(--color-btn-primary-shadow))}.Button--primary.Button--iconOnly{color:var(--button-primary-iconColor-rest)}.Button--primary:hover:not(:disabled,.Button--inactive){background-color:var(--button-primary-bgColor-hover);border-color:var(--button-primary-borderColor-hover)}.Button--primary:focus{outline:2px solid var(--focus-outlineColor);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis)}.Button--primary:focus:not(:focus-visible){outline:1px solid #0000;box-shadow:none}.Button--primary:focus-visible{outline:2px solid var(--focus-outlineColor);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis)}.Button--primary:active:not(:disabled),.Button--primary[aria-pressed=true]{background-color:var(--button-primary-bgColor-active);box-shadow:var(--button-primary-shadow-selected)}.Button--primary:disabled,.Button--primary[aria-disabled=true]{color:var(--button-primary-fgColor-disabled);fill:var(--button-primary-fgColor-disabled);background-color:var(--button-primary-bgColor-disabled);border-color:var(--button-primary-borderColor-disabled)}.Button--primary .Counter{color:inherit;background-color:var(--buttonCounter-primary-bgColor-rest)}.Button--secondary{color:var(--button-default-fgColor-rest);fill:var(--fgColor-muted);background-color:var(--button-default-bgColor-rest);border-color:var(--button-default-borderColor-rest);box-shadow:var(--button-default-shadow-resting),var(--button-default-shadow-inset)}.Button--secondary:hover:not(:disabled,.Button--inactive){background-color:var(--button-default-bgColor-hover);border-color:var(--button-default-borderColor-hover)}.Button--secondary:active:not(:disabled){background-color:var(--button-default-bgColor-active);border-color:var(--button-default-borderColor-active)}.Button--secondary[aria-pressed=true]{background-color:var(--button-default-bgColor-selected);box-shadow:var(--shadow-inset)}.Button--secondary:disabled,.Button--secondary[aria-disabled=true]{color:var(--control-fgColor-disabled);fill:var(--control-fgColor-disabled);background-color:var(--button-default-bgColor-disabled);border-color:var(--button-default-borderColor-disabled)}.Button--invisible{color:var(--button-invisible-fgColor-rest)}.Button--invisible.Button--iconOnly{color:var(--button-invisible-iconColor-rest,var(--color-fg-muted))}.Button--invisible:hover:not(:disabled,.Button--inactive){background-color:var(--control-transparent-bgColor-hover,var(--color-action-list-item-default-hover-bg))}.Button--invisible:active:not(:disabled),.Button--invisible[aria-pressed=true]{background-color:var(--button-invisible-bgColor-active)}.Button--invisible:disabled,.Button--invisible[aria-disabled=true]{color:var(--button-invisible-fgColor-disabled);fill:var(--button-invisible-fgColor-disabled);background-color:var(--button-invisible-bgColor-disabled);border-color:var(--button-invisible-borderColor-disabled)}.Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--button-invisible-fgColor-rest)}.Button--invisible .Button-visual{color:var(--button-invisible-iconColor-rest,var(--color-fg-muted))}:is(.Button--invisible .Button-visual) .Counter{color:var(--fgColor-default)}.Button--link{display:inline-block;min-width:fit-content;height:unset;padding:0;font-size:inherit;color:var(--fgColor-link);fill:var(--fgColor-link);border:none}.Button--link:hover:not(:disabled,.Button--inactive){-webkit-text-decoration:underline;text-decoration:underline}.Button--link:focus,.Button--link:focus-visible{outline-offset:2px}.Button--link:disabled,.Button--link[aria-disabled=true]{color:var(--control-fgColor-disabled);fill:var(--control-fgColor-disabled);background-color:initial;border-color:#0000}.Button--link .Button-label{white-space:unset}.Button--danger{color:var(--button-danger-fgColor-rest);fill:var(--button-danger-iconColor-rest);background-color:var(--button-danger-bgColor-rest);border-color:var(--button-danger-borderColor-rest);box-shadow:var(--button-default-shadow-resting),var(--button-default-shadow-inset)}.Button--danger.Button--iconOnly{color:var(--button-danger-iconColor-rest)}.Button--danger:hover:not(:disabled,.Button--inactive){color:var(--button-danger-fgColor-hover);fill:var(--button-danger-fgColor-hover);background-color:var(--button-danger-bgColor-hover);border-color:var(--button-danger-borderColor-hover);box-shadow:var(--shadow-resting-small)}.Button--danger:hover:not(:disabled,.Button--inactive) .Counter{color:var(--buttonCounter-danger-fgColor-hover);background-color:var(--buttonCounter-danger-bgColor-hover)}.Button--danger:active:not(:disabled),.Button--danger[aria-pressed=true]{color:var(--button-danger-fgColor-active);fill:var(--button-danger-fgColor-active);background-color:var(--button-danger-bgColor-active);border-color:var(--button-danger-borderColor-active);box-shadow:var(--button-danger-shadow-selected)}.Button--danger:disabled,.Button--danger[aria-disabled=true]{color:var(--button-danger-fgColor-disabled);fill:var(--button-danger-fgColor-disabled);background-color:var(--button-danger-bgColor-disabled);border-color:var(--button-default-borderColor-disabled)}:is(.Button--danger:disabled,.Button--danger[aria-disabled=true]) .Counter{color:var(--buttonCounter-danger-fgColor-disabled);background-color:var(--buttonCounter-danger-bgColor-disabled)}.Button--danger .Counter{color:var(--buttonCounter-danger-fgColor-rest);background-color:var(--buttonCounter-danger-bgColor-rest)}.Button--iconOnly{display:inline-grid;width:var(--control-medium-size);padding:unset;place-content:center}.Button--iconOnly.Button--small{width:var(--control-small-size)}.Button--iconOnly.Button--large{width:var(--control-large-size)}.Button--inactive:not([aria-disabled=true],:disabled){color:var(--button-inactive-fgColor);cursor:default;background-color:var(--button-inactive-bgColor);border:0}
1
+ :root{--duration-fast:80ms;--easing-easeInOut:cubic-bezier(0.65,0,0.35,1)}.Button{position:relative;display:inline-flex;min-width:max-content;height:var(--control-medium-size);padding:0 var(--control-medium-paddingInline-normal);font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-medium);color:var(--button-default-fgColor-rest);text-align:center;cursor:pointer;flex-direction:row;-webkit-user-select:none;user-select:none;background-color:initial;border:var(--borderWidth-thin) solid;border-color:#0000;border-radius:var(--borderRadius-medium);transition:var(--duration-fast) var(--easing-easeInOut);transition-property:color,fill,background-color,border-color;justify-content:space-between;align-items:center;gap:var(--base-size-4)}@media (pointer:coarse){:is(.Button:before){position:absolute;top:50%;left:50%;width:100%;height:100%;min-height:48px;content:"";transform:translateX(-50%) translateY(-50%);min-width:48px}}.Button:hover{transition-duration:var(--duration-fast)}.Button:active{transition:none}.Button:disabled,.Button[aria-disabled=true]{cursor:not-allowed;box-shadow:none}.Button:has([data-kbd-chord]):not(.Button--link){padding-inline-end:var(--base-size-6)}.Button.Button--iconOnly{color:var(--fgColor-muted)}:is(a.Button,summary.Button):hover{-webkit-text-decoration:none;text-decoration:none}.Button-content{flex:1 0 auto;display:grid;grid-template-areas:"leadingVisual text trailingVisual";grid-template-columns:min-content minmax(0,auto) min-content;align-items:center;place-content:center}.Button-content>:not(:last-child){margin-right:var(--control-medium-gap)}.Button-content--alignStart{justify-content:start}.Button-visual{display:flex;pointer-events:none}.Button-visual .Counter{color:inherit;background-color:var(--buttonCounter-default-bgColor-rest)}.Button-label{line-height:var(--text-body-lineHeight-medium);white-space:nowrap;grid-area:text}.Button-leadingVisual{grid-area:leadingVisual}.Button-leadingVisual svg{fill:currentcolor}.Button-trailingVisual{grid-area:trailingVisual}.Button-trailingAction{margin-right:calc(var(--base-size-4)*-1)}.Button--small{min-width:var(--control-small-size);height:var(--control-small-size);padding:0 var(--control-small-paddingInline-condensed);font-size:var(--text-body-size-small);gap:var(--control-small-gap)}.Button--small .Button-label{line-height:var(--text-body-lineHeight-small)}:is(.Button--small .Button-content)>:not(:last-child){margin-right:var(--control-small-gap)}.Button--large{height:var(--control-large-size);padding:0 var(--control-large-paddingInline-spacious);gap:var(--control-large-gap)}.Button--large .Button-label{line-height:var(--text-body-lineHeight-large)}:is(.Button--large .Button-content)>:not(:last-child){margin-right:var(--control-large-gap)}.Button--large:has([data-kbd-chord]):not(.Button--link){padding-inline-end:var(--base-size-8)}.Button--fullWidth{width:100%}.Button--labelWrap{min-width:fit-content;height:unset;min-height:var(--control-medium-size)}.Button--labelWrap .Button-content{flex:1 1 auto;align-self:stretch;padding-block:calc(var(--control-medium-paddingBlock) - var(--base-size-2))}.Button--labelWrap .Button-label{white-space:unset}.Button--labelWrap.Button--small{height:unset;min-height:var(--control-small-size)}.Button--labelWrap.Button--small .Button-content{padding-block:calc(var(--control-small-paddingBlock) - var(--base-size-2))}.Button--labelWrap.Button--large{height:unset;min-height:var(--control-large-size);padding-inline:var(--control-large-paddingInline-spacious)}.Button--labelWrap.Button--large .Button-content{padding-block:calc(var(--control-large-paddingBlock) - var(--base-size-2))}.Button--primary{color:var(--button-primary-fgColor-rest);fill:var(--button-primary-iconColor-rest);background-color:var(--button-primary-bgColor-rest);border-color:var(--button-primary-borderColor-rest);box-shadow:var(--shadow-resting-small,var(--color-btn-primary-shadow))}.Button--primary.Button--iconOnly{color:var(--button-primary-iconColor-rest)}.Button--primary:hover:not(:disabled,.Button--inactive){background-color:var(--button-primary-bgColor-hover);border-color:var(--button-primary-borderColor-hover)}.Button--primary:focus{outline:2px solid var(--focus-outlineColor);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis)}.Button--primary:focus:not(:focus-visible){outline:1px solid #0000;box-shadow:none}.Button--primary:focus-visible{outline:2px solid var(--focus-outlineColor);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis)}.Button--primary:active:not(:disabled),.Button--primary[aria-pressed=true]{background-color:var(--button-primary-bgColor-active);box-shadow:var(--button-primary-shadow-selected)}.Button--primary:disabled,.Button--primary[aria-disabled=true]{color:var(--button-primary-fgColor-disabled);fill:var(--button-primary-fgColor-disabled);background-color:var(--button-primary-bgColor-disabled);border-color:var(--button-primary-borderColor-disabled)}:is(.Button--primary:disabled,.Button--primary[aria-disabled=true]) [data-kbd-chord]{color:var(--buttonKeybindingHint-primary-fgColor-disabled);background:var(--buttonKeybindingHint-primary-bgColor-disabled);border-color:var(--buttonKeybindingHint-primary-borderColor-disabled)}.Button--primary .Counter{color:inherit;background-color:var(--buttonCounter-primary-bgColor-rest)}.Button--primary [data-kbd-chord]{color:var(--buttonKeybindingHint-primary-fgColor-rest);background:var(--buttonKeybindingHint-primary-bgColor-rest);border-color:var(--buttonKeybindingHint-primary-borderColor-rest)}.Button--secondary{color:var(--button-default-fgColor-rest);fill:var(--fgColor-muted);background-color:var(--button-default-bgColor-rest);border-color:var(--button-default-borderColor-rest);box-shadow:var(--button-default-shadow-resting),var(--button-default-shadow-inset)}.Button--secondary:hover:not(:disabled,.Button--inactive){background-color:var(--button-default-bgColor-hover);border-color:var(--button-default-borderColor-hover)}.Button--secondary:active:not(:disabled){background-color:var(--button-default-bgColor-active);border-color:var(--button-default-borderColor-active)}.Button--secondary[aria-pressed=true]{background-color:var(--button-default-bgColor-selected);box-shadow:var(--shadow-inset)}.Button--secondary:disabled,.Button--secondary[aria-disabled=true]{color:var(--control-fgColor-disabled);fill:var(--control-fgColor-disabled);background-color:var(--button-default-bgColor-disabled);border-color:var(--button-default-borderColor-disabled)}:is(.Button--secondary:disabled,.Button--secondary[aria-disabled=true]) [data-kbd-chord]{color:var(--buttonKeybindingHint-default-fgColor-disabled);background:var(--buttonKeybindingHint-default-bgColor-disabled);border-color:var(--buttonKeybindingHint-default-borderColor-disabled)}.Button--secondary [data-kbd-chord]{color:var(--buttonKeybindingHint-default-fgColor-rest);background:var(--buttonKeybindingHint-default-bgColor-rest);border-color:var(--buttonKeybindingHint-default-borderColor-rest)}.Button--invisible{color:var(--button-invisible-fgColor-rest)}.Button--invisible.Button--iconOnly{color:var(--button-invisible-iconColor-rest,var(--color-fg-muted))}.Button--invisible:hover:not(:disabled,.Button--inactive){background-color:var(--control-transparent-bgColor-hover,var(--color-action-list-item-default-hover-bg))}.Button--invisible:active:not(:disabled),.Button--invisible[aria-pressed=true]{background-color:var(--button-invisible-bgColor-active)}.Button--invisible:disabled,.Button--invisible[aria-disabled=true]{color:var(--button-invisible-fgColor-disabled);fill:var(--button-invisible-fgColor-disabled);background-color:var(--button-invisible-bgColor-disabled);border-color:var(--button-invisible-borderColor-disabled)}:is(.Button--invisible:disabled,.Button--invisible[aria-disabled=true]) [data-kbd-chord]{color:var(--buttonKeybindingHint-invisible-fgColor-disabled);background:var(--buttonKeybindingHint-invisible-bgColor-disabled);border-color:var(--buttonKeybindingHint-invisible-borderColor-disabled)}.Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--button-invisible-fgColor-rest)}.Button--invisible .Button-visual{color:var(--button-invisible-iconColor-rest,var(--color-fg-muted))}:is(.Button--invisible .Button-visual) .Counter{color:var(--fgColor-default)}.Button--invisible [data-kbd-chord]{color:var(--buttonKeybindingHint-invisible-fgColor-rest);background:var(--buttonKeybindingHint-invisible-bgColor-rest);border-color:var(--buttonKeybindingHint-invisible-borderColor-rest)}.Button--invisible:hover:not(:disabled,[aria-disabled=true],.Button--inactive) [data-kbd-chord]{background:var(--buttonKeybindingHint-invisible-bgColor-hover);transition:80ms ease-out}.Button--invisible:active:not(:disabled,[aria-disabled=true]) [data-kbd-chord]{background:var(--buttonKeybindingHint-invisible-bgColor-active);transition:80ms ease-out}.Button--link{display:inline-block;min-width:fit-content;height:unset;padding:0;font-size:inherit;color:var(--fgColor-link);fill:var(--fgColor-link);border:none}.Button--link:hover:not(:disabled,.Button--inactive){-webkit-text-decoration:underline;text-decoration:underline}.Button--link:focus,.Button--link:focus-visible{outline-offset:2px}.Button--link:disabled,.Button--link[aria-disabled=true]{color:var(--control-fgColor-disabled);fill:var(--control-fgColor-disabled);background-color:initial;border-color:#0000}.Button--link .Button-label{white-space:unset}.Button--danger{color:var(--button-danger-fgColor-rest);fill:var(--button-danger-iconColor-rest);background-color:var(--button-danger-bgColor-rest);border-color:var(--button-danger-borderColor-rest);box-shadow:var(--button-default-shadow-resting),var(--button-default-shadow-inset)}.Button--danger.Button--iconOnly{color:var(--button-danger-iconColor-rest)}.Button--danger:hover:not(:disabled,.Button--inactive){color:var(--button-danger-fgColor-hover);fill:var(--button-danger-fgColor-hover);background-color:var(--button-danger-bgColor-hover);border-color:var(--button-danger-borderColor-hover);box-shadow:var(--shadow-resting-small)}.Button--danger:hover:not(:disabled,.Button--inactive) .Counter{color:var(--buttonCounter-danger-fgColor-hover);background-color:var(--buttonCounter-danger-bgColor-hover)}.Button--danger:active:not(:disabled),.Button--danger[aria-pressed=true]{color:var(--button-danger-fgColor-active);fill:var(--button-danger-fgColor-active);background-color:var(--button-danger-bgColor-active);border-color:var(--button-danger-borderColor-active);box-shadow:var(--button-danger-shadow-selected)}.Button--danger:disabled,.Button--danger[aria-disabled=true]{color:var(--button-danger-fgColor-disabled);fill:var(--button-danger-fgColor-disabled);background-color:var(--button-danger-bgColor-disabled);border-color:var(--button-default-borderColor-disabled)}:is(.Button--danger:disabled,.Button--danger[aria-disabled=true]) .Counter{color:var(--buttonCounter-danger-fgColor-disabled);background-color:var(--buttonCounter-danger-bgColor-disabled)}:is(.Button--danger:disabled,.Button--danger[aria-disabled=true]) [data-kbd-chord]{color:var(--buttonKeybindingHint-danger-fgColor-disabled);background:var(--buttonKeybindingHint-danger-bgColor-disabled);border-color:var(--buttonKeybindingHint-danger-borderColor-disabled)}.Button--danger .Counter{color:var(--buttonCounter-danger-fgColor-rest);background-color:var(--buttonCounter-danger-bgColor-rest)}.Button--danger [data-kbd-chord]{color:var(--buttonKeybindingHint-danger-fgColor-rest);background:var(--buttonKeybindingHint-danger-bgColor-rest);border-color:var(--buttonKeybindingHint-danger-borderColor-rest)}.Button--danger:hover:not(:disabled,[aria-disabled=true],.Button--inactive) [data-kbd-chord]{color:var(--buttonKeybindingHint-danger-fgColor-hover);background:var(--buttonKeybindingHint-danger-bgColor-hover);border-color:var(--buttonKeybindingHint-danger-borderColor-hover);transition:80ms ease-out}.Button--danger:active:not(:disabled,[aria-disabled=true]) [data-kbd-chord]{color:var(--buttonKeybindingHint-danger-fgColor-active);background:var(--buttonKeybindingHint-danger-bgColor-active);border-color:var(--buttonKeybindingHint-danger-borderColor-active);transition:80ms ease-out}.Button--iconOnly{display:inline-grid;width:var(--control-medium-size);padding:unset;place-content:center}.Button--iconOnly.Button--small{width:var(--control-small-size)}.Button--iconOnly.Button--large{width:var(--control-large-size)}.Button--inactive:not([aria-disabled=true],:disabled){color:var(--button-inactive-fgColor);cursor:default;background-color:var(--button-inactive-bgColor);border:0}.Button--inactive:not([aria-disabled=true],:disabled) [data-kbd-chord]{color:var(--buttonKeybindingHint-inactive-fgColor);background:var(--buttonKeybindingHint-inactive-bgColor);border-color:var(--buttonKeybindingHint-inactive-borderColor)}
@@ -8,6 +8,7 @@
8
8
  ".Button:active",
9
9
  ".Button:disabled",
10
10
  ".Button[aria-disabled=true]",
11
+ ".Button:has([data-kbd-chord]):not(.Button--link)",
11
12
  ".Button.Button--iconOnly",
12
13
  ":is(a.Button,summary.Button):hover",
13
14
  ".Button-content",
@@ -26,6 +27,7 @@
26
27
  ".Button--large",
27
28
  ".Button--large .Button-label",
28
29
  ":is(.Button--large .Button-content)>:not(:last-child)",
30
+ ".Button--large:has([data-kbd-chord]):not(.Button--link)",
29
31
  ".Button--fullWidth",
30
32
  ".Button--labelWrap",
31
33
  ".Button--labelWrap .Button-content",
@@ -44,13 +46,17 @@
44
46
  ".Button--primary[aria-pressed=true]",
45
47
  ".Button--primary:disabled",
46
48
  ".Button--primary[aria-disabled=true]",
49
+ ":is(.Button--primary:disabled,.Button--primary[aria-disabled=true]) [data-kbd-chord]",
47
50
  ".Button--primary .Counter",
51
+ ".Button--primary [data-kbd-chord]",
48
52
  ".Button--secondary",
49
53
  ".Button--secondary:hover:not(:disabled,.Button--inactive)",
50
54
  ".Button--secondary:active:not(:disabled)",
51
55
  ".Button--secondary[aria-pressed=true]",
52
56
  ".Button--secondary:disabled",
53
57
  ".Button--secondary[aria-disabled=true]",
58
+ ":is(.Button--secondary:disabled,.Button--secondary[aria-disabled=true]) [data-kbd-chord]",
59
+ ".Button--secondary [data-kbd-chord]",
54
60
  ".Button--invisible",
55
61
  ".Button--invisible.Button--iconOnly",
56
62
  ".Button--invisible:hover:not(:disabled,.Button--inactive)",
@@ -58,9 +64,13 @@
58
64
  ".Button--invisible[aria-pressed=true]",
59
65
  ".Button--invisible:disabled",
60
66
  ".Button--invisible[aria-disabled=true]",
67
+ ":is(.Button--invisible:disabled,.Button--invisible[aria-disabled=true]) [data-kbd-chord]",
61
68
  ".Button--invisible.Button--invisible-noVisuals .Button-label",
62
69
  ".Button--invisible .Button-visual",
63
70
  ":is(.Button--invisible .Button-visual) .Counter",
71
+ ".Button--invisible [data-kbd-chord]",
72
+ ".Button--invisible:hover:not(:disabled,[aria-disabled=true],.Button--inactive) [data-kbd-chord]",
73
+ ".Button--invisible:active:not(:disabled,[aria-disabled=true]) [data-kbd-chord]",
64
74
  ".Button--link",
65
75
  ".Button--link:hover:not(:disabled,.Button--inactive)",
66
76
  ".Button--link:focus",
@@ -77,10 +87,15 @@
77
87
  ".Button--danger:disabled",
78
88
  ".Button--danger[aria-disabled=true]",
79
89
  ":is(.Button--danger:disabled,.Button--danger[aria-disabled=true]) .Counter",
90
+ ":is(.Button--danger:disabled,.Button--danger[aria-disabled=true]) [data-kbd-chord]",
80
91
  ".Button--danger .Counter",
92
+ ".Button--danger [data-kbd-chord]",
93
+ ".Button--danger:hover:not(:disabled,[aria-disabled=true],.Button--inactive) [data-kbd-chord]",
94
+ ".Button--danger:active:not(:disabled,[aria-disabled=true]) [data-kbd-chord]",
81
95
  ".Button--iconOnly",
82
96
  ".Button--iconOnly.Button--small",
83
97
  ".Button--iconOnly.Button--large",
84
- ".Button--inactive:not([aria-disabled=true],:disabled)"
98
+ ".Button--inactive:not([aria-disabled=true],:disabled)",
99
+ ".Button--inactive:not([aria-disabled=true],:disabled) [data-kbd-chord]"
85
100
  ]
86
101
  }
@@ -0,0 +1,5 @@
1
+ import type { Platform } from './platform';
2
+ /** Split a chord into lowercase, sorted key names. Empty tokens are dropped. */
3
+ export declare const splitChord: (chord: string, platform: Platform) => string[];
4
+ /** Split a sequence into chords. Repeated whitespace and empty chords are dropped. */
5
+ export declare const splitSequence: (sequence: string, platform: Platform) => string[][];
@@ -0,0 +1,29 @@
1
+ /** Modifier order. Non-modifiers sort last; there is at most one per chord. */
2
+ const keySortPriorities = {
3
+ control: 1,
4
+ meta: 2,
5
+ alt: 3,
6
+ option: 4,
7
+ shift: 5,
8
+ function: 6,
9
+ };
10
+ const keySortPriority = (key) => keySortPriorities[key] ?? Infinity;
11
+ /**
12
+ * Deviation from primer-react: `mod` is resolved to the platform's modifier
13
+ * before sorting so it takes that modifier's slot. Upstream leaves `mod`
14
+ * unprioritised, which renders "Mod+Shift+p" as ⇧⌘P.
15
+ */
16
+ const resolveMod = (key, platform) => key === 'mod' ? (platform === 'apple' ? 'meta' : 'control') : key;
17
+ /** Split a chord into lowercase, sorted key names. Empty tokens are dropped. */
18
+ export const splitChord = (chord, platform) => chord
19
+ .split('+')
20
+ .filter(key => key !== '')
21
+ .map(key => resolveMod(key.toLowerCase(), platform))
22
+ .sort((a, b) => keySortPriority(a) - keySortPriority(b));
23
+ /** Split a sequence into chords. Repeated whitespace and empty chords are dropped. */
24
+ export const splitSequence = (sequence, platform) => sequence
25
+ .trim()
26
+ .split(/\s+/)
27
+ .filter(chord => chord !== '')
28
+ .map(chord => splitChord(chord, platform))
29
+ .filter(keys => keys.length > 0);
@@ -0,0 +1,16 @@
1
+ import type { Platform } from './platform';
2
+ /**
3
+ * Short-form iconic versions of keys. These should be intuitive (not archaic) and match icons on keyboards.
4
+ */
5
+ export declare const condensedKeyName: (key: string, platform: Platform) => string;
6
+ /**
7
+ * Specific key displays for 'full' format. We still do show some icons (ie punctuation)
8
+ * because that's more intuitive, but for the rest of keys we show the standard key name.
9
+ */
10
+ export declare const fullKeyName: (key: string, platform: Platform) => string;
11
+ /**
12
+ * Accessible key names intended to be read by a screen reader. This prevents screen
13
+ * readers from expressing punctuation in speech, ie, reading a long pause instead of the
14
+ * word "period".
15
+ */
16
+ export declare const accessibleKeyName: (key: string, platform: Platform) => string;
@@ -0,0 +1,107 @@
1
+ /** Converts the first character of the string to upper case and the remaining to lower case. */
2
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
3
+ const capitalize = ([first, ...rest]) => (first?.toUpperCase() ?? '') + rest.join('').toLowerCase();
4
+ // In the below records, we don't intend to cover every single possible key - only those that
5
+ // would be realistically used in shortcuts. For example, the Pause/Break key is not necessary
6
+ // because it is not found on many keyboards.
7
+ /**
8
+ * Short-form iconic versions of keys. These should be intuitive (not archaic) and match icons on keyboards.
9
+ */
10
+ export const condensedKeyName = (key, platform) => ({
11
+ alt: platform === 'apple' ? '⌥' : 'Alt', // the alt key _is_ the option key on MacOS - in the browser there is no "option" key
12
+ control: '⌃',
13
+ shift: '⇧',
14
+ meta: platform === 'apple' ? '⌘' : platform === 'windows' ? 'Win' : 'Meta',
15
+ mod: platform === 'apple' ? '⌘' : '⌃',
16
+ pageup: 'PgUp',
17
+ pagedown: 'PgDn',
18
+ arrowup: '↑',
19
+ arrowdown: '↓',
20
+ arrowleft: '←',
21
+ arrowright: '→',
22
+ plus: '+', // needed to allow +-separated chords
23
+ backspace: '⌫',
24
+ delete: 'Del',
25
+ space: '␣', // needed to allow space-separated sequences
26
+ tab: '⇥',
27
+ enter: '⏎',
28
+ escape: 'Esc',
29
+ function: 'Fn',
30
+ capslock: 'CapsLock',
31
+ insert: 'Ins',
32
+ printscreen: 'PrtScn',
33
+ })[key] ?? capitalize(key);
34
+ /**
35
+ * Specific key displays for 'full' format. We still do show some icons (ie punctuation)
36
+ * because that's more intuitive, but for the rest of keys we show the standard key name.
37
+ */
38
+ export const fullKeyName = (key, platform) => ({
39
+ alt: platform === 'apple' ? 'Option' : 'Alt',
40
+ meta: platform === 'apple' ? 'Command' : platform === 'windows' ? 'Windows' : 'Meta',
41
+ mod: platform === 'apple' ? 'Command' : 'Control',
42
+ '+': 'Plus',
43
+ pageup: 'Page Up',
44
+ pagedown: 'Page Down',
45
+ arrowup: 'Up Arrow',
46
+ arrowdown: 'Down Arrow',
47
+ arrowleft: 'Left Arrow',
48
+ arrowright: 'Right Arrow',
49
+ capslock: 'Caps Lock',
50
+ printscreen: 'Print Screen',
51
+ })[key] ?? capitalize(key);
52
+ /**
53
+ * Accessible key names intended to be read by a screen reader. This prevents screen
54
+ * readers from expressing punctuation in speech, ie, reading a long pause instead of the
55
+ * word "period".
56
+ */
57
+ export const accessibleKeyName = (key, platform) => ({
58
+ alt: platform === 'apple' ? 'option' : 'alt',
59
+ meta: platform === 'apple' ? 'command' : platform === 'windows' ? 'Windows' : 'meta',
60
+ mod: platform === 'apple' ? 'command' : 'control',
61
+ // Screen readers may not be able to pronounce concatenated words - this provides a better experience
62
+ pageup: 'page up',
63
+ pagedown: 'page down',
64
+ arrowup: 'up arrow',
65
+ arrowdown: 'down arrow',
66
+ arrowleft: 'left arrow',
67
+ arrowright: 'right arrow',
68
+ capslock: 'caps lock',
69
+ printscreen: 'print screen',
70
+ // We don't need to represent _every_ symbol - only those found on standard keyboards.
71
+ // Other symbols should be avoided as keyboard shortcuts anyway.
72
+ // These should match the colloquial names of the keys, not the names of the symbols. Ie,
73
+ // "Equals" not "Equal Sign", "Dash" not "Minus", "Period" not "Dot", etc.
74
+ '`': 'backtick',
75
+ '~': 'tilde',
76
+ '!': 'exclamation point',
77
+ '@': 'at',
78
+ '#': 'hash',
79
+ $: 'dollar sign',
80
+ '%': 'percent',
81
+ '^': 'caret',
82
+ '&': 'ampersand',
83
+ '*': 'asterisk',
84
+ '(': 'left parenthesis',
85
+ ')': 'right parenthesis',
86
+ _: 'underscore',
87
+ '-': 'dash',
88
+ '+': 'plus',
89
+ '=': 'equals',
90
+ '[': 'left bracket',
91
+ '{': 'left curly brace',
92
+ ']': 'right bracket',
93
+ '}': 'right curly brace',
94
+ '\\': 'backslash',
95
+ '|': 'pipe',
96
+ ';': 'semicolon',
97
+ ':': 'colon',
98
+ "'": 'single quote',
99
+ '"': 'double quote',
100
+ ',': 'comma',
101
+ '<': 'left angle bracket',
102
+ '.': 'period',
103
+ '>': 'right angle bracket',
104
+ '/': 'forward slash',
105
+ '?': 'question mark',
106
+ ' ': 'space',
107
+ })[key] ?? key.toLowerCase();
@@ -0,0 +1,22 @@
1
+ import type { Platform } from './platform';
2
+ export type NameFormat = 'condensed' | 'full' | 'accessible';
3
+ type PlatformNames = Partial<Record<Platform, string>>;
4
+ /** `separator` is the JSON `then` (the word spoken between chords). */
5
+ export type KeyNames = {
6
+ separator?: string;
7
+ keys: Record<string, Partial<Record<NameFormat, PlatformNames>>>;
8
+ };
9
+ /** Same notion of blank as Ruby's `String#blank?` (`[[:space:]]`, i.e. Unicode White_Space). */
10
+ export declare const nonBlank: (value: unknown) => string | undefined;
11
+ /** Parses the `data-names` attribute; anything malformed yields no names. */
12
+ export declare function parseKeyNames(json: string): KeyNames;
13
+ /** Exact platform, then `other`; `undefined` when no usable name was given. */
14
+ export declare function localizedKeyName(names: KeyNames, key: string, format: NameFormat, platform: Platform): string | undefined;
15
+ /**
16
+ * Upstream's English name. The mirrored tables index plain object literals, so
17
+ * a key such as `constructor` would return an `Object.prototype` member;
18
+ * those keys get upstream's default spelling instead.
19
+ */
20
+ export declare function englishKeyName(key: string, format: NameFormat, platform: Platform): string;
21
+ export declare function keyName(names: KeyNames, key: string, format: NameFormat, platform: Platform): string;
22
+ export {};
@@ -0,0 +1,47 @@
1
+ import { accessibleKeyName, condensedKeyName, fullKeyName } from './key_names';
2
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
3
+ const own = (record, key) => Object.hasOwn(record, key) ? record[key] : undefined;
4
+ /** Same notion of blank as Ruby's `String#blank?` (`[[:space:]]`, i.e. Unicode White_Space). */
5
+ export const nonBlank = (value) => typeof value === 'string' && !/^\p{White_Space}*$/u.test(value) ? value : undefined;
6
+ /** Parses the `data-names` attribute; anything malformed yields no names. */
7
+ export function parseKeyNames(json) {
8
+ try {
9
+ const parsed = JSON.parse(json);
10
+ if (isRecord(parsed) && isRecord(parsed.keys)) {
11
+ return { separator: nonBlank(parsed['then']), keys: parsed.keys };
12
+ }
13
+ }
14
+ catch {
15
+ // Fall through to no names: upstream English applies.
16
+ }
17
+ return { keys: {} };
18
+ }
19
+ /** Exact platform, then `other`; `undefined` when no usable name was given. */
20
+ export function localizedKeyName(names, key, format, platform) {
21
+ const entry = own(names.keys, key);
22
+ if (!isRecord(entry))
23
+ return undefined;
24
+ const platforms = own(entry, format);
25
+ if (!isRecord(platforms))
26
+ return undefined;
27
+ return nonBlank(own(platforms, platform)) ?? nonBlank(own(platforms, 'other'));
28
+ }
29
+ const upstreamNames = {
30
+ condensed: condensedKeyName,
31
+ full: fullKeyName,
32
+ accessible: accessibleKeyName,
33
+ };
34
+ const capitalize = (key) => key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();
35
+ /**
36
+ * Upstream's English name. The mirrored tables index plain object literals, so
37
+ * a key such as `constructor` would return an `Object.prototype` member;
38
+ * those keys get upstream's default spelling instead.
39
+ */
40
+ export function englishKeyName(key, format, platform) {
41
+ if (key in Object.prototype)
42
+ return format === 'accessible' ? key.toLowerCase() : capitalize(key);
43
+ return upstreamNames[format](key, platform);
44
+ }
45
+ export function keyName(names, key, format, platform) {
46
+ return localizedKeyName(names, key, format, platform) ?? englishKeyName(key, format, platform);
47
+ }
@@ -0,0 +1,21 @@
1
+ import type { Platform } from './platform';
2
+ import type { NameFormat } from './localized_names';
3
+ type PlatformNames = Partial<Record<Platform, string>>;
4
+ type EntryNames = Partial<Record<NameFormat, PlatformNames>>;
5
+ /** The `data-names` JSON shape; identical to Ruby's `KeybindingHint::Names.for`. */
6
+ export type KeyNamesData = {
7
+ then: string | undefined;
8
+ keys: Record<string, EntryNames>;
9
+ };
10
+ /**
11
+ * Keys as Ruby tokenises them: the server cannot know the platform, so `mod`
12
+ * contributes both `control` and `meta`. Whitespace matches Ruby's `\s`.
13
+ */
14
+ export declare const tokens: (keys: string) => string[];
15
+ /**
16
+ * Builds `data-names` for `keys` from the `keybinding_hint` locale scopes, as
17
+ * i18n-js returns them. Translator data is untrusted: only non-blank strings in
18
+ * the expected place are used, and symbols such as ⌘ cannot be replaced.
19
+ */
20
+ export declare function buildKeyNames(keys: string, localeScope: unknown, englishScope: unknown): KeyNamesData;
21
+ export {};