UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

33 lines (32 loc) 921 B
import { FeatureFlagScope } from "./FeatureFlagScope.js"; import { FeatureFlagContext } from "./FeatureFlagContext.js"; import { c } from "react-compiler-runtime"; import { jsx } from "react/jsx-runtime"; import { useContext } from "react"; //#region src/FeatureFlags/FeatureFlags.tsx function FeatureFlags(t0) { const $ = c(6); const { children, flags } = t0; const parentFeatureFlags = useContext(FeatureFlagContext); let t1; if ($[0] !== flags || $[1] !== parentFeatureFlags) { t1 = FeatureFlagScope.merge(parentFeatureFlags, FeatureFlagScope.create(flags)); $[0] = flags; $[1] = parentFeatureFlags; $[2] = t1; } else t1 = $[2]; const value = t1; let t2; if ($[3] !== children || $[4] !== value) { t2 = /*#__PURE__*/ jsx(FeatureFlagContext.Provider, { value, children }); $[3] = children; $[4] = value; $[5] = t2; } else t2 = $[5]; return t2; } //#endregion export { FeatureFlags };