← 前端阅读目录

chunks/CPX-EBFK.mjs

伪代码
源文件超过50行,已替换为不超过50行的伪代码。辅助函数为逻辑抽象,不直接执行。
1function createSidebarState(config, viewport, cookies) {2  const defaults = getSidebarDefaults(config, viewport);3  const state = { ...defaults, ...cookies.read("sidebars") };45  function setRightPanel(panel) {6    // 功能未开放时,聊天入口降级为隐藏。7    state.right = panel === "chat" && !config.chatEnabled8      ? "hidden"9      : panel;1011    if (viewport.isNarrow && state.right !== "hidden") {12      state.left = "minimized";13    }14    cookies.write("sidebars", state);15  }1617  function expandLeftPanel() {18    state.left = "expanded";19    if (viewport.isNarrow) state.right = "hidden";20    cookies.write("sidebars", state);21  }2223  return { state, setRightPanel, expandLeftPanel };24}
已确认说明