npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@artifact-kit/pptxgenjs-jsx

v0.1.6

Published

LLM-friendly JSX declaration layer for PptxGenJS.

Readme

@artifact-kit/pptxgenjs-jsx

Write editable PowerPoint decks as JSX. Recreate rendered HTML and SVG as native .pptx objects when a screenshot is not good enough.

This package wraps PptxGenJS with an LLM-friendly component model:

  • Describe a deck as a readable tree: <Deck><Slide><Text /></Slide></Deck>.
  • Use dedicated components for text, shapes, images, tables, charts, lines, and raw PptxGenJS escape hatches.
  • Validate the structure before writing a file.
  • In browser workflows, measure real DOM nodes and map them into PowerPoint coordinates.
  • Export editable PowerPoint objects instead of flattening a page into one bitmap.

What It Can Produce

The attention example is the clearest proof in this repo. It starts with a 1600x900 HTML/Tailwind/SVG lecture slide, measures the rendered DOM in the browser, then rebuilds the slide as editable PowerPoint text, shapes, lines, arrows, chart objects, and diagram parts.

Source HTML:

Source HTML slide

Generated PPTX preview:

Generated PPTX preview

Editable native PowerPoint objects:

Editable native PowerPoint objects

Open the exporter at examples/attention/exporter.html. It exercises DOM measurement, SVG primitive mapping, LineBetween, CustomGeometry, native chart output, validation, and browser download behavior.

Install

pnpm add @artifact-kit/pptxgenjs-jsx

Basic Usage

Use JSX when you already know the slide structure and coordinates:

/** @jsxImportSource @artifact-kit/pptxgenjs-jsx */
import { BarChart, Deck, RoundRect, Slide, Text, renderPptx, validateDeck } from "@artifact-kit/pptxgenjs-jsx";

const deck = (
  <Deck title="Q1 Review" layout={{ name: "WIDE", width: 13.333, height: 7.5 }}>
    <Slide background={{ color: "FFFFFF" }}>
      <RoundRect x={0.7} y={0.6} w={3.8} h={0.6} fill={{ color: "EEF2FF" }} />
      <Text x={0.9} y={0.78} w={3.4} h={0.3} fontSize={18} bold>Q1 Review</Text>
      <BarChart data={[{ name: "Revenue", labels: ["Jan", "Feb", "Mar"], values: [12, 18, 24] }]} x={6.5} y={1} w={5.5} h={3} />
    </Slide>
  </Deck>
);

const issues = validateDeck(deck);
if (issues.some((issue) => issue.level === "error")) throw new Error(JSON.stringify(issues, null, 2));
await renderPptx(deck, { fileName: "q1-review.pptx" });

If you do not want a JSX transform, use pptxElement(Component, props, ...children).

HTML to Editable PPTX

For local tools and agent-generated exporters, you can write JSX directly in the browser with the IIFE build plus Babel Standalone. This is useful when the source of truth is a rendered HTML page, dashboard, report, or slide-like document.

The workflow is:

  1. Keep the source HTML clean.
  2. Copy it into an exporter page.
  3. Make every slide/page visible in one vertical document.
  4. Add data-ak-slide, data-ak-width, data-ak-height, data-ak-px-per-in, and data-ak-measure markers.
  5. On export, call measureArtifacts({ document }).
  6. Use readSlideLayout(), readPptBox(), and readFontPt() to place native PowerPoint objects.
  7. Run validateDeck(), then renderPptx().

Minimal browser pattern:

<script src="https://unpkg.com/@artifact-kit/pptxgenjs-jsx/dist/pptxgenjs-jsx.browser.iife.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" data-presets="typescript,react">
  /** @jsx pptxElement */
  const {
    Deck,
    Slide,
    Text,
    measureArtifacts,
    pptxElement,
    readFontPt,
    readPptBox,
    readSlideLayout,
    renderPptx,
    validateDeck,
  } = window.ArtifactKitPptxGenJsx;

  document.querySelector("#export-pptx").addEventListener("click", async () => {
    await measureArtifacts({ document });

    const deck = (
      <Deck title="Measured deck" layout={readSlideLayout("slide-1")}>
        <Slide background={{ color: "FFFFFF" }}>
          <Text {...readPptBox("title-1")} fontSize={readFontPt("title-1")} bold margin={0}>
            {document.querySelector('[data-ak-measure="title-1"]').textContent.trim()}
          </Text>
        </Slide>
      </Deck>
    );

    const issues = validateDeck(deck);
    if (issues.some((issue) => issue.level === "error")) throw new Error(JSON.stringify(issues, null, 2));
    await renderPptx(deck, { fileName: "measured-export.pptx" });
  });
</script>

See examples/browser-jsx.html for a small browser example and examples/attention/exporter.html for the full measure-first HTML-to-PPTX example.

When To Use It

Use this package when you need:

  • Editable PowerPoint files generated from TypeScript, browser tools, or agent-authored code.
  • A declarative surface that is easier for LLMs to write and review than ordered imperative calls.
  • Native charts, tables, shapes, images, text runs, lines, and custom geometry.
  • HTML-to-PPTX reconstruction where layout comes from real browser measurement.
  • Machine-readable docs and a component manifest for coding agents.

Do not use it when a single screenshot image is the intended final artifact. This package is most valuable when the generated deck must remain editable.

Documentation Layout

This repo is organized for both humans and agents:

Build Outputs

| Output | File | | :-- | :-- | | Node ESM | dist/pptxgenjs-jsx.es.js | | Node CJS | dist/pptxgenjs-jsx.cjs | | Browser ESM | dist/pptxgenjs-jsx.browser.es.js | | Browser IIFE | dist/pptxgenjs-jsx.browser.iife.js global ArtifactKitPptxGenJsx |

Development

pnpm install
pnpm docs:generate
pnpm test
pnpm test:attention