vibrant-tool 0.1.6 → 0.1.7
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/lib/utils/canvas-setup.d.ts +4 -1
- package/dist/lib/utils/export/export-svg.utils.d.ts +1 -1
- package/dist/lib/utils/export/export-watermark.utils.d.ts +1 -1
- package/dist/lib/utils/fabric-helper.d.ts +3 -3
- package/dist/lib/utils/font-utils.d.ts +2 -0
- package/dist/lib/utils/mockup-generator.d.ts +40 -0
- package/dist/lib/utils/overlay-manager.d.ts +1 -1
- package/dist/lib/utils/shape.utils.d.ts +51 -0
- package/dist/modules/components/color-picker/useColorPanelState.d.ts +2 -2
- package/dist/vibrant-tool.css +0 -8
- package/dist/vibrant-tool.es.js +34974 -34329
- package/dist/vibrant-tool.umd.js +34974 -34329
- package/package.json +1 -1
|
@@ -23,9 +23,10 @@ export interface WorkareaProductOptions {
|
|
|
23
23
|
safetyArea?: number;
|
|
24
24
|
hideGuidelines?: boolean;
|
|
25
25
|
isTextTemplate?: boolean;
|
|
26
|
+
shape?: string;
|
|
26
27
|
optionsMap?: Record<string, string>;
|
|
27
28
|
}
|
|
28
|
-
export declare function createWorkarea(canvas: Canvas, container: HTMLDivElement, productData?: WorkareaProductOptions | null): Rect<{
|
|
29
|
+
export declare function createWorkarea(canvas: Canvas, container: HTMLDivElement, productData?: WorkareaProductOptions | null, pageSide?: string): Rect<{
|
|
29
30
|
width: number;
|
|
30
31
|
height: number;
|
|
31
32
|
fill: string;
|
|
@@ -34,4 +35,6 @@ export declare function createWorkarea(canvas: Canvas, container: HTMLDivElement
|
|
|
34
35
|
name: string;
|
|
35
36
|
scaleX: number;
|
|
36
37
|
scaleY: number;
|
|
38
|
+
rx: number;
|
|
39
|
+
ry: number;
|
|
37
40
|
}, import('fabric').SerializedRectProps, import('fabric').ObjectEvents>;
|
|
@@ -2,7 +2,7 @@ import { Canvas, Rect } from 'fabric';
|
|
|
2
2
|
/**
|
|
3
3
|
* Captures the workarea bounds from a Fabric canvas as a standalone SVG string
|
|
4
4
|
*/
|
|
5
|
-
export declare function captureWorkareaSVG(canvas: Canvas, workarea?: Rect): string | null;
|
|
5
|
+
export declare function captureWorkareaSVG(canvas: Canvas, workarea?: Rect, pageSide?: string): string | null;
|
|
6
6
|
/**
|
|
7
7
|
* Embeds external images into the SVG string as base64 data URIs
|
|
8
8
|
*/
|
|
@@ -3,4 +3,4 @@ export declare const WATERMARK_TEXT = "vibrantprintshop";
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a calibrated watermark text object for canvas export
|
|
5
5
|
*/
|
|
6
|
-
export declare function createWatermark(curWorkarea: Rect): IText;
|
|
6
|
+
export declare function createWatermark(curWorkarea: Rect, pageSide?: string): IText;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Canvas } from 'fabric';
|
|
2
|
-
export declare function loadPageToCanvas(canvas: Canvas, json: any): Promise<void>;
|
|
3
|
-
export declare function getWorkareaDataUrl(cvs: Canvas, multiplier?: number): string;
|
|
4
|
-
export declare function renderPageDataUrl(json: any, baseCanvas: Canvas, multiplier?: number): Promise<string>;
|
|
2
|
+
export declare function loadPageToCanvas(canvas: Canvas, json: any, pageSide?: string): Promise<void>;
|
|
3
|
+
export declare function getWorkareaDataUrl(cvs: Canvas, multiplier?: number, pageSide?: string): string;
|
|
4
|
+
export declare function renderPageDataUrl(json: any, baseCanvas: Canvas, multiplier?: number, targetSide?: string): Promise<string>;
|
|
@@ -7,9 +7,40 @@ export interface CardQuad {
|
|
|
7
7
|
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
8
8
|
lightingAngle?: number;
|
|
9
9
|
}
|
|
10
|
+
export declare const HORIZONTAL_MOCKUP_CONFIG: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
defaultBgUrl: string;
|
|
14
|
+
foregroundCard: {
|
|
15
|
+
name: string;
|
|
16
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
17
|
+
lightingAngle: number;
|
|
18
|
+
};
|
|
19
|
+
stackTopCard: {
|
|
20
|
+
name: string;
|
|
21
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
22
|
+
lightingAngle: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const VERTICAL_MOCKUP_CONFIG: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
defaultBgUrl: string;
|
|
29
|
+
foregroundCard: {
|
|
30
|
+
name: string;
|
|
31
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
32
|
+
lightingAngle: number;
|
|
33
|
+
};
|
|
34
|
+
stackTopCard: {
|
|
35
|
+
name: string;
|
|
36
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
37
|
+
lightingAngle: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
10
40
|
export declare const DEFAULT_MOCKUP_CONFIG: {
|
|
11
41
|
width: number;
|
|
12
42
|
height: number;
|
|
43
|
+
defaultBgUrl: string;
|
|
13
44
|
foregroundCard: {
|
|
14
45
|
name: string;
|
|
15
46
|
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
@@ -21,6 +52,14 @@ export declare const DEFAULT_MOCKUP_CONFIG: {
|
|
|
21
52
|
lightingAngle: number;
|
|
22
53
|
};
|
|
23
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* Rotates an image or canvas 180 degrees
|
|
57
|
+
*/
|
|
58
|
+
export declare function rotateImage180(img: HTMLImageElement | HTMLCanvasElement): HTMLCanvasElement;
|
|
59
|
+
/**
|
|
60
|
+
* Rotates an image or canvas 90 degrees clockwise
|
|
61
|
+
*/
|
|
62
|
+
export declare function rotateImage90(img: HTMLImageElement | HTMLCanvasElement): HTMLCanvasElement;
|
|
24
63
|
/**
|
|
25
64
|
* Draws a perspective-warped image onto canvas using triangle subdivision
|
|
26
65
|
*/
|
|
@@ -36,6 +75,7 @@ export interface GenerateMockupOptions {
|
|
|
36
75
|
swapSides?: boolean;
|
|
37
76
|
scale?: number;
|
|
38
77
|
bgUrl?: string;
|
|
78
|
+
orientation?: "horizontal" | "vertical";
|
|
39
79
|
}
|
|
40
80
|
/**
|
|
41
81
|
* Generates the full dynamic composite mockup onto an HTMLCanvasElement
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Canvas, Rect } from 'fabric';
|
|
2
|
-
export declare function createOverlays(canvas: Canvas, workarea: Rect): void;
|
|
2
|
+
export declare function createOverlays(canvas: Canvas, workarea: Rect, pageSide?: string): void;
|
|
3
3
|
export declare function bringOverlaysToFront(canvas: Canvas): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FabricObject } from 'fabric';
|
|
2
|
+
export type ProductShapeType = "standard" | "rounded" | "circle" | "oval" | "leaf" | "folded" | "die-cut";
|
|
3
|
+
export interface ShapeRadiusResult {
|
|
4
|
+
rx: number;
|
|
5
|
+
ry: number;
|
|
6
|
+
radiusOfCanvas: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ShapeBounds {
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
rx?: number;
|
|
14
|
+
ry?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface GuidelineInsets {
|
|
17
|
+
bleedX: number;
|
|
18
|
+
bleedY: number;
|
|
19
|
+
safeX: number;
|
|
20
|
+
safeY: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Normalizes any raw product shape name into a standardized ProductShapeType
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectShape(rawShape?: string): ProductShapeType;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates rx, ry and base radius based on shape type and dimensions
|
|
28
|
+
*/
|
|
29
|
+
export declare function calculateShapeRadius(shape: ProductShapeType, width: number, height: number, isVertical?: boolean): ShapeRadiusResult;
|
|
30
|
+
/**
|
|
31
|
+
* Generates leaf SVG path string based on page side:
|
|
32
|
+
* - Front side: Top-Left & Bottom-Right rounded
|
|
33
|
+
* - Back side: Top-Right & Bottom-Left rounded (opposite)
|
|
34
|
+
*/
|
|
35
|
+
export declare function getLeafPathString(x: number, y: number, w: number, h: number, r: number, isBackSide?: boolean): string;
|
|
36
|
+
/**
|
|
37
|
+
* Creates corner overlay masks for canvas editor to hide bleed outside shapes
|
|
38
|
+
*/
|
|
39
|
+
export declare function createShapeCornerOverlays(shape: ProductShapeType, bounds: ShapeBounds, pageSide?: string, overlayColor?: string): FabricObject[];
|
|
40
|
+
/**
|
|
41
|
+
* Creates shape-specific guidelines (Trim, Safe, and Fold score lines)
|
|
42
|
+
*/
|
|
43
|
+
export declare function createShapeGuidelines(shape: ProductShapeType, bounds: ShapeBounds, insets: GuidelineInsets, pageSide?: string): FabricObject[];
|
|
44
|
+
/**
|
|
45
|
+
* Generates vector SVG <clipPath> content (used for Vector SVG and Vector PDF exports)
|
|
46
|
+
*/
|
|
47
|
+
export declare function getShapeSvgClipContent(shape: ProductShapeType, bounds: ShapeBounds, pageSide?: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Creates Fabric clip object for canvas export
|
|
50
|
+
*/
|
|
51
|
+
export declare function createShapeExportClip(shape: ProductShapeType, bounds: ShapeBounds, pageSide?: string): FabricObject | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const DEFAULT_PRESET_COLORS: string[];
|
|
2
2
|
export declare function useColorPanelState(): {
|
|
3
|
-
fillMode: "
|
|
4
|
-
setFillMode: import('react').Dispatch<import('react').SetStateAction<"
|
|
3
|
+
fillMode: "solid" | "gradient";
|
|
4
|
+
setFillMode: import('react').Dispatch<import('react').SetStateAction<"solid" | "gradient">>;
|
|
5
5
|
activeSelectedColor: string;
|
|
6
6
|
handleSwatchClick: (hex: string) => void;
|
|
7
7
|
documentColors: string[];
|
package/dist/vibrant-tool.css
CHANGED
|
@@ -2017,10 +2017,6 @@
|
|
|
2017
2017
|
object-fit: cover;
|
|
2018
2018
|
}
|
|
2019
2019
|
|
|
2020
|
-
.object-fill {
|
|
2021
|
-
object-fit: fill;
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
2020
|
.p-0\.5 {
|
|
2025
2021
|
padding: calc(var(--spacing) * .5);
|
|
2026
2022
|
}
|
|
@@ -2517,10 +2513,6 @@
|
|
|
2517
2513
|
mix-blend-mode: difference;
|
|
2518
2514
|
}
|
|
2519
2515
|
|
|
2520
|
-
.mix-blend-overlay {
|
|
2521
|
-
mix-blend-mode: overlay;
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
2516
|
.shadow {
|
|
2525
2517
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, #0000001a), 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
|
|
2526
2518
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|