@primer/react
Version:
An implementation of GitHub's Primer Design System using React
43 lines (40 loc) • 991 B
JavaScript
import { c } from 'react-compiler-runtime';
import { useContext } from 'react';
import { FeatureFlagContext } from './FeatureFlagContext.js';
import { FeatureFlagScope } from './FeatureFlagScope.js';
import { jsx } from 'react/jsx-runtime';
function FeatureFlags(t0) {
const $ = c(6);
const {
children,
flags
} = t0;
const parentFeatureFlags = useContext(FeatureFlagContext);
let t1;
let t2;
if ($[0] !== flags || $[1] !== parentFeatureFlags) {
t2 = FeatureFlagScope.merge(parentFeatureFlags, FeatureFlagScope.create(flags));
$[0] = flags;
$[1] = parentFeatureFlags;
$[2] = t2;
} else {
t2 = $[2];
}
const scope = t2;
t1 = scope;
const value = t1;
let t3;
if ($[3] !== children || $[4] !== value) {
t3 = /*#__PURE__*/jsx(FeatureFlagContext.Provider, {
value: value,
children: children
});
$[3] = children;
$[4] = value;
$[5] = t3;
} else {
t3 = $[5];
}
return t3;
}
export { FeatureFlags };