import React from "react";
import { Decoration_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
const decorator = (element, fontSizeDecoration, config) => {
  const { unit, value } = fontSizeDecoration.fontSizeData || {};
  const fontSize = config?.overrideInlineFontSize && value ? config.overrideInlineFontSize(value?.toString() ?? "", unit) : `${value}${unit ? unit.toLowerCase() : "px"}`;
  return /* @__PURE__ */ React.createElement(
    "span",
    {
      key: `fontsize-${element.key}`,
      style: {
        fontSize
      }
    },
    element
  );
};
const createFontSizeDecorator = (config) => ({
  rule: (node) => !!node.textData?.decorations?.some(({ type }) => type === Decoration_Type.FONT_SIZE),
  decorate: ({ element, node }) => {
    const fontSizeDecoration = node.textData?.decorations?.find(
      ({ type }) => type === Decoration_Type.FONT_SIZE
    );
    return decorator(element, fontSizeDecoration, config);
  }
});
export {
  createFontSizeDecorator
};
//# sourceMappingURL=viewer.js.map
