@oomol-lab/open-flow 0.1.0-beta.82 → 0.1.0-beta.83
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/browser/{FlowCanvas-Dew2fmoT.js → FlowCanvas-ChbukrDh.js} +832 -269
- package/dist/browser/{createResourceDialog-bdOJa5Zk.js → createResourceDialog-Bi4fUnbD.js} +3 -3
- package/dist/browser/{dialog-CFlvkliO.js → dialog-BzoSxhXQ.js} +1 -1
- package/dist/browser/{exportPng-Cjdb6COo.js → exportPng-CrAFfOaD.js} +187 -70
- package/dist/browser/{flowChanges-URBEd4DI.js → flowChanges-C567g-Pc.js} +94 -24
- package/dist/browser/{flowWorkspace-BlXx-yAn.js → flowWorkspace-rvcneG4q.js} +706 -209
- package/dist/browser/licenses.md +2 -2
- package/dist/browser/{markdownContent-IS8xXDoc.js → markdownContent-B-GLj5DU.js} +1 -1
- package/dist/browser/preview.css +37 -0
- package/dist/browser/preview.js +947 -323
- package/dist/browser/{tooltip-BDcVTNpu.js → tooltip-DGj5pudg.js} +1 -1
- package/dist/browser/ui.css +37 -0
- package/dist/browser/workbench.css +37 -0
- package/dist/browser/workbench.js +11 -10
- package/dist/browser/{workbenchSelect-Ci0KCYv9.js → workbenchSelect-BIaEVTx6.js} +2 -2
- package/dist/browser/{wrapLayout-DZvW9dBs.js → wrapLayout-C4moMKgb.js} +9 -2
- package/dist/command/index.js +1 -1
- package/dist/render/browser/licenses.md +2 -2
- package/dist/render/browser/runtime.css +37 -0
- package/dist/render/browser/runtime.js +1684 -923
- package/dist/render/common/png.d.ts +8 -0
- package/dist/render/node/index.d.ts +1 -1
- package/dist/render/node/index.js +17 -0
- package/package.json +1 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { WorkflowFile } from '../../common/flow-workflowFile.js';
|
|
2
2
|
import type { UiLanguage } from '../../common/localization.js';
|
|
3
|
+
export type FlowPngLayout = 'original' | 'compact';
|
|
4
|
+
export declare const flowPngAspectRatios: readonly ['auto', '1:1', '4:3', '3:4', '16:9', '9:16'];
|
|
5
|
+
export type FlowPngAspectRatio = (typeof flowPngAspectRatios)[number];
|
|
6
|
+
export declare function getFlowPngAspectRatio(value?: FlowPngAspectRatio): readonly [number, number] | undefined;
|
|
3
7
|
export interface FlowPngOptions {
|
|
8
|
+
/** Compact applies to vertical workflows; horizontal exports preserve saved positions. */
|
|
9
|
+
readonly layout?: FlowPngLayout;
|
|
10
|
+
/** Ratio of the complete image, including its frame; defaults to the content bounds. */
|
|
11
|
+
readonly aspectRatio?: FlowPngAspectRatio;
|
|
4
12
|
readonly language?: UiLanguage;
|
|
5
13
|
readonly dark?: boolean;
|
|
6
14
|
readonly frame?: boolean;
|
|
@@ -3,7 +3,7 @@ import type { WorkflowFile } from '../../common/flow-workflowFile.js';
|
|
|
3
3
|
import type { FlowPngOptions, RenderResponse } from '../common/png.js';
|
|
4
4
|
import { Buffer } from 'node:buffer';
|
|
5
5
|
export type { WorkflowFile } from '../../common/flow-workflowFile.js';
|
|
6
|
-
export type { FlowPngOptions } from '../common/png.js';
|
|
6
|
+
export type { FlowPngAspectRatio, FlowPngLayout, FlowPngOptions } from '../common/png.js';
|
|
7
7
|
export interface FlowPngResult extends Omit<RenderResponse, 'dataUrl'> {
|
|
8
8
|
readonly buffer: Buffer;
|
|
9
9
|
}
|
|
@@ -9451,10 +9451,27 @@ function decodeWorkflowFile(value) {
|
|
|
9451
9451
|
};
|
|
9452
9452
|
}
|
|
9453
9453
|
//#endregion
|
|
9454
|
+
//#region src/render/common/png.ts
|
|
9455
|
+
var flowPngAspectRatios = [
|
|
9456
|
+
"auto",
|
|
9457
|
+
"1:1",
|
|
9458
|
+
"4:3",
|
|
9459
|
+
"3:4",
|
|
9460
|
+
"16:9",
|
|
9461
|
+
"9:16"
|
|
9462
|
+
];
|
|
9463
|
+
function getFlowPngAspectRatio(value) {
|
|
9464
|
+
if (value == null || value === "auto") return void 0;
|
|
9465
|
+
if (!flowPngAspectRatios.includes(value)) throw new TypeError("Unsupported PNG canvas aspect ratio.");
|
|
9466
|
+
const [width, height] = value.split(":").map(Number);
|
|
9467
|
+
return [width, height];
|
|
9468
|
+
}
|
|
9469
|
+
//#endregion
|
|
9454
9470
|
//#region src/render/node/index.ts
|
|
9455
9471
|
/** Render a workflow file without launching or closing the caller's browser. */
|
|
9456
9472
|
async function flowToPng(browser, workflow, options = {}) {
|
|
9457
9473
|
const file = decodeWorkflowFile(workflow);
|
|
9474
|
+
getFlowPngAspectRatio(options.aspectRatio);
|
|
9458
9475
|
const packageRoot = dirname(createRequire(import.meta.url).resolve("@oomol-lab/open-flow/package.json"));
|
|
9459
9476
|
const [script, style] = await Promise.all([readFile(join(packageRoot, "dist/render/browser/runtime.js"), "utf8"), readFile(join(packageRoot, "dist/render/browser/runtime.css"), "utf8")]);
|
|
9460
9477
|
const context = await browser.newContext({
|