UNPKG

@wordpress/widget-dashboard

Version:

Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.

25 lines (24 loc) • 763 B
import { createContext, useContext } from "@wordpress/element"; import { jsx } from "react/jsx-runtime"; // packages/widget-dashboard/src/context/widget-context.tsx const WidgetContext = createContext(null); /** * Provides the current widget's identity to its render subtree. * * @param {ProviderProps} props Component props. */ function WidgetContextProvider({ value, children }) { return /* @__PURE__ */ jsx(WidgetContext.Provider, { value, children }); } /** * Returns the current widget's identity (`uuid`, `name`, `index`). Returns * `null` when called outside a widget render subtree. */ function useWidgetContext() { return useContext(WidgetContext); } export { WidgetContextProvider, useWidgetContext }; //# sourceMappingURL=widget-context.mjs.map