Files
Edu/packages/hooks/src/index.ts
SpecialX 1eacd1ed87 feat(teacher-portal): 完整实现 teacher-portal 微前端
包含 settings/students/api、graphql、mocks、ui-tokens 设计令牌等
2026-07-10 19:10:20 +08:00

69 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @edu/hooks - 共享 Hooks 库
*
* 维护者ai13teacher-portal
* 关联文档teacher-portal 02-architecture-design.md §8
*
* 包含:
* - useAuth会话状态user/token/login/logout/refresh
* - usePermission权限查询hasPermission/hasAny/hasAll + dataScope
* - useViewports视口列表按 scope 过滤)
* - useApiApiClient 实例(注入 token + 401 处理 + trace_id
* - useA11yId唯一 ARIA ID 生成
* - useAriaLivearia-live 区域管理
* - useToast全局 toast 通知
* - useTraceId当前会话 trace_id
*
* 设计原则:
* - hooks 不直接调 API保持纯客户端逻辑API 调用由 apps/* 注入)
* - 权限/视口数据通过 props 注入,避免 hooks 包耦合 iam
* - token 存储使用 localStorageF12 裁决P2 阶段)
*/
export { useAuth } from "./use-auth.js";
export type { UseAuthReturn } from "./use-auth.js";
export { usePermission } from "./use-permission.js";
export type {
UsePermissionProps,
UsePermissionReturn,
} from "./use-permission.js";
export { useViewports } from "./use-viewports.js";
export type { UseViewportsProps, UseViewportsReturn } from "./use-viewports.js";
export { useApi } from "./use-api.js";
export type { UseApiProps, UseApiReturn } from "./use-api.js";
export {
useA11yId,
useA11yIds,
mergeA11yProps,
describeInput,
} from "./use-a11y-id.js";
export { useAriaLive } from "./use-aria-live.js";
export type { UseAriaLiveReturn, AriaLivePoliteness } from "./use-aria-live.js";
export { useToast } from "./use-toast.js";
export type { UseToastReturn } from "./use-toast.js";
export { useTraceId } from "./use-trace-id.js";
export type { UseTraceIdReturn } from "./use-trace-id.js";
export {
useGraphQLClient,
GraphQLClientContext,
} from "./use-graphql-client.js";
export type { UseGraphQLClientReturn } from "./use-graphql-client.js";
// 共享类型
export type {
UserSession,
DataScope,
PermissionContext,
Viewport,
ToastMessage,
AuthState,
} from "./types.js";