feat(tui): port diff viewer to v2 plugins
This commit is contained in:
parent
b2741d2f97
commit
b67bed061a
7 changed files with 332 additions and 243 deletions
|
|
@ -4,6 +4,16 @@ import SidebarContext from "../feature-plugins/sidebar/context"
|
|||
import SidebarFooter from "../feature-plugins/sidebar/footer"
|
||||
import SidebarLsp from "../feature-plugins/sidebar/lsp"
|
||||
import SidebarMcp from "../feature-plugins/sidebar/mcp"
|
||||
import DiffViewer from "../feature-plugins/system/diff-viewer"
|
||||
import Scrap from "../feature-plugins/system/scrap"
|
||||
|
||||
export const builtins = [HomeFooter, HomeTips, SidebarContext, SidebarMcp, SidebarLsp, SidebarFooter, Scrap]
|
||||
export const builtins = [
|
||||
HomeFooter,
|
||||
HomeTips,
|
||||
SidebarContext,
|
||||
SidebarMcp,
|
||||
SidebarLsp,
|
||||
SidebarFooter,
|
||||
Scrap,
|
||||
DiffViewer,
|
||||
]
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { createStore, produce, reconcile as reconcileStore } from "solid-js/stor
|
|||
import { useConfig } from "../config"
|
||||
import { useClient } from "../context/client"
|
||||
import { useData } from "../context/data"
|
||||
import { Keymap } from "../context/keymap"
|
||||
import { useRoute } from "../context/route"
|
||||
import { useTuiLifecycle } from "../context/runtime"
|
||||
import { builtins } from "./builtins"
|
||||
|
|
@ -59,6 +60,8 @@ export function PluginProvider(props: ParentProps<{ packages: PackageResolver }>
|
|||
const data = useData()
|
||||
const route = useRoute()
|
||||
const config = useConfig()
|
||||
const keymap = Keymap.use()
|
||||
const shortcuts = Keymap.useShortcuts()
|
||||
const lifecycle = useTuiLifecycle()
|
||||
const directory = config.path ? path.dirname(config.path) : process.cwd()
|
||||
const [store, setStore] = createStore({
|
||||
|
|
@ -81,6 +84,12 @@ export function PluginProvider(props: ParentProps<{ packages: PackageResolver }>
|
|||
options: item.options ?? {},
|
||||
client: client.api,
|
||||
data,
|
||||
keymap: {
|
||||
layer: Keymap.createLayer,
|
||||
dispatch: keymap.dispatch,
|
||||
shortcut: shortcuts.get,
|
||||
mode: keymap.mode,
|
||||
},
|
||||
ui: {
|
||||
router: {
|
||||
register(page) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue