import { jsx } from "react/jsx-runtime";
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
import { unlock } from "../../lock-unlock";
const { useGlobalStyle } = unlock(blockEditorPrivateApis);
function TypographyPreview({ name, element, headingLevel }) {
  let prefix = "";
  if (element === "heading") {
    prefix = `elements.${headingLevel}.`;
  } else if (element && element !== "text") {
    prefix = `elements.${element}.`;
  }
  const [fontFamily] = useGlobalStyle(
    prefix + "typography.fontFamily",
    name
  );
  const [gradientValue] = useGlobalStyle(prefix + "color.gradient", name);
  const [backgroundColor] = useGlobalStyle(
    prefix + "color.background",
    name
  );
  const [fallbackBackgroundColor] = useGlobalStyle("color.background");
  const [color] = useGlobalStyle(prefix + "color.text", name);
  const [fontSize] = useGlobalStyle(prefix + "typography.fontSize", name);
  const [fontStyle] = useGlobalStyle(
    prefix + "typography.fontStyle",
    name
  );
  const [fontWeight] = useGlobalStyle(
    prefix + "typography.fontWeight",
    name
  );
  const [letterSpacing] = useGlobalStyle(
    prefix + "typography.letterSpacing",
    name
  );
  const extraStyles = element === "link" ? {
    textDecoration: "underline"
  } : {};
  return /* @__PURE__ */ jsx(
    "div",
    {
      className: "edit-site-typography-preview",
      style: {
        fontFamily: fontFamily ?? "serif",
        background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
        color,
        fontSize,
        fontStyle,
        fontWeight,
        letterSpacing,
        ...extraStyles
      },
      children: "Aa"
    }
  );
}
export {
  TypographyPreview as default
};
//# sourceMappingURL=typography-preview.js.map
