vibrant-tool 0.1.1
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/README.md +36 -0
- package/dist/App.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/hooks/applyImagePreset.d.ts +3 -0
- package/dist/lib/hooks/fitimagetopage.d.ts +2 -0
- package/dist/lib/hooks/qrUtils.d.ts +2 -0
- package/dist/lib/hooks/useBlackEffect.d.ts +2 -0
- package/dist/lib/hooks/useBlurEffect.d.ts +2 -0
- package/dist/lib/hooks/useBorderEffect.d.ts +2 -0
- package/dist/lib/hooks/useBrightnessEffect.d.ts +2 -0
- package/dist/lib/hooks/useCanvasZoom.d.ts +16 -0
- package/dist/lib/hooks/useContrastEffect.d.ts +2 -0
- package/dist/lib/hooks/useCornerRadiusEffect.d.ts +2 -0
- package/dist/lib/hooks/useDraggable.d.ts +2 -0
- package/dist/lib/hooks/useFabricDrawing.d.ts +1 -0
- package/dist/lib/hooks/useFabricShadow.d.ts +2 -0
- package/dist/lib/hooks/useKeyboardEvents.d.ts +2 -0
- package/dist/lib/hooks/useSaturationEffect.d.ts +2 -0
- package/dist/lib/hooks/useShadowEffect.d.ts +2 -0
- package/dist/lib/hooks/useSocialAuth.d.ts +16 -0
- package/dist/lib/hooks/useTemperatureEffect.d.ts +2 -0
- package/dist/lib/hooks/useVibranceEffect.d.ts +2 -0
- package/dist/lib/hooks/useWhiteEffect.d.ts +2 -0
- package/dist/lib/services/api.d.ts +12 -0
- package/dist/lib/services/crop-image.service.d.ts +23 -0
- package/dist/lib/services/font.service.d.ts +4 -0
- package/dist/lib/services/shape.service.d.ts +9 -0
- package/dist/lib/types/barcode.types.d.ts +12 -0
- package/dist/lib/types/color.types.d.ts +11 -0
- package/dist/lib/types/fabric.types.d.ts +38 -0
- package/dist/lib/types/font.types.d.ts +28 -0
- package/dist/lib/types/shape.types.d.ts +36 -0
- package/dist/lib/utils/background-utils.d.ts +4 -0
- package/dist/lib/utils/barcode-utils.d.ts +6 -0
- package/dist/lib/utils/canvas-handler.d.ts +78 -0
- package/dist/lib/utils/canvas-setup.d.ts +29 -0
- package/dist/lib/utils/color-conversions.utils.d.ts +19 -0
- package/dist/lib/utils/custom-controls.d.ts +5 -0
- package/dist/lib/utils/design-storage-utils.d.ts +4 -0
- package/dist/lib/utils/downloadCanvas.d.ts +7 -0
- package/dist/lib/utils/driver-tour.d.ts +2 -0
- package/dist/lib/utils/event-handlers.d.ts +10 -0
- package/dist/lib/utils/fabric-helper.d.ts +2 -0
- package/dist/lib/utils/gradient-converter-utils.d.ts +8 -0
- package/dist/lib/utils/history-recorder.d.ts +1 -0
- package/dist/lib/utils/icon-effects-utils.d.ts +4 -0
- package/dist/lib/utils/image-utils.d.ts +3 -0
- package/dist/lib/utils/imagePresets.d.ts +2 -0
- package/dist/lib/utils/overlay-manager.d.ts +3 -0
- package/dist/lib/utils/page-manager.d.ts +3 -0
- package/dist/lib/utils/pan-mode.d.ts +10 -0
- package/dist/lib/utils/qr-utils.d.ts +4 -0
- package/dist/lib/utils/svg-utils.d.ts +8 -0
- package/dist/lib/utils/text-utils.d.ts +4 -0
- package/dist/modules/canvas/index.d.ts +1 -0
- package/dist/modules/components/all-elements/index.d.ts +8 -0
- package/dist/modules/components/alpha-slider/index.d.ts +12 -0
- package/dist/modules/components/cmyk-inputs/index.d.ts +12 -0
- package/dist/modules/components/color-picker/index.d.ts +1 -0
- package/dist/modules/components/color-preview-box/index.d.ts +6 -0
- package/dist/modules/components/crop-image-button/index.d.ts +1 -0
- package/dist/modules/components/duplicate-button/index.d.ts +1 -0
- package/dist/modules/components/effect-section/index.d.ts +13 -0
- package/dist/modules/components/flip-button/index.d.ts +1 -0
- package/dist/modules/components/global-loader/index.d.ts +1 -0
- package/dist/modules/components/gradient-selector/index.d.ts +10 -0
- package/dist/modules/components/group-button/index.d.ts +1 -0
- package/dist/modules/components/home/aiimage.d.ts +5 -0
- package/dist/modules/components/home/animate.d.ts +3 -0
- package/dist/modules/components/home/design.d.ts +10 -0
- package/dist/modules/components/home/iconeffect.d.ts +7 -0
- package/dist/modules/components/home/index copy.d.ts +1 -0
- package/dist/modules/components/home/layer.d.ts +16 -0
- package/dist/modules/components/home/quotes.d.ts +6 -0
- package/dist/modules/components/home/shapeeffect.d.ts +7 -0
- package/dist/modules/components/home/size.d.ts +6 -0
- package/dist/modules/components/home/texteffect/components/BackgroundControl/index.d.ts +4 -0
- package/dist/modules/components/home/texteffect/components/CurvedTextControl/index.d.ts +4 -0
- package/dist/modules/components/home/texteffect/components/ShadowControl/index.d.ts +4 -0
- package/dist/modules/components/home/texteffect/components/blurControl/index.d.ts +4 -0
- package/dist/modules/components/home/texteffect/components/strokeControl/index.d.ts +4 -0
- package/dist/modules/components/home/texteffect/effect.d.ts +6 -0
- package/dist/modules/components/home/video.d.ts +6 -0
- package/dist/modules/components/home/videotrim.d.ts +7 -0
- package/dist/modules/components/hue-slider/index.d.ts +9 -0
- package/dist/modules/components/lock-button/index.d.ts +1 -0
- package/dist/modules/components/opacity-picker/index.d.ts +1 -0
- package/dist/modules/components/position-picker/index.d.ts +1 -0
- package/dist/modules/components/remove-button/index.d.ts +1 -0
- package/dist/modules/components/rotate-button/index.d.ts +1 -0
- package/dist/modules/components/shadow-control/index.d.ts +10 -0
- package/dist/modules/components/tour-runner/index.d.ts +1 -0
- package/dist/modules/components/ungroup-button/index.d.ts +1 -0
- package/dist/modules/components/zoom-controls/index.d.ts +1 -0
- package/dist/modules/data/elements.d.ts +6 -0
- package/dist/modules/data/mask.d.ts +4 -0
- package/dist/modules/data/templates.d.ts +126 -0
- package/dist/modules/icons/aiicon/index.d.ts +4 -0
- package/dist/modules/icons/aligncentericon/aligncentericon.d.ts +1 -0
- package/dist/modules/icons/alignlefticon/alignlefticon.d.ts +1 -0
- package/dist/modules/icons/alignrighticon/alignrighticon.d.ts +1 -0
- package/dist/modules/icons/arrowbottomlefticon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowbottomrighticon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowdownicon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowicon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowlefticon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowrighticon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowtoplefticon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowtoprighticon/inedx.d.ts +1 -0
- package/dist/modules/icons/arrowupicon/inedx.d.ts +1 -0
- package/dist/modules/icons/backgroundicon/index.d.ts +1 -0
- package/dist/modules/icons/colorpickericon/index.d.ts +1 -0
- package/dist/modules/icons/copyicon/index.d.ts +1 -0
- package/dist/modules/icons/cropicon/index.d.ts +1 -0
- package/dist/modules/icons/deleteicon/index.d.ts +1 -0
- package/dist/modules/icons/designicon/index.d.ts +1 -0
- package/dist/modules/icons/disableicon/index.d.ts +1 -0
- package/dist/modules/icons/downloadicon/index.d.ts +1 -0
- package/dist/modules/icons/drawicon/index.d.ts +4 -0
- package/dist/modules/icons/dropboxicon/index.d.ts +1 -0
- package/dist/modules/icons/effecticon/index.d.ts +1 -0
- package/dist/modules/icons/eyeicon/index.d.ts +1 -0
- package/dist/modules/icons/facebookicon/index.d.ts +1 -0
- package/dist/modules/icons/flickricon/index.d.ts +1 -0
- package/dist/modules/icons/fliphorizontalicon/index.d.ts +1 -0
- package/dist/modules/icons/flipicon/index.d.ts +1 -0
- package/dist/modules/icons/flipverticalicon/index.d.ts +1 -0
- package/dist/modules/icons/googledriveicon/index.d.ts +1 -0
- package/dist/modules/icons/googlephotosicon/index.d.ts +1 -0
- package/dist/modules/icons/groupicon/index.d.ts +1 -0
- package/dist/modules/icons/handicon/index.d.ts +1 -0
- package/dist/modules/icons/helpicon/index.d.ts +1 -0
- package/dist/modules/icons/iconsicon/index.d.ts +1 -0
- package/dist/modules/icons/instagramicon/index.d.ts +1 -0
- package/dist/modules/icons/layersicon/index.d.ts +1 -0
- package/dist/modules/icons/lockicon/index.d.ts +1 -0
- package/dist/modules/icons/menuicon/index.d.ts +1 -0
- package/dist/modules/icons/notfoundicon/index.d.ts +1 -0
- package/dist/modules/icons/opacityicon/index.d.ts +1 -0
- package/dist/modules/icons/pexelsicon/index.d.ts +1 -0
- package/dist/modules/icons/photosicon/index.d.ts +1 -0
- package/dist/modules/icons/pixabayicon/index.d.ts +1 -0
- package/dist/modules/icons/pointericon/index.d.ts +1 -0
- package/dist/modules/icons/qrcodeicon/index.d.ts +1 -0
- package/dist/modules/icons/quotesicon/index.d.ts +1 -0
- package/dist/modules/icons/redoicon/index.d.ts +1 -0
- package/dist/modules/icons/rotateicon/index.d.ts +1 -0
- package/dist/modules/icons/shapeicon/index.d.ts +1 -0
- package/dist/modules/icons/sizeicon/index.d.ts +1 -0
- package/dist/modules/icons/strikethroughicon/index.d.ts +1 -0
- package/dist/modules/icons/stylecopyicon/index.d.ts +1 -0
- package/dist/modules/icons/templateicon/index.d.ts +1 -0
- package/dist/modules/icons/texticon/index.d.ts +4 -0
- package/dist/modules/icons/undoicon/index.d.ts +1 -0
- package/dist/modules/icons/ungroupicon/index.d.ts +1 -0
- package/dist/modules/icons/unlockicon/index.d.ts +1 -0
- package/dist/modules/icons/uploadicon/index.d.ts +1 -0
- package/dist/modules/icons/usersicon/index.d.ts +1 -0
- package/dist/modules/icons/videoicon/index.d.ts +4 -0
- package/dist/modules/icons/zoomicon/index.d.ts +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/side-panel/background-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/bar-code-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/draw-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/effect-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/elements-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/font-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/index.d.ts +10 -0
- package/dist/modules/side-panel/mask-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/panel/index.d.ts +4 -0
- package/dist/modules/side-panel/photos-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/qr-code-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/quotes-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/templates-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/text-panel/index.d.ts +1 -0
- package/dist/modules/side-panel/upload-panel/index.d.ts +1 -0
- package/dist/modules/toolbar/barcode-toolbar/index.d.ts +1 -0
- package/dist/modules/toolbar/common-toolbar/index.d.ts +1 -0
- package/dist/modules/toolbar/index.d.ts +1 -0
- package/dist/modules/toolbar/picture-toolbar/index.d.ts +1 -0
- package/dist/modules/toolbar/qr-toolbar/index.d.ts +1 -0
- package/dist/modules/toolbar/text-toolbar/index.d.ts +11 -0
- package/dist/modules/topbar/download-popover.d.ts +3 -0
- package/dist/modules/topbar/index.d.ts +1 -0
- package/dist/vibrant-tool.css +3031 -0
- package/dist/vibrant-tool.es.js +123232 -0
- package/dist/vibrant-tool.umd.js +123234 -0
- package/dist/zustand/drawStore.d.ts +13 -0
- package/dist/zustand/editorStore.d.ts +15 -0
- package/dist/zustand/effectStore.d.ts +43 -0
- package/dist/zustand/historyStore.d.ts +20 -0
- package/dist/zustand/loaderStore.d.ts +8 -0
- package/dist/zustand/selectionStore.d.ts +10 -0
- package/dist/zustand/sidePanelStore.d.ts +8 -0
- package/dist/zustand/tourStore.d.ts +19 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Next.js setup in consumer app
|
|
2
|
+
|
|
3
|
+
Update `next.config.ts`:
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import type { NextConfig } from "next";
|
|
7
|
+
|
|
8
|
+
const nextConfig: NextConfig = {
|
|
9
|
+
transpilePackages: ["vibrant-tool"]
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default nextConfig;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import global styles in your app layout (`app/layout.tsx`):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import "vibrant-tool/styles.css";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use the editor component:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
"use client";
|
|
25
|
+
|
|
26
|
+
import { VibrantEditor } from "vibrant-tool";
|
|
27
|
+
|
|
28
|
+
export default function Page() {
|
|
29
|
+
return <VibrantEditor />;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Exported API
|
|
34
|
+
|
|
35
|
+
- `VibrantEditor`
|
|
36
|
+
- `default` export: `VibrantEditor`
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function App(): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as VibrantTool } from './App';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Canvas } from 'fabric';
|
|
2
|
+
export declare const MIN_ZOOM = 0.09;
|
|
3
|
+
export declare const MAX_ZOOM = 5;
|
|
4
|
+
export declare function clamp(v: number, lo: number, hi: number): number;
|
|
5
|
+
export declare const toSlider: (z: number) => number;
|
|
6
|
+
export declare const fromSlider: (v: number) => number;
|
|
7
|
+
export interface CanvasZoomAPI {
|
|
8
|
+
zoom: number;
|
|
9
|
+
atMin: boolean;
|
|
10
|
+
atMax: boolean;
|
|
11
|
+
zoomIn: () => void;
|
|
12
|
+
zoomOut: () => void;
|
|
13
|
+
zoomReset: () => void;
|
|
14
|
+
zoomTo: (value: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function useCanvasZoom(canvas: Canvas | null): CanvasZoomAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFabricDrawing(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
gapi: any;
|
|
4
|
+
google: any;
|
|
5
|
+
Dropbox: any;
|
|
6
|
+
FB: any;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare function useSocialAuth({ onImageSelect }: {
|
|
10
|
+
onImageSelect: (url: string) => void;
|
|
11
|
+
}): {
|
|
12
|
+
handleGoogleAuth: (type: "googledrives" | "googlephotos") => void;
|
|
13
|
+
handleDropboxAuth: () => void;
|
|
14
|
+
handleFacebookAuth: () => void;
|
|
15
|
+
handleInstagramAuth: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
2
|
+
export interface ApiError {
|
|
3
|
+
status: number;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
interface ApiFetchOptions<TBody> {
|
|
7
|
+
method?: HttpMethod;
|
|
8
|
+
body?: TBody;
|
|
9
|
+
headers?: HeadersInit;
|
|
10
|
+
}
|
|
11
|
+
export declare function apiFetch<TResponse, TBody = unknown>(endpoint: string, options?: ApiFetchOptions<TBody>): Promise<TResponse>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Canvas, Image as FabricImage } from 'fabric';
|
|
2
|
+
declare class CropService {
|
|
3
|
+
private canvas;
|
|
4
|
+
private targetImage;
|
|
5
|
+
private fullImage;
|
|
6
|
+
private darkOverlay;
|
|
7
|
+
private focusedImage;
|
|
8
|
+
private cropZone;
|
|
9
|
+
private onEnd;
|
|
10
|
+
init(canvas: Canvas): void;
|
|
11
|
+
start(image: FabricImage, onEnd?: () => void): Promise<void>;
|
|
12
|
+
private onInteraction;
|
|
13
|
+
private constrain;
|
|
14
|
+
private updateClipPath;
|
|
15
|
+
apply(): void;
|
|
16
|
+
cancel(): void;
|
|
17
|
+
private cleanup;
|
|
18
|
+
}
|
|
19
|
+
export declare const cropService: CropService;
|
|
20
|
+
export declare const startCrop: (canvas: Canvas, img: FabricImage) => void;
|
|
21
|
+
export declare const applyCrop: (canvas: Canvas) => void;
|
|
22
|
+
export declare const cancelCrop: (canvas: Canvas) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ElementItem, ExternalShapeType, ShapeType } from '../types/shape.types';
|
|
2
|
+
type NormalizedShapeResponse = {
|
|
3
|
+
items: ElementItem[];
|
|
4
|
+
};
|
|
5
|
+
export declare const ShapeService: {
|
|
6
|
+
getAll(data: ShapeType): Promise<NormalizedShapeResponse>;
|
|
7
|
+
getAllExternal(data: ExternalShapeType): Promise<NormalizedShapeResponse>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type BarcodeGroup = {
|
|
2
|
+
label: string;
|
|
3
|
+
options: Array<{
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
} | [string, string]>;
|
|
7
|
+
};
|
|
8
|
+
export declare const BARCODE_TYPES: {
|
|
9
|
+
label: string;
|
|
10
|
+
options: string[][];
|
|
11
|
+
}[];
|
|
12
|
+
export declare const COMPOSITE_TYPES: Set<string>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Canvas, FabricObject } from 'fabric';
|
|
2
|
+
export interface AppFabricObject extends FabricObject {
|
|
3
|
+
objectId?: string;
|
|
4
|
+
objectName?: string;
|
|
5
|
+
}
|
|
6
|
+
export type CanvasJSON = ReturnType<Canvas["toJSON"]>;
|
|
7
|
+
export type SavedDesign = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
thumbnail: string;
|
|
11
|
+
canvasJSON: CanvasJSON;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
};
|
|
14
|
+
export interface ExtendedFabricObject extends FabricObject {
|
|
15
|
+
__isQR?: boolean;
|
|
16
|
+
__qrValue?: string;
|
|
17
|
+
__qrDataUrl?: string;
|
|
18
|
+
__qrDark?: string;
|
|
19
|
+
__qrLight?: string;
|
|
20
|
+
__barcodeBackground?: string;
|
|
21
|
+
__barcodeForeground?: string;
|
|
22
|
+
__isVideo?: boolean;
|
|
23
|
+
videoEl?: HTMLVideoElement;
|
|
24
|
+
trimStart?: number;
|
|
25
|
+
trimEnd?: number;
|
|
26
|
+
}
|
|
27
|
+
export type TemplateJSON = {
|
|
28
|
+
version?: string;
|
|
29
|
+
objects?: unknown[];
|
|
30
|
+
background?: unknown;
|
|
31
|
+
[k: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
export interface VideoFabricObject extends FabricObject {
|
|
34
|
+
__isVideo?: true;
|
|
35
|
+
videoEl: HTMLVideoElement;
|
|
36
|
+
trimStart: number;
|
|
37
|
+
trimEnd: number;
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface FontType {
|
|
2
|
+
pagination: boolean;
|
|
3
|
+
pageNumber: number | 1;
|
|
4
|
+
pageSize: number | 30;
|
|
5
|
+
IsAdmin: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface FontItem {
|
|
8
|
+
_id: string;
|
|
9
|
+
IsActive: boolean;
|
|
10
|
+
chieldFonts: {
|
|
11
|
+
IsActive: boolean;
|
|
12
|
+
fontFile: string;
|
|
13
|
+
fontImage: string;
|
|
14
|
+
fontName: string;
|
|
15
|
+
_id: string;
|
|
16
|
+
}[];
|
|
17
|
+
fontImage: string;
|
|
18
|
+
fontFile: string;
|
|
19
|
+
fontStyle: string;
|
|
20
|
+
fontName: string;
|
|
21
|
+
fontWeight: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FontItemResponse {
|
|
24
|
+
message: {
|
|
25
|
+
data: FontItem[];
|
|
26
|
+
};
|
|
27
|
+
status: boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ShapeType {
|
|
2
|
+
type?: string;
|
|
3
|
+
category?: string | null;
|
|
4
|
+
pageNumber?: number | 1;
|
|
5
|
+
pagination?: boolean;
|
|
6
|
+
id?: string;
|
|
7
|
+
statusKey?: string;
|
|
8
|
+
statusValue?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ElementItem {
|
|
11
|
+
_id: string;
|
|
12
|
+
IsActive: boolean;
|
|
13
|
+
category: string;
|
|
14
|
+
image: string;
|
|
15
|
+
largeImage: string;
|
|
16
|
+
tags: string[];
|
|
17
|
+
imageType?: string;
|
|
18
|
+
data?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ElementItemResponse {
|
|
21
|
+
message: {
|
|
22
|
+
data: ElementItem[];
|
|
23
|
+
};
|
|
24
|
+
status: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ExternalItemResponse {
|
|
27
|
+
data: ElementItem[];
|
|
28
|
+
status: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ExternalShapeType {
|
|
31
|
+
query?: string | null;
|
|
32
|
+
keyType: string | null;
|
|
33
|
+
pageNumber: number | 1;
|
|
34
|
+
pageSize: number | 30;
|
|
35
|
+
isVector: boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FabricImage, FabricObject } from 'fabric';
|
|
2
|
+
export declare const isImage: (obj: FabricObject) => obj is FabricImage;
|
|
3
|
+
export declare function addBackgroundImage(url: string): Promise<void>;
|
|
4
|
+
export declare function addBackgroundColor(color: string): Promise<void>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Canvas } from 'fabric';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for handling large canvases efficiently
|
|
4
|
+
*/
|
|
5
|
+
export interface VCanvasConfig {
|
|
6
|
+
printWidth: number;
|
|
7
|
+
printHeight: number;
|
|
8
|
+
printDPI: number;
|
|
9
|
+
displayScale?: number;
|
|
10
|
+
maxDimension?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Calculate optimal display scale for large canvases
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateOptimalScale(width: number, height: number, maxDimension?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Get actual pixel dimensions for print
|
|
18
|
+
*/
|
|
19
|
+
export declare function getPrintDimensions(config: VCanvasConfig): {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Get display dimensions (scaled down for viewport)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getDisplayDimensions(config: VCanvasConfig): {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
scale: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Configure canvas for large artwork with performance optimizations
|
|
33
|
+
*/
|
|
34
|
+
export declare function configureLargeCanvas(canvas: Canvas, config: VCanvasConfig): {
|
|
35
|
+
displayWidth: number;
|
|
36
|
+
displayHeight: number;
|
|
37
|
+
printWidth: number;
|
|
38
|
+
printHeight: number;
|
|
39
|
+
scale: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Export canvas at full print resolution
|
|
43
|
+
*/
|
|
44
|
+
export declare function exportAtPrintResolution(canvas: Canvas, format?: "png" | "jpeg", quality?: number): string;
|
|
45
|
+
/**
|
|
46
|
+
* Best practices for large canvas performance
|
|
47
|
+
*/
|
|
48
|
+
export declare const LARGE_CANVAS_TIPS: {
|
|
49
|
+
SCALE_RECOMMENDATIONS: {
|
|
50
|
+
small: {
|
|
51
|
+
maxInches: number;
|
|
52
|
+
scale: number;
|
|
53
|
+
};
|
|
54
|
+
medium: {
|
|
55
|
+
maxInches: number;
|
|
56
|
+
scale: number;
|
|
57
|
+
};
|
|
58
|
+
large: {
|
|
59
|
+
maxInches: number;
|
|
60
|
+
scale: number;
|
|
61
|
+
};
|
|
62
|
+
xlarge: {
|
|
63
|
+
maxInches: number;
|
|
64
|
+
scale: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
BROWSER_LIMITS: {
|
|
68
|
+
chrome: number;
|
|
69
|
+
firefox: number;
|
|
70
|
+
safari: number;
|
|
71
|
+
edge: number;
|
|
72
|
+
};
|
|
73
|
+
TIPS: string[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Get recommended scale based on print size
|
|
77
|
+
*/
|
|
78
|
+
export declare function getRecommendedScale(widthInches: number, heightInches: number): number;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Canvas, Rect } from 'fabric';
|
|
2
|
+
import { VCanvasConfig } from './canvas-handler';
|
|
3
|
+
export declare function initializeCanvas(canvasElement: HTMLCanvasElement, containerElement: HTMLDivElement): Canvas;
|
|
4
|
+
export declare function createInitialWorkarea(canvas: Canvas): Rect<{
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
fill: string;
|
|
8
|
+
selectable: false;
|
|
9
|
+
evented: false;
|
|
10
|
+
name: string;
|
|
11
|
+
}, import('fabric').SerializedRectProps, import('fabric').ObjectEvents>;
|
|
12
|
+
export declare function createLargeWorkarea(canvas: Canvas, config: VCanvasConfig): Rect<{
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
fill: string;
|
|
16
|
+
selectable: false;
|
|
17
|
+
evented: false;
|
|
18
|
+
name: string;
|
|
19
|
+
}, import('fabric').SerializedRectProps, import('fabric').ObjectEvents>;
|
|
20
|
+
export declare function createWorkarea(canvas: Canvas, container: HTMLDivElement): Rect<{
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
fill: string;
|
|
24
|
+
selectable: false;
|
|
25
|
+
evented: false;
|
|
26
|
+
name: string;
|
|
27
|
+
scaleX: number;
|
|
28
|
+
scaleY: number;
|
|
29
|
+
}, import('fabric').SerializedRectProps, import('fabric').ObjectEvents>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CMYKColor, HSVColor } from '../types/color.types';
|
|
2
|
+
export declare function hsvToRgb(h: number, s: number, v: number): {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function rgbToHsv(r: number, g: number, b: number): HSVColor;
|
|
8
|
+
export declare function rgbToCmyk(r: number, g: number, b: number): CMYKColor;
|
|
9
|
+
export declare function cmykToRgb(c: number, m: number, y: number, k: number): {
|
|
10
|
+
r: number;
|
|
11
|
+
g: number;
|
|
12
|
+
b: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function rgbToHex(r: number, g: number, b: number): string;
|
|
15
|
+
export declare function hexToRgb(hex: string): {
|
|
16
|
+
r: number;
|
|
17
|
+
g: number;
|
|
18
|
+
b: number;
|
|
19
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Control, FabricObject } from 'fabric';
|
|
2
|
+
export declare function renderRotateIcon(ctx: CanvasRenderingContext2D, left: number, top: number, fabricObject: FabricObject): void;
|
|
3
|
+
export declare function createRotateControl(): Control;
|
|
4
|
+
export declare function configureObjectControls(obj: FabricObject): void;
|
|
5
|
+
export declare function initializeRotateImage(): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Canvas } from 'fabric';
|
|
2
|
+
export declare function downloadCanvasWorkarea(canvas: Canvas, type: "png" | "jpeg" | "pdf" | "svg" | "json", scale?: number, pages?: Record<string, {
|
|
3
|
+
history: any[];
|
|
4
|
+
}>, currentPageSide?: string, dpi?: number): Promise<void>;
|
|
5
|
+
export declare function exportFullDesignToPDF(canvas: Canvas, pages: Record<string, {
|
|
6
|
+
history: any[];
|
|
7
|
+
}>, currentPageSide: string): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Canvas, FabricObject } from 'fabric';
|
|
2
|
+
export declare function setupHistoryRecording(canvas: Canvas): () => void;
|
|
3
|
+
export declare function setupDoublClickCrop(canvas: Canvas): () => void;
|
|
4
|
+
export declare function setupSelectionHandlers(canvas: Canvas, setSelection: (objects: FabricObject[]) => void, clearSelection: () => void): () => void;
|
|
5
|
+
export declare function setupObjectAddedHandler(canvas: Canvas): () => void;
|
|
6
|
+
export declare function setupBorderSync(canvas: Canvas): () => void;
|
|
7
|
+
export declare function setupToolbarPositioning(canvas: Canvas, setToolbarPos: (pos: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
} | null) => void): () => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Gradient } from 'fabric';
|
|
2
|
+
interface TargetSize {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
type FabricGradient = Gradient<"linear"> | Gradient<"radial">;
|
|
7
|
+
export declare function cssGradientToFabric(css: string, target: TargetSize): FabricGradient | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function recordHistory(e: any): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Canvas, FabricObject } from 'fabric';
|
|
2
|
+
import { ExtendedFabricObject } from '../types/fabric.types';
|
|
3
|
+
export declare function getActiveEffectTarget(canvas: Canvas): ExtendedFabricObject | null;
|
|
4
|
+
export declare function applyToEffectTarget(target: FabricObject, cb: (obj: FabricObject) => void): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Canvas } from 'fabric';
|
|
2
|
+
export type PageSide = "front" | "back";
|
|
3
|
+
export declare function switchCanvasPage(canvas: Canvas, currentPage: PageSide, targetPage: PageSide, pageJSON: Record<PageSide, any>, clearSelection: () => void, containerRef: React.MutableRefObject<HTMLDivElement | null>): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Canvas } from 'fabric';
|
|
2
|
+
export interface PanHandlers {
|
|
3
|
+
down: (opt: any) => void;
|
|
4
|
+
move: (opt: any) => void;
|
|
5
|
+
up: () => void;
|
|
6
|
+
out: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function enablePanMode(canvas: Canvas): PanHandlers;
|
|
9
|
+
export declare function disablePanMode(canvas: Canvas): void;
|
|
10
|
+
export declare function removePanHandlers(canvas: Canvas, handlers: PanHandlers | null): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FabricObject } from 'fabric';
|
|
2
|
+
import { ExtendedFabricObject } from '../types/fabric.types';
|
|
3
|
+
export declare const isQRCode: (obj?: FabricObject | null) => obj is ExtendedFabricObject;
|
|
4
|
+
export declare function generateQRSVG(value: string, dark: string, light: string): Promise<string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FabricObject } from 'fabric';
|
|
2
|
+
export declare function addSVGToCanvas(type: string | undefined, url: string): Promise<void>;
|
|
3
|
+
export declare function renderSVGStringToCanvas(type: string | undefined, svg: string, options?: {
|
|
4
|
+
background?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
}): Promise<FabricObject<Partial<import('fabric').FabricObjectProps>, import('fabric').SerializedObjectProps, import('fabric').ObjectEvents> | undefined>;
|
|
7
|
+
export declare function extractSVGColors(svg: FabricObject): string[];
|
|
8
|
+
export declare function replaceSVGColor(svg: FabricObject, fromColor: string, toColor: string): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Textbox, FabricObject } from 'fabric';
|
|
2
|
+
export declare const isTextbox: (obj: FabricObject) => obj is Textbox;
|
|
3
|
+
export declare function addTextToCanvas(fontSize: number, width: number, textName: string): Promise<void>;
|
|
4
|
+
export declare function addTextTemplate(id: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Workspace(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { ElementItem } from '../../../lib/types/shape.types';
|
|
3
|
+
export default function AllElements({ elements, onBack, scrollRef, onSearch }: {
|
|
4
|
+
elements: ElementItem[];
|
|
5
|
+
onBack?: () => void;
|
|
6
|
+
scrollRef: RefObject<HTMLDivElement | null>;
|
|
7
|
+
onSearch: (value: string) => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
alpha: number;
|
|
4
|
+
color: string;
|
|
5
|
+
refEl: RefObject<HTMLDivElement | null>;
|
|
6
|
+
setAlpha: (v: number) => void;
|
|
7
|
+
canvas: any;
|
|
8
|
+
targets: any[];
|
|
9
|
+
saveState: () => void;
|
|
10
|
+
}
|
|
11
|
+
export default function AlphaSlider({ alpha, color, refEl, setAlpha, canvas, targets, saveState, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CMYKColor } from '../../../lib/types/color.types';
|
|
2
|
+
interface Props {
|
|
3
|
+
cmyk: CMYKColor;
|
|
4
|
+
alpha: number;
|
|
5
|
+
setAlpha: (v: number) => void;
|
|
6
|
+
updateColor: (cmyk: CMYKColor) => void;
|
|
7
|
+
canvas: any;
|
|
8
|
+
targets: any[];
|
|
9
|
+
saveState: () => void;
|
|
10
|
+
}
|
|
11
|
+
export default function CMYKInputs({ cmyk, alpha, setAlpha, updateColor, canvas, targets, saveState, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|