import { getMiddleCenterBias, GridCellKind } from "@glideapps/glide-data-grid";
import { drawTextWithEllipsis } from "../utils.js";
const TEXT_CELL = "text-cell";
const renderer = {
  draw: (args, cell) => {
    const { ctx, rect, theme } = args;
    const xPad = theme.cellHorizontalPadding;
    const font = `${theme.baseFontStyle} ${theme.fontFamily}`;
    const middleCenterBias = getMiddleCenterBias(ctx, font);
    const x = rect.x + xPad;
    const y = rect.y + rect.height / 2 + middleCenterBias;
    const maxWidth = rect.width - 2 * theme.cellHorizontalPadding;
    ctx.fillStyle = theme.textHeader;
    drawTextWithEllipsis(ctx, cell.copyData, x, y, maxWidth);
    return true;
  },
  isMatch: (c) => c.data.kind === TEXT_CELL,
  kind: GridCellKind.Custom,
  needsHover: true,
  provideEditor: () => void 0
};
export {
  TEXT_CELL,
  renderer as default
};
