"Panel references" means we using a unique identifier to track which panel we've selected, whether that be the page name, an element reference, or a panel reference.
"Numeric indices" means we use an integer index.
"Panel owns focused block" means the panel objects have internal state tracking which block is selected.
"Seperate map" means a seperate map associates panel ids with the focused block.
Syntax for use cases:
[pages open before] => [pages open after]
*
means the page is focused
[Main*, PageA]
=> [Main*, PageB, PageA]
{
focusedPanel: main,
panels: [
{ id: main, focusedBlock: 777 },
++ { id: pageB, focusedBlock: null },
{ id: pageA, focusedBlock: 888 },
]
}
Inserting specific panel:
{
focusedPanel: 0,
panels: [
{ id: main, focusedBlock: 777 },
++ { id: pageB, focusedBlock: null },
{ id: pageA, focusedBlock: 888 },
]
}
"Rehydrating":
{
focusedPanel: 0,
-- panels: [
-- { id: main, focusedBlock: 777 },
-- { id: pageA, focusedBlock: 888 },
-- ]
++ panels: [
++ { id: main, focusedBlock: 777 },
++ { id: pageB, focusedBlock: null },
++ { id: pageA, focusedBlock: 888 },
++ ]
}
{
focusedPanel: 0,
- panels: [main, pageA],
+ panels: [main, pageB, pageA],
panelToBlock: { main: 777, pageA: 888 },
}
[Main, PageA*, PageB]
=> [Main, PageB*]
{
-- focusedPanel: pageA,
++ focusedPanel: whateverSlidIntoTheHolePageALeft,
panels: [
{ id: main, focusedBlock: 777 },
-- { id: pageA, focusedBlock: 888 },
{ id: pageB, focusedBlock: 999 },
]
}
{
focusedPanel: 1,
- panels: [main, pageA, pageB],
+ panels: [main, pageB],
panelToBlock: { main: 777, pageA: 888 },
}
[Main*, PageA, PageB]
=> [Main*, PageB, PageA]
{
focusedPanel: main,
panels: [
{ id: main, focusedBlock: 777 },
-- { id: pageA, focusedBlock: 888 },
++ { id: pageB, focusedBlock: 999 },
-- { id: pageB, focusedBlock: 999 },
++ { id: pageA, focusedBlock: 888 },
]
}
{
focusedPanel: 0,
- panels: [main, pageA, pageB],
+ panels: [main, pageB, pageA],
panelToBlock: { main: 777, pageA: 888 },
}
When observing side panel mutations, it's easy to get the entire DOM of the side panel. It seems more tricky to get the specific pages that appear/disappear.
If we can assume there will only ever be main/side panels, then I guess the Seperate map doesn't offer anything. https://github.com/tntmarket/roam-toolkit/pull/5/files seems easier with a Seperate map, and I plan to work on it after the core Vim stuff + hints.
Assumptions
On update: