@overtone-art/canvas-editor-core 0.2.6 → 0.2.8
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/LICENSE +21 -0
- package/dist/chunk-ORZZ6MGQ.mjs +228 -0
- package/dist/chunk-ORZZ6MGQ.mjs.map +1 -0
- package/dist/index.d.mts +297 -225
- package/dist/index.d.ts +297 -225
- package/dist/index.global.js +506 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +1719 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1501 -94
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +86 -0
- package/dist/node.d.ts +86 -0
- package/dist/node.js +814 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +675 -0
- package/dist/node.mjs.map +1 -0
- package/dist/types-D60CfxL9.d.mts +461 -0
- package/dist/types-D60CfxL9.d.ts +461 -0
- package/package.json +49 -2
package/dist/node.d.mts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { c as EditorState } from './types-D60CfxL9.mjs';
|
|
2
|
+
import 'fabric';
|
|
3
|
+
|
|
4
|
+
interface PrintPdfOptions {
|
|
5
|
+
/** Rasterization density. Defaults to the document DPI, or 300. */
|
|
6
|
+
dpi?: number;
|
|
7
|
+
/** Bleed on every edge, in inches. Defaults to 0.125in. */
|
|
8
|
+
bleed?: number;
|
|
9
|
+
/** Space outside bleed reserved for printer marks, in inches. Defaults to 0.25in. */
|
|
10
|
+
marksMargin?: number;
|
|
11
|
+
trimMarks?: boolean;
|
|
12
|
+
registrationMarks?: boolean;
|
|
13
|
+
/** Optional safe-area inset in inches for preflight warnings. */
|
|
14
|
+
safeArea?: number;
|
|
15
|
+
/** Sharp built-in `cmyk` profile or an absolute path to a custom ICC profile. */
|
|
16
|
+
iccProfile?: string;
|
|
17
|
+
/** Ceiling on the rasterized bleed image, in pixels. Defaults to 250 megapixels. */
|
|
18
|
+
maxPixels?: number;
|
|
19
|
+
outputConditionIdentifier?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
allowImageUrl?: NodeRenderOptions['allowImageUrl'];
|
|
22
|
+
/** Preserve SVG shapes/text over a CMYK bleed raster. Defaults to `vector`. */
|
|
23
|
+
rendering?: 'vector' | 'raster';
|
|
24
|
+
/** PDFKit font registrations keyed by the exact SVG font-family name. */
|
|
25
|
+
fontFiles?: Record<string, string | Uint8Array>;
|
|
26
|
+
/** Convert text backed by `fontFiles` into glyph paths. Defaults to true. */
|
|
27
|
+
outlineFonts?: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface PrintPdfResult {
|
|
30
|
+
format: 'pdf';
|
|
31
|
+
mimeType: 'application/pdf';
|
|
32
|
+
data: Uint8Array;
|
|
33
|
+
standard: 'PDF/X-4';
|
|
34
|
+
colourSpace: 'CMYK';
|
|
35
|
+
rendering: 'vector' | 'raster';
|
|
36
|
+
outlinedFonts: string[];
|
|
37
|
+
unoutlinedFonts: string[];
|
|
38
|
+
dpi: number;
|
|
39
|
+
trimWidthPoints: number;
|
|
40
|
+
trimHeightPoints: number;
|
|
41
|
+
bleedPoints: number;
|
|
42
|
+
warnings: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Render an EditorState into a print-production PDF/X-4 file.
|
|
46
|
+
*
|
|
47
|
+
* The design is rasterized at the requested density, converted through Sharp's
|
|
48
|
+
* CMYK ICC pipeline, edge-extended into bleed, and embedded with output intent,
|
|
49
|
+
* trim/bleed boxes, XMP identification, and optional printer marks.
|
|
50
|
+
*/
|
|
51
|
+
declare function renderPrintPdf(state: EditorState, options?: PrintPdfOptions): Promise<PrintPdfResult>;
|
|
52
|
+
|
|
53
|
+
interface NodeRenderOptions {
|
|
54
|
+
format?: 'png' | 'jpeg' | 'webp' | 'svg';
|
|
55
|
+
multiplier?: number;
|
|
56
|
+
quality?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Gate every image URL referenced by the state before it is loaded. States
|
|
59
|
+
* are authored in the browser and therefore untrusted on a server; the
|
|
60
|
+
* default policy allows only `http:`, `https:` and `data:`. Supply a
|
|
61
|
+
* narrower predicate (e.g. an origin allowlist) to also stop requests to
|
|
62
|
+
* internal hosts.
|
|
63
|
+
*/
|
|
64
|
+
allowImageUrl?: (url: string) => boolean;
|
|
65
|
+
}
|
|
66
|
+
interface NodeRenderResult {
|
|
67
|
+
format: 'png' | 'jpeg' | 'webp' | 'svg';
|
|
68
|
+
mimeType: string;
|
|
69
|
+
data: Uint8Array | string;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
}
|
|
73
|
+
/** Render browser-authored EditorState without a DOM or live editor instance. */
|
|
74
|
+
declare function renderEditorState(state: EditorState, options?: NodeRenderOptions): Promise<NodeRenderResult>;
|
|
75
|
+
/** Render a saved product mockup with the transparent design composited above it. */
|
|
76
|
+
declare function renderMockupState(state: EditorState, options?: NodeRenderOptions): Promise<NodeRenderResult>;
|
|
77
|
+
/** Render multiple states with bounded concurrency for fulfillment jobs. */
|
|
78
|
+
declare function renderEditorStateBatch(states: EditorState[], options?: NodeRenderOptions & {
|
|
79
|
+
concurrency?: number;
|
|
80
|
+
}): Promise<NodeRenderResult[]>;
|
|
81
|
+
/** Render multiple mockup states with bounded concurrency for fulfillment jobs. */
|
|
82
|
+
declare function renderMockupStateBatch(states: EditorState[], options?: NodeRenderOptions & {
|
|
83
|
+
concurrency?: number;
|
|
84
|
+
}): Promise<NodeRenderResult[]>;
|
|
85
|
+
|
|
86
|
+
export { type NodeRenderOptions, type NodeRenderResult, type PrintPdfOptions, type PrintPdfResult, renderEditorState, renderEditorStateBatch, renderMockupState, renderMockupStateBatch, renderPrintPdf };
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { c as EditorState } from './types-D60CfxL9.js';
|
|
2
|
+
import 'fabric';
|
|
3
|
+
|
|
4
|
+
interface PrintPdfOptions {
|
|
5
|
+
/** Rasterization density. Defaults to the document DPI, or 300. */
|
|
6
|
+
dpi?: number;
|
|
7
|
+
/** Bleed on every edge, in inches. Defaults to 0.125in. */
|
|
8
|
+
bleed?: number;
|
|
9
|
+
/** Space outside bleed reserved for printer marks, in inches. Defaults to 0.25in. */
|
|
10
|
+
marksMargin?: number;
|
|
11
|
+
trimMarks?: boolean;
|
|
12
|
+
registrationMarks?: boolean;
|
|
13
|
+
/** Optional safe-area inset in inches for preflight warnings. */
|
|
14
|
+
safeArea?: number;
|
|
15
|
+
/** Sharp built-in `cmyk` profile or an absolute path to a custom ICC profile. */
|
|
16
|
+
iccProfile?: string;
|
|
17
|
+
/** Ceiling on the rasterized bleed image, in pixels. Defaults to 250 megapixels. */
|
|
18
|
+
maxPixels?: number;
|
|
19
|
+
outputConditionIdentifier?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
allowImageUrl?: NodeRenderOptions['allowImageUrl'];
|
|
22
|
+
/** Preserve SVG shapes/text over a CMYK bleed raster. Defaults to `vector`. */
|
|
23
|
+
rendering?: 'vector' | 'raster';
|
|
24
|
+
/** PDFKit font registrations keyed by the exact SVG font-family name. */
|
|
25
|
+
fontFiles?: Record<string, string | Uint8Array>;
|
|
26
|
+
/** Convert text backed by `fontFiles` into glyph paths. Defaults to true. */
|
|
27
|
+
outlineFonts?: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface PrintPdfResult {
|
|
30
|
+
format: 'pdf';
|
|
31
|
+
mimeType: 'application/pdf';
|
|
32
|
+
data: Uint8Array;
|
|
33
|
+
standard: 'PDF/X-4';
|
|
34
|
+
colourSpace: 'CMYK';
|
|
35
|
+
rendering: 'vector' | 'raster';
|
|
36
|
+
outlinedFonts: string[];
|
|
37
|
+
unoutlinedFonts: string[];
|
|
38
|
+
dpi: number;
|
|
39
|
+
trimWidthPoints: number;
|
|
40
|
+
trimHeightPoints: number;
|
|
41
|
+
bleedPoints: number;
|
|
42
|
+
warnings: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Render an EditorState into a print-production PDF/X-4 file.
|
|
46
|
+
*
|
|
47
|
+
* The design is rasterized at the requested density, converted through Sharp's
|
|
48
|
+
* CMYK ICC pipeline, edge-extended into bleed, and embedded with output intent,
|
|
49
|
+
* trim/bleed boxes, XMP identification, and optional printer marks.
|
|
50
|
+
*/
|
|
51
|
+
declare function renderPrintPdf(state: EditorState, options?: PrintPdfOptions): Promise<PrintPdfResult>;
|
|
52
|
+
|
|
53
|
+
interface NodeRenderOptions {
|
|
54
|
+
format?: 'png' | 'jpeg' | 'webp' | 'svg';
|
|
55
|
+
multiplier?: number;
|
|
56
|
+
quality?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Gate every image URL referenced by the state before it is loaded. States
|
|
59
|
+
* are authored in the browser and therefore untrusted on a server; the
|
|
60
|
+
* default policy allows only `http:`, `https:` and `data:`. Supply a
|
|
61
|
+
* narrower predicate (e.g. an origin allowlist) to also stop requests to
|
|
62
|
+
* internal hosts.
|
|
63
|
+
*/
|
|
64
|
+
allowImageUrl?: (url: string) => boolean;
|
|
65
|
+
}
|
|
66
|
+
interface NodeRenderResult {
|
|
67
|
+
format: 'png' | 'jpeg' | 'webp' | 'svg';
|
|
68
|
+
mimeType: string;
|
|
69
|
+
data: Uint8Array | string;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
}
|
|
73
|
+
/** Render browser-authored EditorState without a DOM or live editor instance. */
|
|
74
|
+
declare function renderEditorState(state: EditorState, options?: NodeRenderOptions): Promise<NodeRenderResult>;
|
|
75
|
+
/** Render a saved product mockup with the transparent design composited above it. */
|
|
76
|
+
declare function renderMockupState(state: EditorState, options?: NodeRenderOptions): Promise<NodeRenderResult>;
|
|
77
|
+
/** Render multiple states with bounded concurrency for fulfillment jobs. */
|
|
78
|
+
declare function renderEditorStateBatch(states: EditorState[], options?: NodeRenderOptions & {
|
|
79
|
+
concurrency?: number;
|
|
80
|
+
}): Promise<NodeRenderResult[]>;
|
|
81
|
+
/** Render multiple mockup states with bounded concurrency for fulfillment jobs. */
|
|
82
|
+
declare function renderMockupStateBatch(states: EditorState[], options?: NodeRenderOptions & {
|
|
83
|
+
concurrency?: number;
|
|
84
|
+
}): Promise<NodeRenderResult[]>;
|
|
85
|
+
|
|
86
|
+
export { type NodeRenderOptions, type NodeRenderResult, type PrintPdfOptions, type PrintPdfResult, renderEditorState, renderEditorStateBatch, renderMockupState, renderMockupStateBatch, renderPrintPdf };
|