@ -86,7 +86,11 @@ interface CommandOpts
columns : number ;
columns : number ;
disablePointerSelection : boolean ;
disablePointerSelection : boolean ;
dir : 'ltr' | 'rtl' ;
dir : 'ltr' | 'rtl' ;
} > { }
} > {
/ * * P r o v i d e r - l e v e l s e l e c t e v e n t — f i r e s f o r A N Y i t e m ( a f t e r i t s o w n
* onSelect ) . A host ( Command . Dialog ) hooks it to close on select . * /
onSelect? : Active < ( ( value : string ) = > void ) | undefined > ;
}
export class CommandProvider {
export class CommandProvider {
readonly opts : CommandOpts ;
readonly opts : CommandOpts ;
@ -380,6 +384,9 @@ export class CommandProvider {
const entry = this . findItem ( value ) ;
const entry = this . findItem ( value ) ;
if ( ! entry || entry . disabled || ! this . isVisible ( value ) ) return ;
if ( ! entry || entry . disabled || ! this . isVisible ( value ) ) return ;
this . onSelectHandlers . get ( value ) ? . ( value ) ;
this . onSelectHandlers . get ( value ) ? . ( value ) ;
// Provider-level select event — fires for ANY item, after its own onSelect.
// A host (Command.Dialog) hooks it to close on select.
this . opts . onSelect ? . current ? . ( value ) ;
// Morfo: commit-submit-invoke on `item`. Look up the item element
// Morfo: commit-submit-invoke on `item`. Look up the item element
// by data-value so the cascade matches this specific item (Enter
// by data-value so the cascade matches this specific item (Enter
// key path — onclick handler emits independently for mouse path).
// key path — onclick handler emits independently for mouse path).
@ -708,6 +715,9 @@ export class CommandItemProvider {
if ( this . opts . disabled . current ) return ;
if ( this . opts . disabled . current ) return ;
this . provider . setValue ( this . opts . value . current ) ;
this . provider . setValue ( this . opts . value . current ) ;
this . opts . onSelect . current ? . ( this . opts . value . current ) ;
this . opts . onSelect . current ? . ( this . opts . value . current ) ;
// Provider-level select event (mouse path) — mirrors selectCurrent's fire
// on the keyboard path, so a host (Command.Dialog) closes on click too.
this . provider . opts . onSelect ? . current ? . ( this . opts . value . current ) ;
// Morfo: commit-submit-invoke on `item` (affirm). Fire with the
// Morfo: commit-submit-invoke on `item` (affirm). Fire with the
// clicked element so the cascade matches this specific item.
// clicked element so the cascade matches this specific item.
void this . provider . runtime . trigger ( 'commit-submit-invoke' , {
void this . provider . runtime . trigger ( 'commit-submit-invoke' , {
@ -834,6 +844,9 @@ export class CommandLinkItemProvider {
return ;
return ;
}
}
this . opts . onSelect . current ? . ( this . opts . value . current ) ;
this . opts . onSelect . current ? . ( this . opts . value . current ) ;
// Provider-level select event (mouse path) — so a host (Command.Dialog)
// closes on a link-item click too.
this . provider . opts . onSelect ? . current ? . ( this . opts . value . current ) ;
} ;
} ;
readonly onpointermove = ( ) = > {
readonly onpointermove = ( ) = > {