@weasel-js/headless 1.15.1 → 1.16.0
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.
|
@@ -11,5 +11,5 @@ function sceneFromWire(wire) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { PAGE_GLOBAL, sceneFromWire, sceneToWire };
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-CY2CTAFF.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-CY2CTAFF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/protocol.ts"],"names":[],"mappings":";;;AAKO,IAAM,WAAA,GAAc;AAsCpB,SAAS,YAAY,KAAA,EAAuB;AACjD,EAAA,MAAM,SAAU,KAAA,CAA+B,MAAA;AAC/C,EAAA,OAAO,cAAA,CAAe,OAAO,MAAA,KAAW,UAAA,GAAa,OAAO,IAAA,CAAK,KAAK,IAAI,KAAK,CAAA;AACjF;AAGO,SAAS,cAAc,IAAA,EAAsB;AAClD,EAAA,OAAO,kBAAkB,IAAI,CAAA;AAC/B","file":"chunk-CY2CTAFF.js","sourcesContent":["// What crosses between Node and the page: JSON only, so pixels travel as base64. Typed here rather\n// than from core, whose types reach React and the DOM, neither of which a Node caller has.\nimport { reviveTypedArrays, tagTypedArrays } from '@weasel-js/geom';\n\n/** The page script's global, set once the script has run. */\nexport const PAGE_GLOBAL = '__weaselHeadless';\n\n/** `renderSceneToPixels`'s arguments that survive JSON: no `drawOne`, `resolveImage`, `alphaFor`,\n * `colorOverrides` or `trimOverrides`. Each means what it means there. */\nexport interface SerializableRenderArgs {\n /** Scene-space rect to render. */\n sourceRect: { x: number; y: number; width: number; height: number };\n /** Output pixels per scene unit, per axis. */\n scale: { x: number; y: number };\n /** Background fill, any CSS color. Default: transparent. */\n background?: string;\n /** Max curve-flattening error in output pixels. Default 0.25. */\n flattenTolerancePx?: number;\n /** Draw commands over the scene in output-pixel space, as `renderSceneToPixels` takes them. */\n overlay?: readonly object[];\n /** Draw the scene's annotation layers. Default `false`. */\n annotations?: boolean;\n}\n\nexport interface PageRequest extends SerializableRenderArgs {\n /** A `scene.toJSON()` snapshot. */\n scene: object;\n screen?: readonly number[];\n format: 'rgba' | 'png';\n}\n\nexport interface PageResult {\n width: number;\n height: number;\n base64: string;\n}\n\nexport interface PageApi {\n render(req: PageRequest): Promise<PageResult>;\n}\n\n/** A live scene or its snapshot, as JSON carries it: a path's typed arrays tagged, as\n * `tagTypedArrays` writes them. A snapshot already saved that way passes through unchanged. */\nexport function sceneToWire(scene: object): object {\n const toJSON = (scene as { toJSON?: unknown }).toJSON;\n return tagTypedArrays(typeof toJSON === 'function' ? toJSON.call(scene) : scene) as object;\n}\n\n/** The snapshot `sceneToWire` sent, its typed arrays restored. */\nexport function sceneFromWire(wire: object): object {\n return reviveTypedArrays(wire) as object;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Browser, LaunchOptions } from 'playwright-core';
|
|
2
2
|
|
|
3
|
-
/** `renderSceneToPixels`'s arguments that survive JSON: no `drawOne`, `resolveImage`, `alphaFor
|
|
4
|
-
* or `
|
|
3
|
+
/** `renderSceneToPixels`'s arguments that survive JSON: no `drawOne`, `resolveImage`, `alphaFor`,
|
|
4
|
+
* `colorOverrides` or `trimOverrides`. Each means what it means there. */
|
|
5
5
|
interface SerializableRenderArgs {
|
|
6
6
|
/** Scene-space rect to render. */
|
|
7
7
|
sourceRect: {
|
package/dist/index.js
CHANGED