vibrant-tool 0.1.4 → 0.1.6
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/services/vibrant-image.service.d.ts +29 -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/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/font-utils.d.ts +25 -0
- package/dist/lib/utils/mockup-generator.d.ts +47 -0
- package/dist/lib/utils/navigation-utils.d.ts +5 -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 +370 -52
- package/dist/vibrant-tool.es.js +67303 -65505
- package/dist/vibrant-tool.umd.js +67303 -65505
- 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 {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface VibrantS3Image {
|
|
2
|
+
key: string;
|
|
3
|
+
name: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
lastModified?: string;
|
|
6
|
+
url: string;
|
|
7
|
+
smallUrl?: string;
|
|
8
|
+
largeUrl?: string;
|
|
9
|
+
smallKey?: string;
|
|
10
|
+
largeKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface VibrantFolderResponse {
|
|
13
|
+
success: boolean;
|
|
14
|
+
prefix: string;
|
|
15
|
+
files: VibrantS3Image[];
|
|
16
|
+
folders?: {
|
|
17
|
+
prefix: string;
|
|
18
|
+
name: string;
|
|
19
|
+
}[];
|
|
20
|
+
total?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const VibrantImageService: {
|
|
23
|
+
getFolderData(params?: {
|
|
24
|
+
item?: string;
|
|
25
|
+
page?: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
search?: string;
|
|
28
|
+
}): Promise<VibrantFolderResponse>;
|
|
29
|
+
};
|
|
@@ -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>;
|
|
@@ -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): 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>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injects a @font-face rule into document.head and ensures the browser loads it
|
|
3
|
+
*/
|
|
4
|
+
export declare function injectFontFace(fontName: string, fontUrl: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Loads all fonts from a template (populated fonts array and/or page design JSONs) into document.head
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadTemplateFontsIntoHead(templateFonts?: any[] | null, pagesDesignData?: any[] | any): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Recursively extracts all unique font families from Fabric JSON or canvas objects
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractFontFamilies(designJson: any): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Resolves font family names/strings from both canvas sides to MongoDB Font ObjectIds
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveFontIds(fontNames: string[]): Promise<string[]>;
|
|
17
|
+
export interface ExportFontItem {
|
|
18
|
+
fontName: string;
|
|
19
|
+
fontFamily?: string;
|
|
20
|
+
fontFile: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolves font items (with fontFile URLs) for PDF export from design JSONs and templateFonts
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveFontsForExport(designs: any[], templateFonts?: any[] | null): Promise<ExportFontItem[]>;
|
|
@@ -0,0 +1,47 @@
|
|
|
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 DEFAULT_MOCKUP_CONFIG: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
foregroundCard: {
|
|
14
|
+
name: string;
|
|
15
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
16
|
+
lightingAngle: number;
|
|
17
|
+
};
|
|
18
|
+
stackTopCard: {
|
|
19
|
+
name: string;
|
|
20
|
+
corners: [Point2D, Point2D, Point2D, Point2D];
|
|
21
|
+
lightingAngle: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Draws a perspective-warped image onto canvas using triangle subdivision
|
|
26
|
+
*/
|
|
27
|
+
export declare function drawPerspectiveWarp(ctx: CanvasRenderingContext2D, img: HTMLImageElement | HTMLCanvasElement, dstCorners: [Point2D, Point2D, Point2D, Point2D], gridDivisions?: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Loads an image from URL/dataURL
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadImage(src: string): Promise<HTMLImageElement>;
|
|
32
|
+
export interface GenerateMockupOptions {
|
|
33
|
+
frontUrl: string;
|
|
34
|
+
backUrl?: string;
|
|
35
|
+
isTwoSided?: boolean;
|
|
36
|
+
swapSides?: boolean;
|
|
37
|
+
scale?: number;
|
|
38
|
+
bgUrl?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generates the full dynamic composite mockup onto an HTMLCanvasElement
|
|
42
|
+
*/
|
|
43
|
+
export declare function renderCompositeMockup(targetCanvas: HTMLCanvasElement, options: GenerateMockupOptions): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the final composite mockup rendered to a base64 PNG data URL
|
|
46
|
+
*/
|
|
47
|
+
export declare function generateMockupDataUrl(options: GenerateMockupOptions): Promise<string>;
|
|
@@ -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: "gradient" | "solid";
|
|
4
|
+
setFillMode: import('react').Dispatch<import('react').SetStateAction<"gradient" | "solid">>;
|
|
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
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Canvas, FabricObject } from 'fabric';
|
|
2
|
+
import { CMYKColor } from '../../../lib/types/color.types';
|
|
3
|
+
export declare function useGradientState(targets: FabricObject[], canvas: Canvas | null): {
|
|
4
|
+
gradientType: "linear" | "radial";
|
|
5
|
+
setGradientType: import('react').Dispatch<import('react').SetStateAction<"linear" | "radial">>;
|
|
6
|
+
gradColorMode: "HEX" | "CMYK";
|
|
7
|
+
setGradColorMode: import('react').Dispatch<import('react').SetStateAction<"HEX" | "CMYK">>;
|
|
8
|
+
gradColor1: string;
|
|
9
|
+
setGradColor1: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
10
|
+
gradColor2: string;
|
|
11
|
+
setGradColor2: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
12
|
+
gradColor1Cmyk: CMYKColor;
|
|
13
|
+
setGradColor1Cmyk: import('react').Dispatch<import('react').SetStateAction<CMYKColor>>;
|
|
14
|
+
gradColor2Cmyk: CMYKColor;
|
|
15
|
+
setGradColor2Cmyk: import('react').Dispatch<import('react').SetStateAction<CMYKColor>>;
|
|
16
|
+
activeGradColorSlot: 1 | 2;
|
|
17
|
+
setActiveGradColorSlot: import('react').Dispatch<import('react').SetStateAction<1 | 2>>;
|
|
18
|
+
gradX1: number;
|
|
19
|
+
setGradX1: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
20
|
+
gradX2: number;
|
|
21
|
+
setGradX2: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
22
|
+
gradY1: number;
|
|
23
|
+
setGradY1: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
24
|
+
gradY2: number;
|
|
25
|
+
setGradY2: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
26
|
+
gradR1: number;
|
|
27
|
+
setGradR1: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
28
|
+
gradR2: number;
|
|
29
|
+
setGradR2: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
30
|
+
applyGradient: (params?: {
|
|
31
|
+
type?: "linear" | "radial";
|
|
32
|
+
c1?: string;
|
|
33
|
+
c2?: string;
|
|
34
|
+
x1?: number;
|
|
35
|
+
x2?: number;
|
|
36
|
+
y1?: number;
|
|
37
|
+
y2?: number;
|
|
38
|
+
r1?: number;
|
|
39
|
+
r2?: number;
|
|
40
|
+
}) => void;
|
|
41
|
+
updateGradCmyk: (key: keyof CMYKColor, val: number) => void;
|
|
42
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Canvas, FabricObject } from 'fabric';
|
|
2
|
+
import { ColorItem } from '../../../lib/types/color.types';
|
|
3
|
+
export declare function usePaletteData(canvas: Canvas | null, objects: FabricObject[]): {
|
|
4
|
+
documentColors: string[];
|
|
5
|
+
groupedDbColors: Map<string, ColorItem[]>;
|
|
6
|
+
isLoadingColors: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Canvas, FabricObject } from 'fabric';
|
|
2
|
+
import { CMYKColor, HSVColor } from '../../../lib/types/color.types';
|
|
3
|
+
export declare function useSolidColorState(targets: FabricObject[], canvas: Canvas | null): {
|
|
4
|
+
objectColors: string[];
|
|
5
|
+
currentColor: string;
|
|
6
|
+
currentCmyk: CMYKColor;
|
|
7
|
+
hsv: HSVColor;
|
|
8
|
+
alpha: number;
|
|
9
|
+
colorMode: "HEX" | "CMYK";
|
|
10
|
+
copied: boolean;
|
|
11
|
+
setAlpha: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
12
|
+
setColorMode: import('react').Dispatch<import('react').SetStateAction<"HEX" | "CMYK">>;
|
|
13
|
+
applyColor: (newHex: string, cmykVal?: CMYKColor, opacityVal?: number) => void;
|
|
14
|
+
updateFromHsv: (newHsv: HSVColor) => void;
|
|
15
|
+
updateFromCmyk: (newCmyk: CMYKColor) => void;
|
|
16
|
+
updateFromHex: (inputHex: string) => void;
|
|
17
|
+
handleSelectObjectColor: (hex: string, idx: number) => void;
|
|
18
|
+
handleCopyHex: () => void;
|
|
19
|
+
handleEyeDropper: () => Promise<void>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface TemplateMockupModalProps {
|
|
2
|
+
templateId: string;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onSuccess?: (imageUrl: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export default function TemplateMockupModal({ templateId, onClose, onSuccess, }: TemplateMockupModalProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|