@pdf-viewer/react
Version:
The PDF Viewer component for React and Next.js
24 lines (23 loc) • 788 B
JavaScript
import { jsx as s } from "react/jsx-runtime";
import { createContext as a, useContext as u, useState as c, useMemo as m } from "react";
import { appConsole as p } from "../utils/appConsole.js";
import { useInitialStateContext as d } from "./InitialStateContext.js";
const r = a({
rotate: 0,
setRotate: () => {
}
}), R = () => {
const t = u(r);
return typeof (t == null ? void 0 : t.rotate) > "u" && p.error("Please use this hooks inside children component of RPProvider"), t;
}, P = ({ children: t }) => {
const { initialRotation: n = 0 } = d(), [o, e] = c(n), i = m(() => ({
rotate: o,
setRotate: e
}), [o, e]);
return /* @__PURE__ */ s(r.Provider, { value: i, children: t });
};
export {
r as RotateContext,
P as RotateProvider,
R as useRotationContext
};