@gtmi/slides-deck
v0.1.0
Published
Framework-agnostic builder for Google Slides batchUpdate requests: units, palette, reusable slide layouts (title, section, feature+screenshot, detail cards, architecture, workflow). Emits chunked request batches you feed to any Slides client (e.g. gws CLI
Keywords
Readme
@gtmi/slides-deck
Framework-agnostic builder for Google Slides presentations.batchUpdate requests.
It knows nothing about how you talk to Google — you hand the emitted request chunks to any
Slides client (the gws CLI, googleapis, etc.). It gives you:
- Units —
inch(),pt(),hexToRgb(), page constants (EMU helpers). - Primitives —
rect,text,bullets,image,RequestSink,chunkRequests. - Layouts —
screenshotCard(faux browser frame),pill,footer,infoCardGrid. Deck— a high-level, chainable builder with ready-made slide templates:titleSlide,sectionSlide,featureSlide,detailSlide,workflowSlide,architectureSlide,closingSlide.
Why
The Slides API is verbose (every shape = create + style + text requests), uses EMU units,
and batchUpdate is all-or-nothing. This package encapsulates a consistent, professional
design system so decks come out clean instead of default-ugly, and keeps object IDs
deterministic and batches sized safely.
Usage
import { Deck } from '@gtmi/slides-deck';
// manifest maps a screenshot key -> a fetchable image URL (see note below)
const manifest: Record<string, string> = JSON.parse(readFileSync('manifest.json', 'utf8'));
const deck = new Deck({
brand: 'RAMP Architecture & Details · SE Enablement',
resolveImage: (key) => manifest[key],
});
deck
.titleSlide({
kicker: 'TWILIO GTM INNOVATION',
title: 'RAMP',
subtitle: '…',
keywords: ['Voice', 'SMS'],
})
.featureSlide({
eyebrow: 'LAUNCH',
title: 'Launch on Any Channel',
summary: '…',
points: ['…'],
img: '07-launch-demo',
note: 'SE tip',
})
.closingSlide({ kicker: 'START', title: 'Build your demo', points: ['…'] });
// feed each chunk to your Slides client:
for (const requests of deck.build()) {
await slides.presentations.batchUpdate({ presentationId, requestBody: { requests } });
}Images must be publicly fetchable at insert time
Slides fetches createImage.url server-side and needs anonymous access. In orgs that block
public Drive/GCS sharing, use short-lived GCS signed URLs — see the global pi skill
slides-image-upload (~/.pi/agent/skills/slides-image-upload) for the full workaround and
helper scripts.
Design system
16:9 page (10 × 5.625 in). Twilio-inspired palette (override via palette). Consistent
eyebrow pill + title + summary + bullets, dark footer with brand + page number, and
screenshot cards rendered inside a drawn browser frame (never bake chrome into the PNG).
Scripts
pnpm --filter @gtmi/slides-deck check-types
pnpm --filter @gtmi/slides-deck test
pnpm --filter @gtmi/slides-deck lint