@nextgensoftwares/folio-slides
A PresentationML-shaped deck model and its projection onto Folio layered pages. DOM-free (Node, workers, browsers). Depends on @nextgensoftwares/folio-model, @nextgensoftwares/folio-layout and @nextgensoftwares/folio-plugin-layers/core. Guide: Slides & PPTX. Design: docs/guides/slides-design.md.
| Entry | What |
|---|---|
@nextgensoftwares/folio-slides | model, resolution, projection, write-back, layout, deck edits |
@nextgensoftwares/folio-slides/pdf | exportSlidesPdf(pres, SlidesPdfOptions) (peer @nextgensoftwares/folio-export-pdf) |
Model (types)
Plain JSON. Geometry in px (1 px = 9525 EMU), font sizes in pt, angles in degrees.
| Type | What |
|---|---|
Presentation | { size, themes, masters, layouts, slides, defaultTextStyle?, tableStyles?, showMediaControls?, sections?, notesPage? } |
SlideSection | a section (p14:section): { id (GUID), name, slides (slide ids) }; sections: [] removes the file's |
NotesPage, PageBox | the notes page: { size, slide, body, meta? } (px), from p:notesSz and the notes master's slide image, body, header, date, footer and page number placeholders (meta; absent: DEFAULT_NOTES_META, PowerPoint's corners) |
NotesHeaderFooter, NotesMetaKind, NOTES_META, notesShows(hf, kind) | Presentation.notesHeaderFooter: what notes pages show (Header and Footer › Notes and Handouts): { date?: { format, lang? } | { text }, header?, footer?, pageNumber? } |
SlideTheme, ColorScheme, SchemeSlot, ThemeFonts | theme colours, major/minor fonts, fills / lines / bgFills (format scheme), objectDefaults?: { shape?, text? } (a:objectDefaults body props: the base of a non-placeholder shape's or text box's bodyProps chain) |
SheetBase, SlideMaster, SlideLayout, Slide | sheets: id (part path), shapes, background, colorMap; masters add theme, colorMap, textStyles; layouts master, type, showMasterShapes; slides layout, hidden, showMasterShapes, transition, animated, notes, comments (SlideComment: a thread, { id, author, authorId?, initials?, text, date?, reactions?, x, y, replies?, resolved? }; replies are SlideCommentReply: the same message fields without the pin) |
ColorMap, Background, Transition | colour map (bg1 → lt1...), { fill } or { ref: { idx, color } }, transition type/duration/advance |
Shape, ShapeBase, SpShape, PicShape, GroupShape, TableShape, TableCell, GraphicShape | shapes; xfrm absent = inherited from the placeholder; ph = PlaceholderRef; SpShape.textRect (SmartArt text rectangles); GraphicShape.drawing (SmartArt's saved drawing: { part, shapes }, projected as a locked group); GraphicShape.math (a MathType object's LaTeX, drawn as math filling the frame); PicShape.fit ('stretch' default | 'cover' | 'contain': the (cropped) picture covers its frame, cropped evenly, or is letterboxed in it, from the image's own size when drawn, on screen, in thumbnails and in PDF; fittedCrop(crop, fit, natural, w, h) is the crop that shows it); PicShape.shadow and TableShape.shadow (SlideShadow, as on SpShape): a picture's shadow falls from its outline (geometry and frame, also with fit: 'contain'; not from transparent pixels, as in PowerPoint), rotating and flipping with it; a table's from its frame rectangle (PowerPoint casts it from the cells' outlines) |
ConnectionRef | { id, idx }: a connector end glued to a shape's connection site (SpShape.cxn: { st?, end? }, PowerPoint's a:stCxn / a:endCxn; SpShape.connector marks a p:cxnSp) |
Xfrm, PlaceholderRef, PlaceholderType, SlideGeometry, SourceRef | frame, placeholder, preset/custom geometry, import fingerprint (fp, order) |
ColorRef, ColorMod, SlideFill, GradientStop, Crop, SlideLine, LineEnd, StyleRef, ShapeStyle, SlideShadow | DrawingML styling, unresolved |
SlideGlow, SlideReflection, RectAlign, REFLECTION_DEFAULTS | Format Shape ▸ Effects on ShapeBase (shapes and pictures): glow? (a:glow: { color, rad }, px), reflection? (a:reflection: blur, stA/stPos/endA/endPos (0..1), dist (px), dir/fadeDir (degrees), sx/sy, kx/ky (skew, degrees), algn, rotWithShape; every field filled in, REFLECTION_DEFAULTS being the schema's), alongside softEdge? (a:softEdge radius, px) |
TextBody, BodyProps, Autofit, ListStyle, Paragraph, ParaProps, RunProps, TextRun, Bullet, Spacing, SlideTab | text bodies (ParaProps.tabs: tab stops, px from the text area's start edge, defTab: the default tab size, PowerPoint's 1in when unset); TextRun { kind: 'math', latex, display? } is an equation (projected as mathInline at text size, display ones in display style); runText(run): a run as anchors count it (an equation is one object character) |
TableStyle, TableStylePart | tableStyles.xml styles by id |
localDateTime(ms?) | a local YYYY-MM-DDTHH:mm:ss (no zone), as PowerPoint writes comment times |
DATE_FORMATS, DateFormat, formatDateField(type, date?, lang?), isDateField(type) | PowerPoint's date and time fields (datetime1…datetime13): en-US as PowerPoint shows them, other languages through Intl.DateTimeFormat. Layout draws date fields with today's date (they update automatically), slidenum with the slide number |
BUILTIN_TABLE_STYLES | PowerPoint's common built-in table styles by GUID (Medium Style 2 and accents, Light Style 1/2, no style, table grid): layout uses them when a deck names a style it doesn't define |
Units and fingerprints
EMU_PER_PX, PX_PER_PT, emuToPx, pxToEmu, ptToPx; MEDIA_SCHEME (media:), mediaSrc(path), mediaPath(src); fingerprint(value) (stable, src excluded), sheetFingerprint(sheet) (without shapes, notes and comments), orderFingerprint(shapes) (ids in z order).
Theme and colour
resolveColor(ref, env: ColorEnv)→#rrggbb[aa]through the scheme, the colour map andphClr;applyMods(rgb, mods);schemeSlot(name, map).OFFICE_COLORS,DEFAULT_COLOR_MAP.themeFace(name, theme)(+mj-lt→ the major latin face),familyStack(faces)(adds Carlito, Liberation... fallbacks),primaryFamily(stack).
Resolution
chainOf(pres, sheet): SheetChain({ pres, slide?, layout?, master?, theme?, colors }),layoutOf,masterOf,isSlide,isLayout.matchLayout(shapes, ph)(idx first, then type, title family),matchMaster(shapes, ph)(by type, body-like to body),inherited(shape, chain),styleFamily(ph),META_TYPES.textStyleChain(shape, chain)(default text style → master style → master ph → layout ph → own),paraProps(chain, level, own),levelOf,mergePara,mergeRun,bodyProps(shape, chain).
Effective formatting
effectiveRuns(pres, sheet, shape) → EffectiveRun[] ({ run, para, size, font?, color? }): every run of a shape's text (tables and groups included, empty paragraphs' end marks too) with what it inherits resolved: presentation defaults, master styles, the placeholder chain, the shape style's fontRef and its own list style; theme fonts (+mj-lt) to faces, colours (scheme, colour map) to RRGGBB. Toolbars read the selection's format from it.
Projection
slideDocument(pres, index, SlideDocumentOptions?) → FolioDocument: the slide as a one-page layered document (background + master/layout shapes as section masters, slide shapes as page objects).emptyPlaceholders: 'hide' | 'show'(with 'show', empty placeholders prompt like PowerPoint: their layout's own text when it hashasCustomPrompt(PlaceholderRef.customPrompt), elseprompts?(type)orDEFAULT_PROMPTS("Click to add title"...), as layersTextBody.prompt, never written back),prompts?,standIns?(lower-case families drawn with a stand-in or missing: boxes using them shrink to fit,keepWords, unlessspAutoFit;spAutoFitboxes grow).SLIDE_ATTR,BACKGROUND_ID,isHidden(slide).slideTheme(pres) → Theme: slide-sized page, no margins,leading: 'above'.shapeObject(shape, chain, env, ProjectOptions, Origin),objectId(origin, id),textProjectionFor,styleOf,tableObject.toLayersGeometry(geom, w, h),presetSupport(name)('exact' | 'approx' | 'none'),presetTextRect(geom, w, h)→TextRect.- Preset library: rect, roundRect, ellipse and line draw inline (exactly). Every other ECMA-376 preset maps to
{ preset: <stand-in>, dml: name, av }: the inline outline (core presets) or a close one stands in until folio-plugin-layers' lazily loaded library lands, and then the standard definition draws it (text rectangles too).isLibraryPreset(name)(every preset but those four),usesPresetLibrary(pres),ensurePresetShapes(pres)(loads it, and the WordArt text warps, when the deck needs them; resolves true when it loaded either).usesTextWarps(pres)(the deck has WordArt),geometryLibraries()(0–3: bit 1 the preset shapes, bit 2 the text warps have loaded; layouts key on it).layoutSlidememoizes per library state andexportSlidesPdfawaits the library, so pages refresh once it lands; folio-plugin-slides loads it for decks that use it. toFill,shapeFill,shapeStroke,toShadow,backgroundFill,PaintEnv;toGlow(glow, env)(colour resolved against the theme) andtoReflection(reflection)(rotWithShape: false→fixed) give the layersGlow/Reflectionof a shape or picture.- Text:
textBlocks(body, TextProjection),textBox,resolvePara,listOf→ListInfo,bulletGlyph,runMarks,runFamily,runColor,runSize,DEFAULT_SIZE,TextEnv,SLIDE_PARA,SLIDE_RUN. - Code text:
TextBody.code(CodeText:{ language, theme? }) makes a text body source code. It lays out and paints in Consolas (stackConsolas, "Liberation Mono") with syntax colours from folio-plugin-code's grammars (languageis an id or alias:python,js,ts...; plain or unknown ids stay monospace in the text colour).theme:light/dark, orgithub,one,solarized,monochromewith-light/-dark(unknown: GitHub light); every run takes the theme's colours, the shape's fill is the author's. The runs keep plain text:bakeCodeText(body)gives the coloured runs (layout and PPTX export use it), and an edit writes back the text without the code face or colours. The colouring is a lazy chunk and each grammar loads on first use: until then a code body draws plain monospace.usesCodeText(pres),loadCodeText(),onCodeTextLoaded(fn),codeTextReady(pres),ensureCodeText(pres)(the chunk and every grammar the deck uses;ensurePresetShapesincludes it),codeTextVersion()(counts the loads;geometryLibraries()adds 32 × it, so layouts refresh).CODE_FONT. deckFonts(pres): family → runs using it, inheritance resolved (font policies, "Fonts in this document").slidesSchema: the schema additions (slideParaattr,slideRunmark) a slide editor needs.
Write-back
applySlideDocument(pres, index, doc, opts?) → Presentation: edits on a slide document back into the deck (same object when nothing changed; untouched shapes kept by identity).pageObjectsOf(doc),updateShape,newShape,fromFill,fromStroke,blocksToParagraphs(blocks, t, lstStyle, code?)(code: a code body, whose drawn face and colours aren't written back),ApplyEnv.
Layout
layoutSlide(pres, index, SlideLayoutOptions) → PageLayout(memoized per slide),layoutDeck(pres, { ...opts, slides? }) → DocumentLayout,SLIDE_RENDERERS.layoutHandouts(pres, { ...opts, perPage, order?, slides? }): PowerPoint's handouts on the notes page size, with the handout master's background and own shapes behind the slides and its header, date, footer and page number in its placeholders' own styling (Presentation.handoutPage, else the notes pages' settings);handoutCells(page, slide, opts)is the arrangement.loadHandoutView()→HandoutViewModule(handoutMasterView(pres),writeHandoutMasterView(pres, slide)),handoutView()(null until loaded): Handout Master view's one-slide deck and its write-back ontoPresentation.handoutPage(a lazy chunk).handoutMetaForFile(page, hf, kind): a handout master placeholder with the settings' text.notesOrientation(pres),setNotesOrientation(pres, 'portrait' | 'landscape'): the notes and handout page turned, its boxes stretched.HandoutPage.perPage/order: Slides Per Page in Handout Master view.layoutNotesPage(pres, index, opts) → PageLayoutandlayoutNotesPages(pres, { ...opts, slides? }): PowerPoint's notes pages (the slide image, outlined, where the notes master puts it, above the speaker notes at 12 pt, on the notes page size, with the Notes and Handouts header, date, footer and page number).- Automatic dates:
layoutSlide's memo includesdateFieldKey(pres, slide)('' without date fields, else today's date, or the minute when a field shows the time), so a slide with date fields is laid out again when the date changes and every other slide keeps its layout;nextDateTick(pres, now?)→ ms to that change (null without date fields) for views to re-render (folio-plugin-slides does). bakeAutofit(pres, SlideLayoutOptions) → Presentation: the deck with the live shrink of text edited innormAutofitboxes written as theirfontScale(whatexportPptx({ measurer })does);fittedScales(page): shrink scales below 1 by drawing object id.- Vertical text:
bodyPr vertvertdraws turned 90°,vert270270° (layers'TextBody.turn), plus the body's ownrot(any angle, about the box centre).eaVertturns 90° with East Asian full-width characters (CJK ideographs, kana, hangul, full-width forms and punctuation) standing upright in one-em cells and Latin runs turned along the column; stacked text (wordArtVert, columns left to right, andwordArtVertRtl) stands every letter;mongolianVertruns its columns left to right (layers'TextBody.vertical). The upright layout is a lazy chunk:usesVerticalText(pres), andensurePresetShapes(pres)/geometryLibraries()(bit 4) load and key on it like the preset shapes; an unknownvertlays out horizontally (text-verticalwarning). SlideLayoutOptions:measurer,mediaSize?,math?(MathMeasurersizing equations; without it they're laid out from an estimate),emptyPlaceholders?,standIns?,revision?(layout is memoized per value).
Deck edits
blankPresentation({ lang? }) creates a 16:9 deck with the Office theme and PowerPoint's eleven default layouts (slideLayout1 to slideLayout11; Blank is 7). Their names are English or Arabic (lang: 'ar').
defaultLayouts(master, lang?)returns those layouts.LAYOUT_NAMES({ en, ar }) lists their names in order.LayoutLangis the language type.
The master and every layout carry PowerPoint's date, footer and slide number placeholders (empty until Header & Footer fills them on slides).
Other deck edits: addSlide(pres, layoutId, at?), removeSlide, moveSlide, duplicateSlide.
Slides from another presentation (PowerPoint's Reuse Slides): reuseSlides(dest, source, { slides?, formatting?, at? }) → { presentation, first, count, added: { themes, masters, layouts } }. slides are source indices in the order wanted (default all); at is where they go (default the end). Each slide becomes a new part, and whatever pointed into the source file (src) is dropped. Charts and SmartArt keep their data and are written as new parts; other graphic frames (OLE) become their preview picture. A source of another size is fitted and centred, and text keeps its point size. Table styles the slides use and the deck lacks come along.
formatting: 'destination'(the default, "Use this deck's theme"): each slide moves to the deck's closest layout, chosen by type, then name, then how well the placeholders match (title, body-like and picture families). Each placeholder takes the next placeholder of its family on that layout. One with no match there keeps where it was: its box is baked in from its old layout.formatting: 'source'("Keep source formatting"): the masters and layouts the slides use come along with their themes.- A master is reused when the deck has an identical one, with identical copies of every layout needed. A theme is reused when an identical one exists.
- New ones get free part paths, and names that clash get PowerPoint's
1_,2_… prefix. - folio-pptx writes the new masters, layouts and themes into the deck's file on export.
Pictures keep their media: references, which point into the source file: map them to the host's first. mediaRefs(x) lists them as { src, kind: 'image' | 'media' } (audio and video are media), and withMedia(x, map) replaces them. closestLayout(dest, layout) is the layout match on its own.
- Header and footer (Insert › Header & Footer, Slide tab):
setHeaderFooter(pres, indices, HeaderFooter)gives slidesdt/ftr/sldNumplaceholders (a date field or fixed text, the footer, aslidenumfield), positioned by their layout (or the master); parts left out are removed,notOnTitleleaves title-layout slides without any.headerFooterOf(pres, index)reads a slide's back ({ date?: { format, lang? } | { text }, slideNumber?, footer?, notOnTitle? }). - Sections:
sectionRanges(pres)→SectionRange[](each section'sfirstslide andcount: a slide no section lists joins the one before it),sectionOfSlide,normalizeSections,addSection(pres, at, name, id?)(a deck without sections gets a "Default Section" before it),renameSection,removeSection(pres, id, { slides? })(slides join the previous section, or go),moveSection(pres, id, ±1)(with its slides),moveSlidesToSection(pres, indices, to, id),sectionId(). - Notes page:
notesPageOf(pres)(the deck's, elseDEFAULT_NOTES_PAGE),notesSlideBox(page, slideSize).
Media playback
mediaPlayback(slide, shapeId) → MediaPlayback reads PowerPoint's Playback settings for a slide's audio or video from the slide's timing, where PowerPoint keeps them:
autoPlay: a media-call effect that plays it after the previous one;loop: its media node'srepeatCount="indefinite";hideWhenStopped:showWhenStopped="0".
setMediaPlayback(slide, shapeId, kind, patch) writes them the same way and keeps other effects.
Presentation.showMediaControls (default true) is PowerPoint's Show Media Controls, read from and written to presProps (p14:showMediaCtrls).
Presentation.guides (SlideGuide[]: { orient: 'h' | 'v', pos, color? }, slide px from the top or left edge, colour as sRGB hex) are the drawing guides (View › Guides): editing aids the slides editor snaps shapes to, never laid out, shown in the show or printed. PPTX keeps them in presentation.xml's p15:sldGuideLst extension and viewProps.xml's p:guideLst.
Connectors
Glued connectors follow their shapes. DeckEditor.update runs rerouteConnectors(next, prev) on every change, so moving, resizing or rotating a shape (by a command, a drag, undo or a collaborator) re-routes the connectors glued to it.
| Export | What |
|---|---|
rerouteConnectors(pres, prev?), rerouteSlide(pres, slide, prev?) | re-route the changed slides' top-level glued connectors (same object when nothing moves). A connector moved or resized itself since prev keeps the ends it took off their sites, unglued; its own geometry edits (the elbow's adjust handle) are kept; glue to a deleted shape or missing site is dropped |
routeConnector(geom, a, b) → { xfrm, geom } | the box and preset for a connector from a to b (ConnectorEnd: { x, y, ang? }, ang = the site's way out in degrees). Straight ones span the points; elbows (bentConnector2/3) and curves (curvedConnector2/3) take two segments when the ends leave along different axes and three otherwise, turned 90° when they start vertically, flipped to run from a, adj1 halfway or a 24 px stub outside a shape the route would double back into |
connectorEnds(xfrm), connectorKind(preset) | a connector's two ends on the slide (path from the flipped, rotated box's top-left to bottom-right corner); 'straight' | 'bent' | 'curved' |
connectionSitesOf(pres, slide) | every shape's connection sites on the slide by shape id (through groups, rotation and flips; pictures, tables and groups as rectangles) |
Text anchors
Durable references to text in text boxes (highlights, annotations), DOM-free (a server can re-anchor too):
| Export | Description |
|---|---|
slideTextAnchor(slide, shapeId, start, end) → SlideTextAnchor | { slideId, shapeId, start, end, quote, prefix, suffix }; points are SlideTextPoint { para, offset } (UTF-16 in the paragraph) |
reanchorSlideText(anchor, slide) → SlideReanchored | null | where it is now: in place when its text is still there (exact), else its quote in the same shape (best context), else in another text box of the slide; null when gone |
shapeTextOf(slide, shapeId) | a shape's text as one string (paragraphs joined by \n) and where each paragraph starts |
Animations (timing model)
Slide.timing?: SlideTiming holds a slide's animations as PowerPoint's animation pane lists them (p:timing + p:bldLst, read and written by folio-pptx; played by folio-slides-motion).
| Type | Description |
|---|---|
SlideTiming | { main: AnimEffect[]; triggers?: AnimTrigger[]; builds?: AnimBuild[]; extra?: string[]; lossy?: string[] }: the click sequence, shape-triggered sequences (AnimTrigger { shape, effects }), build entries (AnimBuild { shape, grpId, kind, attrs?, xml? }), other time nodes kept as XML (media), structures not modelled |
AnimEffect | { id, cls, preset, subtype, target, start: 'click' | 'with' | 'after', delay, time?, iterate?, grpId?, behaviors }; AnimClass = entr, exit, emph, path, verb, mediacall |
AnimTarget | { shape, paras?: [st, end], chars?, bg?, xml? }: a shape, a paragraph range of its text, its background |
AnimBehavior | set, anim (keys AnimKey { t, v?, fmla? }, from/to/by), effect (filter, in/out), scale, rot, motion (path), color, or raw (XML kept as is, with what a player needs read out: cmd and sound); each with a TimeNode and attr names |
MediaCommand, AnimSound | p:cmd on a raw behaviour: { type: 'verb' | 'call' | 'evt', cmd } (playFrom(1.5), pause, stop...); a sound an effect plays (p:audio): { src?, name? }, src the embedded sound's media: reference |
TimeNode, AnimTime | { dur?, delay?, accel?, decel?, autoRev?, repeat?, repeatDur?, fill?, speed?, tmFilter?, attrs? } in ms; 'indefinite' as in the file |
AnimValue, AnimIterate | animated values (number, formula string, boolean, { color }, { hsl }); { type: 'el' | 'wd' | 'lt', backwards?, pct?, ms? } by word / letter |
Transition | { type, duration?, advanceOnClick?, advanceAfter?, options?, ns? }: options are the effect's attributes (dir, orient, thruBlk...), ns the Office extension namespace (p14, p159 for morph); sound { xml, name?, src?, loop?, stop? } the transition sound (stop: "stop previous sound") |
Scheduling (shared by the writer and the player): schedule(effects, count?) → Schedule { steps: TimingStep[]; auto } (click steps of with/after groups, ScheduledEffect { effect, at, dur, count }); effectDuration(e, count?), effectSimple, finiteDuration, behaviorEnd, activeDuration(node, simple), timeOf, iterateInterval, iterateCount(slide, e) (words / letters of the target), shapeParagraphs(slide, id), shapeIdsDeep(shapes), pruneTiming(timing, ids) (drops effects on missing shapes).
PDF (/pdf)
exportSlidesPdf(pres, { layout, slides?, notesPages?, ...PdfExportOptions }): lays the deck out and writes it with exportPdf and the layers PDF painters. notesPages: true writes PowerPoint's "Notes pages" layout instead (one notes page per slide); handouts: { perPage: 1 | 2 | 3 | 4 | 6 | 9, order?: 'horizontal' | 'vertical' } writes handouts (several slides per page; 3 per page with lines for notes). plugins takes plugins whose page layers and PDF painters apply on every page (folio-reader's watermarkPlugin fits as it is), with variables filling their templates; permissions still encrypt the file. layoutSlidesPdf(pres, { layout, slides?, notesPages?, handouts? }) gives the same pages (preset shapes loaded) and slidesPdfPainters their painters, for hosts writing them with their own export (folio-reader's exportPagesPdf). Audio and video frames (and embedded pages) print their poster, or their default frame when they have none; with mediaQr or mediaLink, a media card (title, kind, link, QR code) runs across its bottom (a frame under 120 px tall is the card whole), through the same mediaLink(attrs, kind) hook as documents (see media cards). The entry is DOM-free: it runs in Node.
Accessibility check
checkAccessibility(pres) → A11yIssue[] ({ slide, slideId, shape?, inner?, kind, severity, message }: slideId survives reorders, shape is the slide shape (a group or diagram for something inside one) and inner the object inside it), like PowerPoint's Check Accessibility. It reports pictures, charts, diagrams and tables without alt text (alt-text, error); slides without a title (no-title, error) or with another slide's title (duplicate-title); text under WCAG AA contrast against its shape's fill, its table cell's fill or the slide background (contrast: 4.5:1, or 3:1 for text of 18 pt, or 14 pt bold); and tables without a header row (table-header). Colours come from the projection, so theme colours, colour maps and table styles are resolved. contrastRatio(a, b) and parseCssColor(css) are the WCAG helpers. checkSlide(pres, i) checks one slide (memoized per slide object, layout, master, theme and position, so after an edit only changed slides cost anything), duplicateTitles(pres) the cross-slide part, slideTitle(slide) a slide's title.
Charts
GraphicShape.chart (ChartSpec: { kind, stacked, series: ChartSeries[], title?, legend?, gridlines, vary, filled? }; kind is bar, col, line, area, pie, doughnut or radar, and filled marks a filled radar; ChartSeries is { name, cats, vals, fill?, points? }) holds what PowerPoint cached in the chart part. chartShapes(spec, w, h) draws it as shapes (the frame's drawing), and niceStep(max) gives the axis step. GraphicShape.frameId is the frame's id in origin: a pasted copy, which gets a new id, is re-created from that frame.
A chart given as data alone ({ kind: 'graphic', what: 'chart', uri, chart }, no drawing, preview or origin) is drawn from chart everywhere (editor, thumbnails, show, PDF), and the PPTX export writes it a new chart part with its workbook, so PowerPoint opens it as a real chart.
What draws these frames (and the media frames below) is a lazy chunk: usesFrameDrawers(pres) tells whether a deck has one, loadFrameDrawers() loads it (frameDrawersLoaded(), onFrameDrawersLoaded(fn)), and ensurePresetShapes(pres) / geometryLibraries() (bit 16) load and key on it like the preset shapes. folio-plugin-slides and exportSlidesPdf load it for decks that need it; a host laying slides out itself (layoutDeck, deckChapter) awaits ensurePresetShapes(pres) first, or a chart shows its placeholder (and a media frame nothing) until the chunk lands.
Media frames without a picture
A picture frame whose image is empty draws a default look sized to its box, in every painter: a video (media: 'video') is a dark frame with a play button, audio (media: 'audio') a speaker with a player bar, and an embedded page (embed) a light card with a globe and the URL's host. It selects and moves like any picture; give it an image (a poster) to show that instead. mediaFrameShapes(kind, w, h, url?) returns those shapes (in the frame's coordinates) for hosts drawing them elsewhere; urlHost(url) is the host it shows.
Every canvas view of a slide (thumbnails, the sorter, the read-only view, the show) paints through one painter at device resolution, the same plan as the editor and the PDF, so a thumbnail is the slide scaled. A picture that fails to load is the grey box there too.
SmartArt
GraphicShape.diagram ({ data, layout, style?, colors?, edited? }) holds the diagram's parts as XML. drawing holds what is shown: the drawing PowerPoint saved, or one laid out by folio-diagrams when the file has none.
| Export | What |
|---|---|
editDiagram(frame, edit: DiagramEdit | DiagramEdit[], { measure? }) → { shape, id? } | applies one edit, or several in order, and lays the diagram out again in the frame once. The result has new drawing shapes, the data rewritten, and edited set to the drawing part to export. id is the node an add made. It returns the same frame when nothing changes |
DiagramEdit | { op: 'text', id, text }, { op: 'add', after | parent, text? }, { op: 'remove' | 'indent' | 'outdent', id }, { op: 'move', id, delta } |
diagramOutline(frame) → DiagramOutlineItem[] | the text pane: { id, text, level } per node, depth first |
diagramOf(frame) → Diagram, diagramToShapes(shapes, k) | the parsed parts; folio-diagrams' shapes as slide shapes (k: px per layout unit) |
diagramTextWidth(pres, sheet, measurer) → TextWidth | text widths in points with the theme's body font, for editDiagram's measure |
newDiagramShape(parts, xfrm, { id?, name?, measure? }) | a new SmartArt frame from its parts (folio-diagrams' newDiagramParts, re-exported here with the library), laid out in xfrm |
restyleDiagram(frame, { layout?, style?, colors? }, { measure? }) | the frame with other parts, laid out again; the text is kept, the old layout's presentation points and tweaks dropped |
layIn(frame, diagram, measure?, parts?) | lays a parsed diagram out in the frame (what the others share) |
DIAGRAM_LAYOUTS, DIAGRAM_COLORS, DIAGRAM_STYLES, newDiagramParts, colorsDefXml, styleDefXml, LibraryLayout, DiagramKind, DiagramColors, DiagramStyle, DiagramItem | the SmartArt library, re-exported from folio-diagrams so a host can list layouts (by DiagramKind), colour schemes and quick styles and create a diagram without importing the engine. See folio-diagrams › Library |
GraphicShape.drawing.nodes gives, per drawn shape, the data point whose text it shows (when it shows one only). With SlideDocumentOptions.diagrams (DiagramApply: text(frame, edits), relayout(frame)), passed to both slideDocument and applySlideDocument, those shapes are editable on the slide. Their text goes to the data, and a resized frame is laid out again at its new size. folio-plugin-slides passes the deck's smartArtPlugin here. Without it the drawing stays locked, and the diagram engine stays out of the slide editor's bundle.