@elucim/dsl 0.7.0 → 0.8.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/dist/index.d.ts +36 -0
- package/dist/index.js +419 -368
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -577,12 +577,47 @@ export declare function renderRoot(node: SceneNode | PlayerNode | PresentationNo
|
|
|
577
577
|
export declare interface RenderRootOverrides {
|
|
578
578
|
frame?: number;
|
|
579
579
|
playerRef?: default_2.RefObject<PlayerRef | null>;
|
|
580
|
+
/** CSS color-scheme to pass to Scene/Player. When set, overrides browser prefers-color-scheme. */
|
|
581
|
+
colorScheme?: 'light' | 'dark' | 'light dark';
|
|
580
582
|
}
|
|
581
583
|
|
|
582
584
|
export declare function renderScene(node: SceneNode, overrides?: RenderRootOverrides): default_2.ReactNode;
|
|
583
585
|
|
|
584
586
|
export declare function renderSlide(node: SlideNode, key: number): default_2.ReactNode;
|
|
585
587
|
|
|
588
|
+
/**
|
|
589
|
+
* Render a DSL document at a specific frame directly to PNG bytes.
|
|
590
|
+
*
|
|
591
|
+
* Goes from DSL JSON → SVG string → PNG without requiring a mounted DOM
|
|
592
|
+
* element, blob URLs, or manual Image loading. Uses data URIs internally
|
|
593
|
+
* to avoid CSP issues in restricted webview contexts (e.g. Tauri).
|
|
594
|
+
*
|
|
595
|
+
* Works in any browser environment. Does NOT work in Node.js (needs
|
|
596
|
+
* canvas + Image APIs).
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```ts
|
|
600
|
+
* import { renderToPng } from '@elucim/dsl';
|
|
601
|
+
*
|
|
602
|
+
* const png = await renderToPng(myDocument, 0);
|
|
603
|
+
* // png is a Uint8Array of PNG bytes
|
|
604
|
+
*
|
|
605
|
+
* // Save as file download:
|
|
606
|
+
* const blob = new Blob([png], { type: 'image/png' });
|
|
607
|
+
* const url = URL.createObjectURL(blob);
|
|
608
|
+
* ```
|
|
609
|
+
*/
|
|
610
|
+
export declare function renderToPng(dsl: ElucimDocument, frame: number, options?: RenderToPngOptions): Promise<Uint8Array>;
|
|
611
|
+
|
|
612
|
+
export declare interface RenderToPngOptions {
|
|
613
|
+
/** Output width in pixels (default: document width) */
|
|
614
|
+
width?: number;
|
|
615
|
+
/** Output height in pixels (default: document height) */
|
|
616
|
+
height?: number;
|
|
617
|
+
/** Device pixel ratio for retina output (default: 2) */
|
|
618
|
+
scale?: number;
|
|
619
|
+
}
|
|
620
|
+
|
|
586
621
|
/**
|
|
587
622
|
* Render a DSL document to an SVG string at a specific frame, without mounting to the DOM.
|
|
588
623
|
* Uses react-dom/server's renderToStaticMarkup.
|
|
@@ -1002,6 +1037,7 @@ export declare interface ValidationResult {
|
|
|
1002
1037
|
|
|
1003
1038
|
export declare interface VectorFieldNode {
|
|
1004
1039
|
type: 'vectorField';
|
|
1040
|
+
id?: string;
|
|
1005
1041
|
/** Vector expression string, e.g. "[-y, x]" */
|
|
1006
1042
|
fn: string;
|
|
1007
1043
|
domain?: [number, number];
|