Files
video-gen/video-gen-admin/node_modules/@rc-component/menu/es/context/PathContext.js
T
2026-05-25 17:08:18 +08:00

20 lines
803 B
JavaScript

import * as React from 'react';
const EmptyList = [];
// ========================= Path Register =========================
export const PathRegisterContext = /*#__PURE__*/React.createContext(null);
export function useMeasure() {
return React.useContext(PathRegisterContext);
}
// ========================= Path Tracker ==========================
export const PathTrackerContext = /*#__PURE__*/React.createContext(EmptyList);
export function useFullPath(eventKey) {
const parentKeyPath = React.useContext(PathTrackerContext);
return React.useMemo(() => eventKey !== undefined ? [...parentKeyPath, eventKey] : parentKeyPath, [parentKeyPath, eventKey]);
}
// =========================== Path User ===========================
export const PathUserContext = /*#__PURE__*/React.createContext(null);