@triagly/sdk 1.4.0-beta.4 → 1.4.0-beta.5
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/screenshot.d.ts +42 -0
- package/dist/screenshot.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ScreenshotConfig } from './types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
html2canvas?: (element: HTMLElement, options?: Record<string, unknown>) => Promise<HTMLCanvasElement>;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export declare class ScreenshotCapture {
|
|
8
|
+
private quality;
|
|
9
|
+
private maxWidth;
|
|
10
|
+
private options;
|
|
11
|
+
private html2canvasLoaded;
|
|
12
|
+
private loadPromise;
|
|
13
|
+
private customCdnUrl;
|
|
14
|
+
constructor(config?: ScreenshotConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Dynamically load html2canvas from CDN with fallbacks
|
|
17
|
+
* Returns true if loaded successfully, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
loadHtml2Canvas(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Try loading html2canvas from multiple CDN URLs
|
|
22
|
+
*/
|
|
23
|
+
private tryLoadFromCdns;
|
|
24
|
+
/**
|
|
25
|
+
* Load a script from a specific URL
|
|
26
|
+
*/
|
|
27
|
+
private loadScriptFromUrl;
|
|
28
|
+
/**
|
|
29
|
+
* Capture screenshot of the current page
|
|
30
|
+
* Returns base64 data URL of the screenshot
|
|
31
|
+
*/
|
|
32
|
+
capture(): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Resize canvas if it exceeds maxWidth
|
|
35
|
+
*/
|
|
36
|
+
private resizeCanvas;
|
|
37
|
+
/**
|
|
38
|
+
* Get approximate file size of a data URL in bytes
|
|
39
|
+
*/
|
|
40
|
+
static getDataUrlSize(dataUrl: string): number;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=screenshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../src/screenshot.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAS3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;KACvG;CACF;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,YAAY,CAAqB;gBAE7B,MAAM,GAAE,gBAAqB;IAOzC;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IA4BzC;;OAEG;YACW,eAAe;IAa7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAgDhC;;OAEG;IACH,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAM/C"}
|
package/package.json
CHANGED