feat(tui): add persistent storage context
This commit is contained in:
parent
813c41ff6c
commit
9ee337469d
7 changed files with 280 additions and 223 deletions
|
|
@ -32,6 +32,7 @@ import { DialogSelect } from "../ui/dialog-select"
|
|||
import { useDialog } from "../ui/dialog"
|
||||
import { useToast } from "../ui/toast"
|
||||
import { useAttention } from "../context/attention"
|
||||
import { useStorage } from "../context/storage"
|
||||
import { abbreviateHome } from "../util/path-format"
|
||||
import { builtins } from "./builtins"
|
||||
import { discoverTuiPlugins } from "./discovery"
|
||||
|
|
@ -96,6 +97,7 @@ export function PluginProvider(props: ParentProps<{ packages: PackageResolver }>
|
|||
const dialog = useDialog()
|
||||
const toast = useToast()
|
||||
const attention = useAttention()
|
||||
const storage = useStorage()
|
||||
const directory = config.path ? path.dirname(config.path) : process.cwd()
|
||||
const [store, setStore] = createStore({
|
||||
ready: false,
|
||||
|
|
@ -234,6 +236,9 @@ export function PluginProvider(props: ParentProps<{ packages: PackageResolver }>
|
|||
active: keymapState.active,
|
||||
mode: keymap.mode,
|
||||
},
|
||||
storage: {
|
||||
store: (key, options) => storage.store(`plugin.${item.plugin.id}.${key}`, options),
|
||||
},
|
||||
ui: {
|
||||
dialog: dialogApi,
|
||||
toast: toastApi,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue