checkpoint before gfm ast parser design

This commit is contained in:
lix-2026
2026-05-08 00:41:03 +08:00
parent e8ba12e461
commit c620b9e40c
41 changed files with 12270 additions and 263 deletions
@@ -1,7 +1,7 @@
use super::drag_drop_state::TreeShellDragEffect;
use super::filetree_runtime::{
FileTreeIntentEvent, FileTreeRuntimeAction, FileTreeRuntimeEnvironment, FileTreeRuntimeOutput,
FileTreeRuntimeState,
FileTreeIntentEvent, FileTreeKeyboardCommand, FileTreeRuntimeAction,
FileTreeRuntimeEnvironment, FileTreeRuntimeOutput, FileTreeRuntimeState,
};
use super::page_runtime::{
PageTreeCommandDispatchEvent, PageTreeDropFeedback, PageTreeDropPosition, PageTreeIntentEvent,
@@ -81,6 +81,7 @@ pub enum TreeShellDomPatch {
drop_feedback: Option<PageTreeDropFeedback>,
},
FileTreeState {
active_row_id: Option<String>,
selected_row_ids: BTreeSet<String>,
anchor_row_id: Option<String>,
focused_row_id: Option<String>,
@@ -125,6 +126,11 @@ pub enum TreeShellHostEvent {
target: Option<super::filetree_runtime::FileTreeOpenTarget>,
file_count: u32,
},
FileTreeKeyboardCommand {
command: FileTreeKeyboardCommand,
row_ids: Vec<String>,
target_row_id: Option<String>,
},
PickerPickRoot,
PickerPickDocument {
document_id: String,
@@ -279,6 +285,7 @@ pub fn reduce_tree_shell_runtime(request: TreeShellRuntimeRequest) -> TreeShellR
.iter()
.filter_map(|output| match output {
FileTreeRuntimeOutput::DomPatch => Some(TreeShellDomPatch::FileTreeState {
active_row_id: transition.state.active_row_id.clone(),
selected_row_ids: transition.state.selection.selected_row_ids.clone(),
anchor_row_id: transition.state.selection.anchor_row_id.clone(),
focused_row_id: transition.state.selection.focused_row_id.clone(),
@@ -325,6 +332,15 @@ pub fn reduce_tree_shell_runtime(request: TreeShellRuntimeRequest) -> TreeShellR
target: target.clone(),
file_count: *file_count,
}),
FileTreeRuntimeOutput::Intent(FileTreeIntentEvent::KeyboardCommand {
command,
row_ids,
target_row_id,
}) => Some(TreeShellHostEvent::FileTreeKeyboardCommand {
command: *command,
row_ids: row_ids.clone(),
target_row_id: target_row_id.clone(),
}),
_ => None,
})
.collect();
@@ -596,6 +612,7 @@ mod tests {
assert_eq!(
filetree.dom_patches,
vec![TreeShellDomPatch::FileTreeState {
active_row_id: None,
selected_row_ids: set(&["asset:image"]),
anchor_row_id: Some("asset:image".into()),
focused_row_id: Some("asset:image".into()),
@@ -638,6 +655,7 @@ mod tests {
assert_eq!(
drag_result.dom_patches,
vec![TreeShellDomPatch::FileTreeState {
active_row_id: None,
selected_row_ids: set(&["asset:image"]),
anchor_row_id: Some("asset:image".into()),
focused_row_id: Some("asset:image".into()),
@@ -675,6 +693,7 @@ mod tests {
assert_eq!(
drop_target_result.dom_patches,
vec![TreeShellDomPatch::FileTreeState {
active_row_id: None,
selected_row_ids: BTreeSet::new(),
anchor_row_id: None,
focused_row_id: None,
@@ -730,6 +749,7 @@ mod tests {
assert_eq!(
internal_drop.dom_patches,
vec![TreeShellDomPatch::FileTreeState {
active_row_id: None,
selected_row_ids: BTreeSet::new(),
anchor_row_id: None,
focused_row_id: None,