Boolean create UI (#5906)

* first steps, add to cmd bar etc

* cmdbar working well enough

* mvp

* lint

* fix after rebase

* intersect and union mvps

* add test

* some clean up

* further fix up

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

* pierre's comments

* tsc

* add comment

---------

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
This commit is contained in:
Kurt Hutten
2025-03-28 14:56:48 +11:00
committed by GitHub
parent 7ca3afff9f
commit d1f811f91d
11 changed files with 793 additions and 16 deletions

View File

@ -6,7 +6,7 @@ import {
getSelectionCountByType,
getSelectionTypeDisplayText,
} from 'lib/selections'
import { kclManager } from 'lib/singletons'
import { engineCommandManager, kclManager } from 'lib/singletons'
import { reportRejection } from 'lib/trap'
import { toSync } from 'lib/utils'
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
@ -112,6 +112,23 @@ function CommandBarSelectionInput({
onSubmit(selection)
}
// Clear selection if needed
useEffect(() => {
arg.clearSelectionFirst &&
engineCommandManager.modelingSend({
type: 'Set selection',
data: {
selectionType: 'singleCodeCursor',
},
})
}, [arg.clearSelectionFirst])
// Set selection filter if needed, and reset it when the component unmounts
useEffect(() => {
arg.selectionFilter && kclManager.setSelectionFilter(arg.selectionFilter)
return () => kclManager.defaultSelectionFilter(selection)
}, [arg.selectionFilter])
return (
<form id="arg-form" onSubmit={handleSubmit}>
<label