vibrant-tool 0.1.5 → 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/services/template-design.service.d.ts +2 -0
- package/dist/lib/types/shape.types.d.ts +1 -0
- package/dist/lib/utils/background-utils.d.ts +1 -1
- package/dist/lib/utils/canvas-setup.d.ts +4 -1
- package/dist/lib/utils/color-apply.utils.d.ts +4 -0
- package/dist/lib/utils/downloadCanvas.d.ts +3 -0
- package/dist/lib/utils/export/export-download.utils.d.ts +2 -0
- package/dist/lib/utils/export/export-pdf.utils.d.ts +27 -0
- package/dist/lib/utils/export/export-svg.utils.d.ts +9 -0
- package/dist/lib/utils/export/export-watermark.utils.d.ts +6 -0
- package/dist/lib/utils/fabric-helper.d.ts +3 -3
- package/dist/lib/utils/font-utils.d.ts +27 -0
- package/dist/lib/utils/mockup-generator.d.ts +87 -0
- package/dist/lib/utils/navigation-utils.d.ts +5 -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/AlphaSlider.d.ts +9 -0
- package/dist/modules/components/color-picker/BrandPalettesSection.d.ts +9 -0
- package/dist/modules/components/color-picker/CMYKColorPicker.d.ts +9 -0
- package/dist/modules/components/color-picker/CMYKPopoverContent.d.ts +24 -0
- package/dist/modules/components/color-picker/CustomColorCard.d.ts +19 -0
- package/dist/modules/components/color-picker/DocumentColorsSection.d.ts +7 -0
- package/dist/modules/components/color-picker/GradientColorCard.d.ts +33 -0
- package/dist/modules/components/color-picker/HueSlider.d.ts +10 -0
- package/dist/modules/components/color-picker/ObjectColorsSection.d.ts +7 -0
- package/dist/modules/components/color-picker/PresetColorsSection.d.ts +7 -0
- package/dist/modules/components/color-picker/SVBox.d.ts +10 -0
- package/dist/modules/components/color-picker/index.d.ts +21 -8
- package/dist/modules/components/color-picker/useCMYKPickerState.d.ts +53 -0
- package/dist/modules/components/color-picker/useColorPanelState.d.ts +64 -0
- package/dist/modules/components/color-picker/useGradientState.d.ts +42 -0
- package/dist/modules/components/color-picker/usePaletteData.d.ts +7 -0
- package/dist/modules/components/color-picker/useSolidColorState.d.ts +20 -0
- package/dist/modules/topbar/template-mockup-modal.d.ts +7 -0
- package/dist/vibrant-tool.css +336 -23
- package/dist/vibrant-tool.es.js +3758 -1501
- package/dist/vibrant-tool.umd.js +3758 -1501
- package/dist/zustand/editorStore.d.ts +2 -0
- package/dist/zustand/loaderStore.d.ts +3 -2
- package/package.json +1 -1
|
@@ -11,10 +11,12 @@ export interface TemplateDesignItem {
|
|
|
11
11
|
pages: TemplatePage[];
|
|
12
12
|
designs?: any[];
|
|
13
13
|
image?: string;
|
|
14
|
+
mockup?: any;
|
|
14
15
|
product?: string | any;
|
|
15
16
|
category?: string | any;
|
|
16
17
|
colors?: string[];
|
|
17
18
|
industries?: string[];
|
|
19
|
+
fonts?: any[];
|
|
18
20
|
status?: boolean;
|
|
19
21
|
}
|
|
20
22
|
export interface TemplateDesignResponse {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FabricImage, FabricObject } from 'fabric';
|
|
2
2
|
export declare const isImage: (obj: FabricObject) => obj is FabricImage;
|
|
3
3
|
export declare function addBackgroundImage(url: string): Promise<void>;
|
|
4
|
-
export declare function addBackgroundColor(color: string): Promise<void>;
|
|
4
|
+
export declare function addBackgroundColor(color: string | any): Promise<void>;
|
|
@@ -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>;
|
|
@@ -21,3 +21,7 @@ export declare function extractTargetColor(targets: any[]): {
|
|
|
21
21
|
* If targetOldColor is specified, only occurrences of that color are replaced.
|
|
22
22
|
*/
|
|
23
23
|
export declare function applyFillToFabricObjects(objects: any[], newColor: string, alpha: number, targetOldColor: string | null | undefined, canvas: any, cmykValues?: CMYKColor): void;
|
|
24
|
+
/**
|
|
25
|
+
* Applies a Fabric Gradient to selected Fabric objects.
|
|
26
|
+
*/
|
|
27
|
+
export declare function applyGradientToFabricObjects(objects: any[], gradient: any, canvas: any): void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Canvas } from 'fabric';
|
|
2
|
+
/**
|
|
3
|
+
* Main Canvas Export function for PNG, JPEG, SVG, PDF and JSON
|
|
4
|
+
*/
|
|
2
5
|
export declare function downloadCanvasWorkarea(canvas: Canvas, type: "png" | "jpeg" | "pdf" | "svg" | "json", scale?: number, pages?: Record<string, {
|
|
3
6
|
history: any[];
|
|
4
7
|
}>, currentPageSide?: string, dpi?: number): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers custom fonts into pdfMake.vfs (base64) + pdfMake.fonts
|
|
3
|
+
* AND writes to pdfMake.virtualfs (pdfMake 0.3.x) so createPdf finds them.
|
|
4
|
+
*
|
|
5
|
+
* Follows the old pattern:
|
|
6
|
+
* pdfMakevfs[fontName] = dataUrl.split(",")[1]
|
|
7
|
+
* pdfMakefonts[fontName] = { normal: fontName, bold: fontName, ... }
|
|
8
|
+
* pdfMake.vfs = pdfMakevfs
|
|
9
|
+
* pdfMake.fonts = pdfMakefonts
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerFontsInPdfMake(fontList: Array<{
|
|
12
|
+
fontName: string;
|
|
13
|
+
fontFile: string;
|
|
14
|
+
fontFamily?: string;
|
|
15
|
+
}>): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Cleans SVG font-family values so they match the keys registered in pdfMake.fonts
|
|
18
|
+
*/
|
|
19
|
+
export declare function sanitizeSvgForPdf(svg: string): string;
|
|
20
|
+
export interface VectorPDFPage {
|
|
21
|
+
svg?: string;
|
|
22
|
+
image?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Compiles and downloads a multi-page true vector/raster PDF with DeviceCMYK color profiling
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateAndDownloadPDF(pages: VectorPDFPage[], width: number, height: number, filename?: string): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Canvas, Rect } from 'fabric';
|
|
2
|
+
/**
|
|
3
|
+
* Captures the workarea bounds from a Fabric canvas as a standalone SVG string
|
|
4
|
+
*/
|
|
5
|
+
export declare function captureWorkareaSVG(canvas: Canvas, workarea?: Rect, pageSide?: string): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Embeds external images into the SVG string as base64 data URIs
|
|
8
|
+
*/
|
|
9
|
+
export declare function processSVGWithEmbeds(svg: string): Promise<string>;
|
|
@@ -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>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FontItem } from '../types/font.types';
|
|
2
|
+
export declare function fetchAllFontsCached(): Promise<FontItem[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Injects a @font-face rule into document.head and ensures the browser loads it
|
|
5
|
+
*/
|
|
6
|
+
export declare function injectFontFace(fontName: string, fontUrl: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Loads all fonts from a template (populated fonts array and/or page design JSONs) into document.head
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadTemplateFontsIntoHead(templateFonts?: any[] | null, pagesDesignData?: any[] | any): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Recursively extracts all unique font families from Fabric JSON or canvas objects
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractFontFamilies(designJson: any): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Resolves font family names/strings from both canvas sides to MongoDB Font ObjectIds
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveFontIds(fontNames: string[]): Promise<string[]>;
|
|
19
|
+
export interface ExportFontItem {
|
|
20
|
+
fontName: string;
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
fontFile: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolves font items (with fontFile URLs) for PDF export from design JSONs and templateFonts
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveFontsForExport(designs: any[], templateFonts?: any[] | null): Promise<ExportFontItem[]>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface Point2D {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface CardQuad {
|
|
6
|
+
name: string;
|
|
7
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
8
|
+
lightingAngle?: number;
|
|
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
|
+
};
|
|
40
|
+
export declare const DEFAULT_MOCKUP_CONFIG: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
defaultBgUrl: string;
|
|
44
|
+
foregroundCard: {
|
|
45
|
+
name: string;
|
|
46
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
47
|
+
lightingAngle: number;
|
|
48
|
+
};
|
|
49
|
+
stackTopCard: {
|
|
50
|
+
name: string;
|
|
51
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
52
|
+
lightingAngle: number;
|
|
53
|
+
};
|
|
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;
|
|
63
|
+
/**
|
|
64
|
+
* Draws a perspective-warped image onto canvas using triangle subdivision
|
|
65
|
+
*/
|
|
66
|
+
export declare function drawPerspectiveWarp(ctx: CanvasRenderingContext2D, img: HTMLImageElement | HTMLCanvasElement, dstCorners: [Point2D, Point2D, Point2D, Point2D], gridDivisions?: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Loads an image from URL/dataURL
|
|
69
|
+
*/
|
|
70
|
+
export declare function loadImage(src: string): Promise<HTMLImageElement>;
|
|
71
|
+
export interface GenerateMockupOptions {
|
|
72
|
+
frontUrl: string;
|
|
73
|
+
backUrl?: string;
|
|
74
|
+
isTwoSided?: boolean;
|
|
75
|
+
swapSides?: boolean;
|
|
76
|
+
scale?: number;
|
|
77
|
+
bgUrl?: string;
|
|
78
|
+
orientation?: "horizontal" | "vertical";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Generates the full dynamic composite mockup onto an HTMLCanvasElement
|
|
82
|
+
*/
|
|
83
|
+
export declare function renderCompositeMockup(targetCanvas: HTMLCanvasElement, options: GenerateMockupOptions): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the final composite mockup rendered to a base64 PNG data URL
|
|
86
|
+
*/
|
|
87
|
+
export declare function generateMockupDataUrl(options: GenerateMockupOptions): Promise<string>;
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface AlphaSliderProps {
|
|
2
|
+
alpha: number;
|
|
3
|
+
color: string;
|
|
4
|
+
showLabel?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
onAlphaChange: (alpha: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AlphaSlider({ alpha, color, showLabel, className, onAlphaChange, }: AlphaSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColorItem } from '../../../lib/types/color.types';
|
|
2
|
+
interface BrandPalettesSectionProps {
|
|
3
|
+
groupedDbColors: Map<string, ColorItem[]>;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
selectedColor: string;
|
|
6
|
+
onColorClick: (hex: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function BrandPalettesSection({ groupedDbColors, isLoading, selectedColor, onColorClick, }: BrandPalettesSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CMYKColor } from '../../../lib/types/color.types';
|
|
2
|
+
export interface CMYKColorPickerProps {
|
|
3
|
+
value?: string | CMYKColor;
|
|
4
|
+
onChange?: (hexOrCmyk: any, cmyk?: CMYKColor) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
renderTrigger?: (open: () => void, color: string) => React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function CMYKColorPicker({ value, onChange, className, renderTrigger, }?: CMYKColorPickerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export default CMYKColorPicker;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CMYKColor, HSVColor } from '../../../lib/types/color.types';
|
|
2
|
+
interface CMYKPopoverContentProps {
|
|
3
|
+
color: string;
|
|
4
|
+
cmyk: CMYKColor;
|
|
5
|
+
hsv: HSVColor;
|
|
6
|
+
alpha: number;
|
|
7
|
+
mode: "HEX" | "CMYK";
|
|
8
|
+
setMode: (mode: "HEX" | "CMYK") => void;
|
|
9
|
+
copied: boolean;
|
|
10
|
+
recentColors: string[];
|
|
11
|
+
coords: {
|
|
12
|
+
top: number;
|
|
13
|
+
left: number;
|
|
14
|
+
};
|
|
15
|
+
popoverRef: React.RefObject<HTMLDivElement | null>;
|
|
16
|
+
updateFromHsv: (hsv: HSVColor) => void;
|
|
17
|
+
updateFromCmyk: (cmyk: CMYKColor) => void;
|
|
18
|
+
updateFromHex: (hex: string) => void;
|
|
19
|
+
updateAlpha: (alpha: number) => void;
|
|
20
|
+
handleCopy: () => void;
|
|
21
|
+
handleEyeDropper: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function CMYKPopoverContent({ color, cmyk, hsv, alpha, mode, setMode, copied, recentColors, coords, popoverRef, updateFromHsv, updateFromCmyk, updateFromHex, updateAlpha, handleCopy, handleEyeDropper, }: CMYKPopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CMYKColor, HSVColor } from '../../../lib/types/color.types';
|
|
2
|
+
interface CustomColorCardProps {
|
|
3
|
+
currentColor: string;
|
|
4
|
+
currentCmyk: CMYKColor;
|
|
5
|
+
hsv: HSVColor;
|
|
6
|
+
alpha: number;
|
|
7
|
+
colorMode: "HEX" | "CMYK";
|
|
8
|
+
setColorMode: (mode: "HEX" | "CMYK") => void;
|
|
9
|
+
updateFromHsv: (hsv: HSVColor) => void;
|
|
10
|
+
updateFromHex: (hex: string) => void;
|
|
11
|
+
updateFromCmyk: (cmyk: CMYKColor) => void;
|
|
12
|
+
setAlpha: (alpha: number) => void;
|
|
13
|
+
applyColor: (hex: string, cmyk?: CMYKColor, alpha?: number) => void;
|
|
14
|
+
handleCopyHex: () => void;
|
|
15
|
+
copied: boolean;
|
|
16
|
+
handleEyeDropper: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function CustomColorCard({ currentColor, currentCmyk, hsv, alpha, colorMode, setColorMode, updateFromHsv, updateFromHex, updateFromCmyk, setAlpha, applyColor, handleCopyHex, copied, handleEyeDropper, }: CustomColorCardProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface DocumentColorsSectionProps {
|
|
2
|
+
documentColors: string[];
|
|
3
|
+
selectedColor: string;
|
|
4
|
+
onColorClick: (hex: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function DocumentColorsSection({ documentColors, selectedColor, onColorClick, }: DocumentColorsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CMYKColor } from '../../../lib/types/color.types';
|
|
2
|
+
interface GradientColorCardProps {
|
|
3
|
+
gradientType: "linear" | "radial";
|
|
4
|
+
setGradientType: (type: "linear" | "radial") => void;
|
|
5
|
+
gradColorMode: "HEX" | "CMYK";
|
|
6
|
+
setGradColorMode: (mode: "HEX" | "CMYK") => void;
|
|
7
|
+
gradColor1: string;
|
|
8
|
+
setGradColor1: (color: string) => void;
|
|
9
|
+
gradColor2: string;
|
|
10
|
+
setGradColor2: (color: string) => void;
|
|
11
|
+
gradColor1Cmyk: CMYKColor;
|
|
12
|
+
setGradColor1Cmyk: (cmyk: CMYKColor) => void;
|
|
13
|
+
gradColor2Cmyk: CMYKColor;
|
|
14
|
+
setGradColor2Cmyk: (cmyk: CMYKColor) => void;
|
|
15
|
+
activeGradColorSlot: 1 | 2;
|
|
16
|
+
setActiveGradColorSlot: (slot: 1 | 2) => void;
|
|
17
|
+
gradX1: number;
|
|
18
|
+
setGradX1: (val: number) => void;
|
|
19
|
+
gradX2: number;
|
|
20
|
+
setGradX2: (val: number) => void;
|
|
21
|
+
gradY1: number;
|
|
22
|
+
setGradY1: (val: number) => void;
|
|
23
|
+
gradY2: number;
|
|
24
|
+
setGradY2: (val: number) => void;
|
|
25
|
+
gradR1: number;
|
|
26
|
+
setGradR1: (val: number) => void;
|
|
27
|
+
gradR2: number;
|
|
28
|
+
setGradR2: (val: number) => void;
|
|
29
|
+
applyGradient: (params?: any) => void;
|
|
30
|
+
updateGradCmyk: (key: keyof CMYKColor, val: number) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function GradientColorCard({ gradientType, setGradientType, gradColorMode, setGradColorMode, gradColor1, setGradColor1, gradColor2, setGradColor2, gradColor1Cmyk, setGradColor1Cmyk, gradColor2Cmyk, setGradColor2Cmyk, activeGradColorSlot, setActiveGradColorSlot, gradX1, setGradX1, gradX2, setGradX2, gradY1, setGradY1, gradY2, setGradY2, gradR1, setGradR1, gradR2, setGradR2, applyGradient, updateGradCmyk, }: GradientColorCardProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HSVColor } from '../../../lib/types/color.types';
|
|
2
|
+
interface HueSliderProps {
|
|
3
|
+
hsv: HSVColor;
|
|
4
|
+
hueColor: string;
|
|
5
|
+
showLabel?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
onHueChange: (hsv: HSVColor) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function HueSlider({ hsv, hueColor, showLabel, className, onHueChange, }: HueSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ObjectColorsSectionProps {
|
|
2
|
+
objectColors: string[];
|
|
3
|
+
currentColor: string;
|
|
4
|
+
onSelectObjectColor: (hex: string, idx: number) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ObjectColorsSection({ objectColors, currentColor, onSelectObjectColor, }: ObjectColorsSectionProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface PresetColorsSectionProps {
|
|
2
|
+
presetColors: string[];
|
|
3
|
+
selectedColor: string;
|
|
4
|
+
onColorClick: (hex: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PresetColorsSection({ presetColors, selectedColor, onColorClick, }: PresetColorsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HSVColor } from '../../../lib/types/color.types';
|
|
2
|
+
interface SVBoxProps {
|
|
3
|
+
hsv: HSVColor;
|
|
4
|
+
hueColor: string;
|
|
5
|
+
currentColor: string;
|
|
6
|
+
heightClass?: string;
|
|
7
|
+
onHsvChange: (hsv: HSVColor) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function SVBox({ hsv, hueColor, currentColor, heightClass, onHsvChange, }: SVBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export
|
|
8
|
-
export {};
|
|
1
|
+
import { CMYKColorPicker } from './CMYKColorPicker';
|
|
2
|
+
export default CMYKColorPicker;
|
|
3
|
+
export { CMYKColorPicker } from './CMYKColorPicker';
|
|
4
|
+
export type { CMYKColorPickerProps } from './CMYKColorPicker';
|
|
5
|
+
export { CMYKPopoverContent } from './CMYKPopoverContent';
|
|
6
|
+
export { SVBox } from './SVBox';
|
|
7
|
+
export { HueSlider } from './HueSlider';
|
|
8
|
+
export { AlphaSlider } from './AlphaSlider';
|
|
9
|
+
export { ChannelRow } from './ChannelRow';
|
|
10
|
+
export { ChannelSlider } from './ChannelSlider';
|
|
11
|
+
export { ObjectColorsSection } from './ObjectColorsSection';
|
|
12
|
+
export { CustomColorCard } from './CustomColorCard';
|
|
13
|
+
export { GradientColorCard } from './GradientColorCard';
|
|
14
|
+
export { DocumentColorsSection } from './DocumentColorsSection';
|
|
15
|
+
export { PresetColorsSection } from './PresetColorsSection';
|
|
16
|
+
export { BrandPalettesSection } from './BrandPalettesSection';
|
|
17
|
+
export { useColorPanelState, DEFAULT_PRESET_COLORS } from './useColorPanelState';
|
|
18
|
+
export { useCMYKPickerState, DEFAULT_SWATCH_COLORS, CMYK_CHANNELS } from './useCMYKPickerState';
|
|
19
|
+
export { useSolidColorState } from './useSolidColorState';
|
|
20
|
+
export { useGradientState } from './useGradientState';
|
|
21
|
+
export { usePaletteData } from './usePaletteData';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CMYKColor, HSVColor } from '../../../lib/types/color.types';
|
|
2
|
+
export declare const DEFAULT_SWATCH_COLORS: string[];
|
|
3
|
+
export declare const CMYK_CHANNELS: ({
|
|
4
|
+
key: "c";
|
|
5
|
+
label: string;
|
|
6
|
+
color: string;
|
|
7
|
+
name: string;
|
|
8
|
+
} | {
|
|
9
|
+
key: "m";
|
|
10
|
+
label: string;
|
|
11
|
+
color: string;
|
|
12
|
+
name: string;
|
|
13
|
+
} | {
|
|
14
|
+
key: "y";
|
|
15
|
+
label: string;
|
|
16
|
+
color: string;
|
|
17
|
+
name: string;
|
|
18
|
+
} | {
|
|
19
|
+
key: "k";
|
|
20
|
+
label: string;
|
|
21
|
+
color: string;
|
|
22
|
+
name: string;
|
|
23
|
+
})[];
|
|
24
|
+
export declare function useCMYKPickerState(value?: string | CMYKColor, onChange?: (hexOrCmyk: any, cmyk?: CMYKColor) => void): {
|
|
25
|
+
isControlled: boolean;
|
|
26
|
+
targets: import('fabric').FabricObject<Partial<import('fabric').FabricObjectProps>, import('fabric').SerializedObjectProps, import('fabric').ObjectEvents>[];
|
|
27
|
+
allTargetColors: string[];
|
|
28
|
+
activeColor: string | null;
|
|
29
|
+
activeColorIndex: number;
|
|
30
|
+
setActiveColor: (color: string | null, index?: number) => void;
|
|
31
|
+
color: string;
|
|
32
|
+
cmyk: CMYKColor;
|
|
33
|
+
hsv: HSVColor;
|
|
34
|
+
alpha: number;
|
|
35
|
+
mode: "HEX" | "CMYK";
|
|
36
|
+
setMode: import('react').Dispatch<import('react').SetStateAction<"HEX" | "CMYK">>;
|
|
37
|
+
open: boolean;
|
|
38
|
+
setOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
39
|
+
copied: boolean;
|
|
40
|
+
recentColors: string[];
|
|
41
|
+
coords: {
|
|
42
|
+
top: number;
|
|
43
|
+
left: number;
|
|
44
|
+
};
|
|
45
|
+
containerRef: import('react').RefObject<HTMLDivElement | null>;
|
|
46
|
+
popoverRef: import('react').RefObject<HTMLDivElement | null>;
|
|
47
|
+
updateFromHsv: (newHsv: HSVColor) => void;
|
|
48
|
+
updateFromCmyk: (newCmyk: CMYKColor) => void;
|
|
49
|
+
updateFromHex: (inputHex: string) => void;
|
|
50
|
+
updateAlpha: (newAlpha: number) => void;
|
|
51
|
+
handleCopy: () => void;
|
|
52
|
+
handleEyeDropper: () => Promise<void>;
|
|
53
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const DEFAULT_PRESET_COLORS: string[];
|
|
2
|
+
export declare function useColorPanelState(): {
|
|
3
|
+
fillMode: "solid" | "gradient";
|
|
4
|
+
setFillMode: import('react').Dispatch<import('react').SetStateAction<"solid" | "gradient">>;
|
|
5
|
+
activeSelectedColor: string;
|
|
6
|
+
handleSwatchClick: (hex: string) => void;
|
|
7
|
+
documentColors: string[];
|
|
8
|
+
groupedDbColors: Map<string, import('../../../lib/types/color.types').ColorItem[]>;
|
|
9
|
+
isLoadingColors: boolean;
|
|
10
|
+
gradientType: "linear" | "radial";
|
|
11
|
+
setGradientType: import('react').Dispatch<import('react').SetStateAction<"linear" | "radial">>;
|
|
12
|
+
gradColorMode: "HEX" | "CMYK";
|
|
13
|
+
setGradColorMode: import('react').Dispatch<import('react').SetStateAction<"HEX" | "CMYK">>;
|
|
14
|
+
gradColor1: string;
|
|
15
|
+
setGradColor1: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
16
|
+
gradColor2: string;
|
|
17
|
+
setGradColor2: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
18
|
+
gradColor1Cmyk: import('../../../lib/types/color.types').CMYKColor;
|
|
19
|
+
setGradColor1Cmyk: import('react').Dispatch<import('react').SetStateAction<import('../../../lib/types/color.types').CMYKColor>>;
|
|
20
|
+
gradColor2Cmyk: import('../../../lib/types/color.types').CMYKColor;
|
|
21
|
+
setGradColor2Cmyk: import('react').Dispatch<import('react').SetStateAction<import('../../../lib/types/color.types').CMYKColor>>;
|
|
22
|
+
activeGradColorSlot: 1 | 2;
|
|
23
|
+
setActiveGradColorSlot: import('react').Dispatch<import('react').SetStateAction<1 | 2>>;
|
|
24
|
+
gradX1: number;
|
|
25
|
+
setGradX1: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
26
|
+
gradX2: number;
|
|
27
|
+
setGradX2: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
28
|
+
gradY1: number;
|
|
29
|
+
setGradY1: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
30
|
+
gradY2: number;
|
|
31
|
+
setGradY2: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
32
|
+
gradR1: number;
|
|
33
|
+
setGradR1: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
34
|
+
gradR2: number;
|
|
35
|
+
setGradR2: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
36
|
+
applyGradient: (params?: {
|
|
37
|
+
type?: "linear" | "radial";
|
|
38
|
+
c1?: string;
|
|
39
|
+
c2?: string;
|
|
40
|
+
x1?: number;
|
|
41
|
+
x2?: number;
|
|
42
|
+
y1?: number;
|
|
43
|
+
y2?: number;
|
|
44
|
+
r1?: number;
|
|
45
|
+
r2?: number;
|
|
46
|
+
}) => void;
|
|
47
|
+
updateGradCmyk: (key: keyof import('../../../lib/types/color.types').CMYKColor, val: number) => void;
|
|
48
|
+
objectColors: string[];
|
|
49
|
+
currentColor: string;
|
|
50
|
+
currentCmyk: import('../../../lib/types/color.types').CMYKColor;
|
|
51
|
+
hsv: import('../../../lib/types/color.types').HSVColor;
|
|
52
|
+
alpha: number;
|
|
53
|
+
colorMode: "HEX" | "CMYK";
|
|
54
|
+
copied: boolean;
|
|
55
|
+
setAlpha: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
56
|
+
setColorMode: import('react').Dispatch<import('react').SetStateAction<"HEX" | "CMYK">>;
|
|
57
|
+
applyColor: (newHex: string, cmykVal?: import('../../../lib/types/color.types').CMYKColor, opacityVal?: number) => void;
|
|
58
|
+
updateFromHsv: (newHsv: import('../../../lib/types/color.types').HSVColor) => void;
|
|
59
|
+
updateFromCmyk: (newCmyk: import('../../../lib/types/color.types').CMYKColor) => void;
|
|
60
|
+
updateFromHex: (inputHex: string) => void;
|
|
61
|
+
handleSelectObjectColor: (hex: string, idx: number) => void;
|
|
62
|
+
handleCopyHex: () => void;
|
|
63
|
+
handleEyeDropper: () => Promise<void>;
|
|
64
|
+
};
|