Add getSvgAsImage to exports. (#2229)

This PR adds `getSvgAsImage` to the package's exports.

### Change Type

- [x] `minor` — New feature
This commit is contained in:
Steve Ruiz 2023-11-15 18:40:20 +00:00 committed by GitHub
parent c4564dc2be
commit 81f6fae070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 0 deletions

View file

@ -685,6 +685,13 @@ export function getResizedImageDataUrl(dataURLForImage: string, width: number, h
quality?: number | undefined; quality?: number | undefined;
}): Promise<string>; }): Promise<string>;
// @public (undocumented)
export function getSvgAsImage(svg: SVGElement, isSafari: boolean, options: {
type: 'jpeg' | 'png' | 'svg' | 'webp';
quality: number;
scale: number;
}): Promise<Blob | null>;
// @public (undocumented) // @public (undocumented)
function Group({ children, size, }: { function Group({ children, size, }: {
children: any; children: any;

View file

@ -7618,6 +7618,98 @@
], ],
"name": "getResizedImageDataUrl" "name": "getResizedImageDataUrl"
}, },
{
"kind": "Function",
"canonicalReference": "@tldraw/tldraw!getSvgAsImage:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getSvgAsImage(svg: "
},
{
"kind": "Reference",
"text": "SVGElement",
"canonicalReference": "!SVGElement:interface"
},
{
"kind": "Content",
"text": ", isSafari: "
},
{
"kind": "Content",
"text": "boolean"
},
{
"kind": "Content",
"text": ", options: "
},
{
"kind": "Content",
"text": "{\n type: 'jpeg' | 'png' | 'svg' | 'webp';\n quality: number;\n scale: number;\n}"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": " | null>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/tldraw/src/lib/utils/export/export.ts",
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 11
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "svg",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "isSafari",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "options",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
}
],
"name": "getSvgAsImage"
},
{ {
"kind": "Class", "kind": "Class",
"canonicalReference": "@tldraw/tldraw!HandTool:class", "canonicalReference": "@tldraw/tldraw!HandTool:class",

View file

@ -151,6 +151,7 @@ export {
} from './lib/utils/assets/assets' } from './lib/utils/assets/assets'
export { getEmbedInfo } from './lib/utils/embeds/embeds' export { getEmbedInfo } from './lib/utils/embeds/embeds'
export { copyAs } from './lib/utils/export/copyAs' export { copyAs } from './lib/utils/export/copyAs'
export { getSvgAsImage } from './lib/utils/export/export'
export { exportAs } from './lib/utils/export/exportAs' export { exportAs } from './lib/utils/export/exportAs'
export { setDefaultEditorAssetUrls } from './lib/utils/static-assets/assetUrls' export { setDefaultEditorAssetUrls } from './lib/utils/static-assets/assetUrls'
export { truncateStringWithEllipsis } from './lib/utils/text/text' export { truncateStringWithEllipsis } from './lib/utils/text/text'