openpencil/packages/scene-graph/src/export-format.ts
Danila Poyarkov 2d9e83d58a
refactor(export): derive export format lists from the IO registry (#755)
The Export panel, SDK helpers, app menus, and CLI each kept their own
hand-written format lists, so new formats such as PPTX reached some
surfaces and not others.

Scene Graph now owns the persisted export-setting format ids, Core IO
adapters carry literal ids so that list is checked against real adapters,
and the panel labels, scale handling, app format types, and CLI format
validation/help are derived from the registry. PPTX joins the Export
panel as a result.
2026-09-25 15:42:42 +04:00

13 lines
517 B
TypeScript

/**
* Formats a node's export settings may persist. Each id must name a Core IO
* export adapter that supports node export; labels and options come from that
* adapter, so this list only decides what the Export panel offers.
*/
export const EXPORT_FORMAT_IDS = ['png', 'jpg', 'webp', 'svg', 'pdf', 'pptx'] as const
export type ExportFormatId = (typeof EXPORT_FORMAT_IDS)[number]
export function isExportFormatId(value: unknown): value is ExportFormatId {
return EXPORT_FORMAT_IDS.some((id) => id === value)
}