@openmaic/renderer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +247 -0
- package/FONTS.md +90 -0
- package/LICENSE +21 -0
- package/README.md +217 -0
- package/dist/SlideCanvas.d.ts +40 -0
- package/dist/SlideElement.d.ts +14 -0
- package/dist/chunks/BaseCodeElement-Bh-Bfdz6.js +1742 -0
- package/dist/chunks/BaseCodeElement-Bh-Bfdz6.js.map +1 -0
- package/dist/chunks/SlideCanvas-BwlcjqMl.js +469 -0
- package/dist/chunks/SlideCanvas-BwlcjqMl.js.map +1 -0
- package/dist/context.d.ts +25 -0
- package/dist/effects/HighlightOverlay.d.ts +7 -0
- package/dist/effects/LaserOverlay.d.ts +7 -0
- package/dist/effects/SpotlightOverlay.d.ts +7 -0
- package/dist/effects/ZoomWrapper.d.ts +9 -0
- package/dist/effects/index.d.ts +4 -0
- package/dist/elements/chart/BaseChartElement.d.ts +6 -0
- package/dist/elements/chart/Chart.d.ts +13 -0
- package/dist/elements/chart/chartOption.d.ts +15 -0
- package/dist/elements/code/BaseCodeElement.d.ts +6 -0
- package/dist/elements/image/BaseImageElement.d.ts +13 -0
- package/dist/elements/image/ImageOutline.d.ts +5 -0
- package/dist/elements/image/clipPaths.d.ts +13 -0
- package/dist/elements/image/useClipImage.d.ts +10 -0
- package/dist/elements/image/useFilter.d.ts +4 -0
- package/dist/elements/index.d.ts +14 -0
- package/dist/elements/index.js +10 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/elements/latex/BaseLatexElement.d.ts +5 -0
- package/dist/elements/line/BaseLineElement.d.ts +6 -0
- package/dist/elements/line/LinePointMarker.d.ts +11 -0
- package/dist/elements/shape/BaseShapeElement.d.ts +5 -0
- package/dist/elements/shape/GradientDefs.d.ts +9 -0
- package/dist/elements/shape/PatternDefs.d.ts +6 -0
- package/dist/elements/shared/ElementOutline.d.ts +7 -0
- package/dist/elements/shared/useElementFill.d.ts +4 -0
- package/dist/elements/shared/useElementFlip.d.ts +3 -0
- package/dist/elements/shared/useElementOutline.d.ts +7 -0
- package/dist/elements/shared/useElementShadow.d.ts +4 -0
- package/dist/elements/table/BaseTableElement.d.ts +6 -0
- package/dist/elements/table/StaticTable.d.ts +6 -0
- package/dist/elements/table/tableUtils.d.ts +5 -0
- package/dist/elements/text/BaseTextElement.d.ts +6 -0
- package/dist/elements/video/BaseVideoElement.d.ts +13 -0
- package/dist/hooks/useSlideBackgroundStyle.d.ts +5 -0
- package/dist/hooks/useViewportSize.d.ts +27 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/snapshot/index.d.ts +46 -0
- package/dist/snapshot/index.js +347 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/styles.d.ts +12 -0
- package/dist/types/effects.d.ts +25 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/element.d.ts +21 -0
- package/dist/utils/geometry.d.ts +19 -0
- package/font-licenses/ARPHIC-PL.txt +58 -0
- package/font-licenses/OFL.txt +101 -0
- package/font-licenses/ZcoolHappy-LICENSE.txt +16 -0
- package/fonts.css +45 -0
- package/package.json +94 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PercentageGeometry } from '../utils/geometry';
|
|
3
|
+
import type { ZoomEffectOptions } from '../types/effects';
|
|
4
|
+
export interface ZoomWrapperProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
zoom?: ZoomEffectOptions;
|
|
7
|
+
geometry: PercentageGeometry | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function ZoomWrapper({ children, zoom, geometry }: ZoomWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { HighlightOverlay, type HighlightOverlayProps } from './HighlightOverlay';
|
|
2
|
+
export { SpotlightOverlay, type SpotlightOverlayProps } from './SpotlightOverlay';
|
|
3
|
+
export { LaserOverlay, type LaserOverlayProps } from './LaserOverlay';
|
|
4
|
+
export { ZoomWrapper, type ZoomWrapperProps } from './ZoomWrapper';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PPTChartElement } from '@openmaic/dsl';
|
|
2
|
+
export interface BaseChartElementProps {
|
|
3
|
+
elementInfo: PPTChartElement;
|
|
4
|
+
target?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function BaseChartElement({ elementInfo, target }: BaseChartElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartData, ChartOptions, ChartType } from '@openmaic/dsl';
|
|
2
|
+
interface ChartProps {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
type: ChartType;
|
|
6
|
+
data: ChartData;
|
|
7
|
+
themeColors: string[];
|
|
8
|
+
textColor?: string;
|
|
9
|
+
lineColor?: string;
|
|
10
|
+
options?: ChartOptions;
|
|
11
|
+
}
|
|
12
|
+
export declare function Chart({ width: _width, height: _height, type, data, themeColors: rawThemeColors, textColor, lineColor, options, }: ChartProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComposeOption } from 'echarts/core';
|
|
2
|
+
import type { BarSeriesOption, LineSeriesOption, PieSeriesOption, ScatterSeriesOption, RadarSeriesOption } from 'echarts/charts';
|
|
3
|
+
import type { ChartData, ChartType } from '@openmaic/dsl';
|
|
4
|
+
type EChartOption = ComposeOption<BarSeriesOption | LineSeriesOption | PieSeriesOption | ScatterSeriesOption | RadarSeriesOption>;
|
|
5
|
+
export interface ChartOptionPayload {
|
|
6
|
+
type: ChartType;
|
|
7
|
+
data: ChartData;
|
|
8
|
+
themeColors: string[];
|
|
9
|
+
textColor?: string;
|
|
10
|
+
lineColor?: string;
|
|
11
|
+
lineSmooth?: boolean;
|
|
12
|
+
stack?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const getChartOption: ({ type, data, themeColors, textColor, lineColor, lineSmooth, stack, }: ChartOptionPayload) => EChartOption | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PPTCodeElement } from '@openmaic/dsl';
|
|
2
|
+
export interface BaseCodeElementProps {
|
|
3
|
+
elementInfo: PPTCodeElement;
|
|
4
|
+
animate?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function BaseCodeElement({ elementInfo, animate }: BaseCodeElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PPTImageElement } from '@openmaic/dsl';
|
|
3
|
+
export interface BaseImageElementProps {
|
|
4
|
+
elementInfo: PPTImageElement;
|
|
5
|
+
/**
|
|
6
|
+
* Optional render slot: replace the default <img> with custom content.
|
|
7
|
+
* The slot receives `(element, resolvedSrc)` and is responsible for rendering
|
|
8
|
+
* placeholders, retry UI, business-specific resolvers (e.g. AI media generation),
|
|
9
|
+
* etc. The package itself does not interpret `src` beyond passing it through.
|
|
10
|
+
*/
|
|
11
|
+
renderImage?: (element: PPTImageElement, resolvedSrc: string) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function BaseImageElement({ elementInfo, renderImage }: BaseImageElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const enum ClipPathTypes {
|
|
2
|
+
RECT = "rect",
|
|
3
|
+
ELLIPSE = "ellipse",
|
|
4
|
+
POLYGON = "polygon"
|
|
5
|
+
}
|
|
6
|
+
export interface ClipPathDef {
|
|
7
|
+
name: string;
|
|
8
|
+
type: ClipPathTypes;
|
|
9
|
+
style: string;
|
|
10
|
+
radius?: string;
|
|
11
|
+
createPath?: (width: number, height: number) => string;
|
|
12
|
+
}
|
|
13
|
+
export declare const CLIPPATHS: Record<string, ClipPathDef>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PPTImageElement } from '@openmaic/dsl';
|
|
2
|
+
export declare function useClipImage(element: PPTImageElement): {
|
|
3
|
+
clipShape: import("./clipPaths").ClipPathDef;
|
|
4
|
+
imgPosition: {
|
|
5
|
+
top: string;
|
|
6
|
+
left: string;
|
|
7
|
+
width: string;
|
|
8
|
+
height: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { BaseTextElement, type BaseTextElementProps } from './text/BaseTextElement';
|
|
2
|
+
export { BaseShapeElement, type BaseShapeElementProps } from './shape/BaseShapeElement';
|
|
3
|
+
export { BaseImageElement, type BaseImageElementProps } from './image/BaseImageElement';
|
|
4
|
+
export { BaseLineElement, type BaseLineElementProps } from './line/BaseLineElement';
|
|
5
|
+
export { BaseChartElement, type BaseChartElementProps } from './chart/BaseChartElement';
|
|
6
|
+
export { BaseLatexElement, type BaseLatexElementProps } from './latex/BaseLatexElement';
|
|
7
|
+
export { BaseTableElement, type BaseTableElementProps } from './table/BaseTableElement';
|
|
8
|
+
export { BaseVideoElement, type BaseVideoElementProps } from './video/BaseVideoElement';
|
|
9
|
+
export { BaseCodeElement, type BaseCodeElementProps } from './code/BaseCodeElement';
|
|
10
|
+
export { ElementOutline, type ElementOutlineProps } from './shared/ElementOutline';
|
|
11
|
+
export { useElementFill } from './shared/useElementFill';
|
|
12
|
+
export { useElementOutline } from './shared/useElementOutline';
|
|
13
|
+
export { useElementShadow } from './shared/useElementShadow';
|
|
14
|
+
export { useElementFlip } from './shared/useElementFlip';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { B as BaseChartElement, a as BaseCodeElement, b as BaseImageElement, c as BaseLatexElement, d as BaseLineElement, e as BaseShapeElement, f as BaseTableElement, g as BaseTextElement, h as BaseVideoElement, E as ElementOutline, u as useElementFill, i as useElementFlip, j as useElementOutline, k as useElementShadow } from '../chunks/BaseCodeElement-Bh-Bfdz6.js';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'tinycolor2';
|
|
5
|
+
import 'echarts/core';
|
|
6
|
+
import 'echarts/charts';
|
|
7
|
+
import 'echarts/components';
|
|
8
|
+
import 'echarts/renderers';
|
|
9
|
+
import 'motion/react';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PPTLineElement } from '@openmaic/dsl';
|
|
2
|
+
export interface BaseLineElementProps {
|
|
3
|
+
elementInfo: PPTLineElement;
|
|
4
|
+
animate?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function BaseLineElement({ elementInfo, animate }: BaseLineElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LinePoint } from '@openmaic/dsl';
|
|
2
|
+
type NonEmptyLinePoint = Exclude<LinePoint, ''>;
|
|
3
|
+
interface LinePointMarkerProps {
|
|
4
|
+
id: string;
|
|
5
|
+
position: 'start' | 'end';
|
|
6
|
+
type: NonEmptyLinePoint;
|
|
7
|
+
baseSize: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function LinePointMarker({ id, position, type, baseSize, color }: LinePointMarkerProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GradientColor, GradientType } from '@openmaic/dsl';
|
|
2
|
+
interface GradientDefsProps {
|
|
3
|
+
id: string;
|
|
4
|
+
type: GradientType;
|
|
5
|
+
colors: GradientColor[];
|
|
6
|
+
rotate?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function GradientDefs({ id, type, colors, rotate }: GradientDefsProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PPTElementOutline } from '@openmaic/dsl';
|
|
2
|
+
export interface ElementOutlineProps {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
outline?: PPTElementOutline;
|
|
6
|
+
}
|
|
7
|
+
export declare function ElementOutline({ width, height, outline }: ElementOutlineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PPTTableElement } from '@openmaic/dsl';
|
|
2
|
+
export interface BaseTableElementProps {
|
|
3
|
+
elementInfo: PPTTableElement;
|
|
4
|
+
target?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function BaseTableElement({ elementInfo, target }: BaseTableElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { TableCell, TableCellStyle } from '@openmaic/dsl';
|
|
3
|
+
export declare function getTextStyle(style?: TableCellStyle): CSSProperties;
|
|
4
|
+
export declare function formatText(text: string): string;
|
|
5
|
+
export declare function getHiddenCells(data: TableCell[][]): Set<string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PPTTextElement } from '@openmaic/dsl';
|
|
2
|
+
export interface BaseTextElementProps {
|
|
3
|
+
elementInfo: PPTTextElement;
|
|
4
|
+
target?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function BaseTextElement({ elementInfo, target }: BaseTextElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PPTVideoElement } from '@openmaic/dsl';
|
|
3
|
+
export interface BaseVideoElementProps {
|
|
4
|
+
elementInfo: PPTVideoElement;
|
|
5
|
+
/**
|
|
6
|
+
* Optional render slot: replace the default <video> with custom content.
|
|
7
|
+
* Lets consumers inject placeholders, retry UI, lazy media resolvers, or
|
|
8
|
+
* controlled playback bound to their own orchestration state.
|
|
9
|
+
* When omitted, the package renders a plain <video src controls preload="metadata">.
|
|
10
|
+
*/
|
|
11
|
+
renderVideo?: (element: PPTVideoElement) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function BaseVideoElement({ elementInfo, renderVideo }: BaseVideoElementProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export interface ViewportStyles {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UseViewportSizeResult {
|
|
9
|
+
viewportStyles: ViewportStyles;
|
|
10
|
+
/** Computed scale: viewport pixels → container pixels at the current fit. */
|
|
11
|
+
fitScale: number;
|
|
12
|
+
}
|
|
13
|
+
export interface UseViewportSizeOptions {
|
|
14
|
+
/** Viewport width in design pixels (slide.viewportSize), default 1000 */
|
|
15
|
+
viewportSize?: number;
|
|
16
|
+
/** Viewport aspect ratio (slide.viewportRatio), default 0.5625 (16:9) */
|
|
17
|
+
viewportRatio?: number;
|
|
18
|
+
/** Percent of the container the viewport should occupy, default 100 */
|
|
19
|
+
canvasPercentage?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Compute the viewport rect and fit-scale needed to center a slide of size
|
|
23
|
+
* `viewportSize × viewportSize*viewportRatio` inside `canvasRef`.
|
|
24
|
+
*
|
|
25
|
+
* Pure: no store access. Re-runs on container resize via ResizeObserver.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useViewportSize(canvasRef: RefObject<HTMLElement | null>, options?: UseViewportSizeOptions): UseViewportSizeResult;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SlideCanvas, type SlideCanvasProps } from './SlideCanvas';
|
|
2
|
+
export { SlideElement, type SlideElementProps } from './SlideElement';
|
|
3
|
+
export { SlideRendererProvider, useSlideContext, useOptionalSlideContext, type SlideContextValue, type SlideRendererProviderProps, } from './context';
|
|
4
|
+
export { HighlightOverlay, SpotlightOverlay, LaserOverlay, ZoomWrapper, type HighlightOverlayProps, type SpotlightOverlayProps, type LaserOverlayProps, type ZoomWrapperProps, } from './effects';
|
|
5
|
+
export { useSlideBackgroundStyle } from './hooks/useSlideBackgroundStyle';
|
|
6
|
+
export { useViewportSize, type ViewportStyles, type UseViewportSizeOptions, type UseViewportSizeResult, } from './hooks/useViewportSize';
|
|
7
|
+
export { findElementGeometry, findNearestCorner, getElementPercentageGeometry, type PercentageGeometry, } from './utils/geometry';
|
|
8
|
+
export { cn } from './utils/cn';
|
|
9
|
+
export * from './types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { H as HighlightOverlay, L as LaserOverlay, S as SlideCanvas, a as SlideElement, b as SlideRendererProvider, c as SpotlightOverlay, f as findElementGeometry, d as findNearestCorner, g as getElementPercentageGeometry, u as useOptionalSlideContext, e as useSlideBackgroundStyle, h as useSlideContext, i as useViewportSize } from './chunks/SlideCanvas-BwlcjqMl.js';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
export * from '@openmaic/dsl';
|
|
7
|
+
import 'react';
|
|
8
|
+
import './chunks/BaseCodeElement-Bh-Bfdz6.js';
|
|
9
|
+
import 'tinycolor2';
|
|
10
|
+
import 'echarts/core';
|
|
11
|
+
import 'echarts/charts';
|
|
12
|
+
import 'echarts/components';
|
|
13
|
+
import 'echarts/renderers';
|
|
14
|
+
|
|
15
|
+
function ZoomWrapper({ children, zoom, geometry }) {
|
|
16
|
+
if (!zoom || !geometry) {
|
|
17
|
+
return jsx(Fragment, { children: children });
|
|
18
|
+
}
|
|
19
|
+
const { scale } = zoom;
|
|
20
|
+
const { centerX, centerY } = geometry;
|
|
21
|
+
return (jsx(motion.div, { initial: { scale: 1 }, animate: { scale }, exit: { scale: 1 }, transition: { type: 'spring', stiffness: 200, damping: 25 }, style: {
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: '100%',
|
|
24
|
+
transformOrigin: `${centerX}% ${centerY}%`,
|
|
25
|
+
}, children: children }));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function cn(...inputs) {
|
|
29
|
+
return twMerge(clsx(inputs));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { ZoomWrapper, cn };
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/effects/ZoomWrapper.tsx","../src/utils/cn.ts"],"sourcesContent":["'use client';\n\nimport { motion } from 'motion/react';\nimport type { ReactNode } from 'react';\nimport type { PercentageGeometry } from '../utils/geometry';\nimport type { ZoomEffectOptions } from '../types/effects';\n\nexport interface ZoomWrapperProps {\n children: ReactNode;\n zoom?: ZoomEffectOptions;\n geometry: PercentageGeometry | null;\n}\n\nexport function ZoomWrapper({ children, zoom, geometry }: ZoomWrapperProps) {\n if (!zoom || !geometry) {\n return <>{children}</>;\n }\n\n const { scale } = zoom;\n const { centerX, centerY } = geometry;\n\n return (\n <motion.div\n initial={{ scale: 1 }}\n animate={{ scale }}\n exit={{ scale: 1 }}\n transition={{ type: 'spring', stiffness: 200, damping: 25 }}\n style={{\n width: '100%',\n height: '100%',\n transformOrigin: `${centerX}% ${centerY}%`,\n }}\n >\n {children}\n </motion.div>\n );\n}\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;AAaM,SAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAoB,EAAA;AACxE,IAAA,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;QACtB,OAAOA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;IACxB;AAEA,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;AACtB,IAAA,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ;IAErC,QACED,IAAC,MAAM,CAAC,GAAG,EAAA,EACT,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EACrB,OAAO,EAAE,EAAE,KAAK,EAAE,EAClB,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAClB,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,EAC3D,KAAK,EAAE;AACL,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,eAAe,EAAE,CAAA,EAAG,OAAO,CAAA,EAAA,EAAK,OAAO,CAAA,CAAA,CAAG;SAC3C,EAAA,QAAA,EAEA,QAAQ,EAAA,CACE;AAEjB;;ACjCM,SAAU,EAAE,CAAC,GAAG,MAAoB,EAAA;AACxC,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9B;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Slide } from '@openmaic/dsl';
|
|
2
|
+
export interface SlideToPngOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Output pixel width. Defaults to the slide's native `viewportSize`
|
|
5
|
+
* (e.g. 1280 for a 16:9 widescreen deck). Height is derived from
|
|
6
|
+
* `viewportRatio`.
|
|
7
|
+
*/
|
|
8
|
+
width?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Multiplier on output resolution. Default tracks `window.devicePixelRatio`
|
|
11
|
+
* (typically 2 on retina displays) so the exported PNG is as sharp as
|
|
12
|
+
* the on-screen canvas. Pass 1 for a lighter file at the cost of
|
|
13
|
+
* sub-pixel clarity.
|
|
14
|
+
*/
|
|
15
|
+
pixelRatio?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Background color filled behind the slide. Defaults to white. Pass
|
|
18
|
+
* 'transparent' to keep the slide's own background only.
|
|
19
|
+
*/
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Output format. 'blob' yields a `Blob` suitable for `URL.createObjectURL`
|
|
23
|
+
* + download; 'dataUrl' yields a `data:image/png;base64,...` string.
|
|
24
|
+
*/
|
|
25
|
+
format?: 'blob' | 'dataUrl';
|
|
26
|
+
/**
|
|
27
|
+
* Settle timeout in milliseconds. The snapshot waits for `document.fonts.ready`
|
|
28
|
+
* and every `<img>` inside the container to load (or error) before
|
|
29
|
+
* capturing — but won't wait longer than this. Defaults to 5000.
|
|
30
|
+
*/
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Debug only — render the off-screen container on-screen for the given
|
|
34
|
+
* number of milliseconds after snapshot so you can visually confirm what
|
|
35
|
+
* was captured. Do not use in production.
|
|
36
|
+
*/
|
|
37
|
+
debugVisibleMs?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Render a `Slide` to a PNG image.
|
|
41
|
+
*
|
|
42
|
+
* Throws if called outside a browser (no `document` / `window`), if React
|
|
43
|
+
* fails to mount, or if html2canvas-pro hits a CORS-tainted canvas (cross-
|
|
44
|
+
* origin `<img>` without permissive headers will block the snapshot).
|
|
45
|
+
*/
|
|
46
|
+
export declare function slideToPng(slide: Slide, options?: SlideToPngOptions): Promise<Blob | string>;
|