import { create } from 'zustand' /** * 轻量 auto-save 状态 store * * 解耦 useAutoSave hook 与状态栏组件——状态栏的 auto-save 项通过 * 本 store 读取状态,无需在 render 函数中重复调用 useAutoSave()。 * useAutoSave hook 负责写入本 store。 */ interface AutoSaveState { isAutoSaving: boolean autoSaveEnabled: boolean } interface AutoSaveStore extends AutoSaveState { setState: (partial: Partial) => void } export const useAutoSaveStore = create((set) => ({ isAutoSaving: false, autoSaveEnabled: true, setState: (partial) => set(partial) }))