vibrant-tool 0.1.1 → 0.1.2
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/App.d.ts +5 -1
- package/dist/lib/utils/canvas-setup.d.ts +4 -1
- package/dist/lib/utils/page-manager.d.ts +1 -1
- package/dist/modules/canvas/index.d.ts +5 -1
- package/dist/modules/index.d.ts +5 -1
- package/dist/vibrant-tool.es.js +28 -12
- package/dist/vibrant-tool.umd.js +28 -12
- package/package.json +1 -1
package/dist/App.d.ts
CHANGED
|
@@ -17,7 +17,10 @@ export declare function createLargeWorkarea(canvas: Canvas, config: VCanvasConfi
|
|
|
17
17
|
evented: false;
|
|
18
18
|
name: string;
|
|
19
19
|
}, import('fabric').SerializedRectProps, import('fabric').ObjectEvents>;
|
|
20
|
-
export declare function createWorkarea(canvas: Canvas, container: HTMLDivElement
|
|
20
|
+
export declare function createWorkarea(canvas: Canvas, container: HTMLDivElement, sizeInInches?: {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}): Rect<{
|
|
21
24
|
width: number;
|
|
22
25
|
height: number;
|
|
23
26
|
fill: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Canvas } from 'fabric';
|
|
2
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
|
|
3
|
+
export declare function switchCanvasPage(canvas: Canvas, currentPage: PageSide, targetPage: PageSide, pageJSON: Record<PageSide, any>, clearSelection: () => void, containerRef: React.MutableRefObject<HTMLDivElement | null>, data?: any): Promise<void>;
|
package/dist/modules/index.d.ts
CHANGED
package/dist/vibrant-tool.es.js
CHANGED
|
@@ -122472,11 +122472,11 @@ function initializeCanvas(canvasElement, containerElement) {
|
|
|
122472
122472
|
resizeCanvas();
|
|
122473
122473
|
return canvas2;
|
|
122474
122474
|
}
|
|
122475
|
-
function createWorkarea(canvas2, container) {
|
|
122475
|
+
function createWorkarea(canvas2, container, sizeInInches = { width: 3.5, height: 2 }) {
|
|
122476
122476
|
const containerWidth = container.clientWidth;
|
|
122477
122477
|
const containerHeight = container.clientHeight;
|
|
122478
|
-
const printWidth =
|
|
122479
|
-
const printHeight =
|
|
122478
|
+
const printWidth = sizeInInches.width + 0.125;
|
|
122479
|
+
const printHeight = sizeInInches.height + 0.125;
|
|
122480
122480
|
const printDPI = 72;
|
|
122481
122481
|
const fullWidth = printWidth * printDPI;
|
|
122482
122482
|
const fullHeight = printHeight * printDPI;
|
|
@@ -122626,7 +122626,7 @@ function setupBorderSync(canvas2) {
|
|
|
122626
122626
|
canvas2.off("object:rotating", syncBorder);
|
|
122627
122627
|
};
|
|
122628
122628
|
}
|
|
122629
|
-
async function switchCanvasPage(canvas2, currentPage, targetPage, pageJSON, clearSelection, containerRef) {
|
|
122629
|
+
async function switchCanvasPage(canvas2, currentPage, targetPage, pageJSON, clearSelection, containerRef, data) {
|
|
122630
122630
|
if (targetPage === currentPage) return;
|
|
122631
122631
|
const historyStore = useHistoryStore.getState();
|
|
122632
122632
|
pageJSON[currentPage] = canvas2.toObject(["name"]);
|
|
@@ -122639,7 +122639,7 @@ async function switchCanvasPage(canvas2, currentPage, targetPage, pageJSON, clea
|
|
|
122639
122639
|
} else {
|
|
122640
122640
|
canvas2.discardActiveObject();
|
|
122641
122641
|
canvas2.clear();
|
|
122642
|
-
createWorkarea(canvas2, containerRef.current);
|
|
122642
|
+
createWorkarea(canvas2, containerRef.current, data);
|
|
122643
122643
|
}
|
|
122644
122644
|
useHistoryStore.setState({ isRestoring: false });
|
|
122645
122645
|
}
|
|
@@ -123060,7 +123060,11 @@ function useKeyboardEvents(canvas2) {
|
|
|
123060
123060
|
};
|
|
123061
123061
|
}, [canvas2, saveState]);
|
|
123062
123062
|
}
|
|
123063
|
-
function Workspace(
|
|
123063
|
+
function Workspace({
|
|
123064
|
+
width = 3.5,
|
|
123065
|
+
height = 2,
|
|
123066
|
+
link
|
|
123067
|
+
}) {
|
|
123064
123068
|
const canvasRef = useRef(null);
|
|
123065
123069
|
const containerRef = useRef(null);
|
|
123066
123070
|
const fabricRef = useRef(null);
|
|
@@ -123084,7 +123088,10 @@ function Workspace() {
|
|
|
123084
123088
|
fabricRef.current = canvas2;
|
|
123085
123089
|
setCanvas(canvas2);
|
|
123086
123090
|
useHistoryStore.getState().setCanvas(canvas2);
|
|
123087
|
-
const workarea = createWorkarea(canvas2, containerRef.current
|
|
123091
|
+
const workarea = createWorkarea(canvas2, containerRef.current, {
|
|
123092
|
+
width,
|
|
123093
|
+
height
|
|
123094
|
+
});
|
|
123088
123095
|
workareaRef.current = workarea;
|
|
123089
123096
|
const cleanupHistory = setupHistoryRecording(canvas2);
|
|
123090
123097
|
const cleanupCrop = setupDoublClickCrop(canvas2);
|
|
@@ -123151,7 +123158,8 @@ function Workspace() {
|
|
|
123151
123158
|
page,
|
|
123152
123159
|
pageJSON.current,
|
|
123153
123160
|
clearSelection,
|
|
123154
|
-
containerRef
|
|
123161
|
+
containerRef,
|
|
123162
|
+
{ width, height }
|
|
123155
123163
|
);
|
|
123156
123164
|
useEditorStore.getState().setPages({ ...pageJSON.current });
|
|
123157
123165
|
setCurrentPage(page);
|
|
@@ -123210,21 +123218,29 @@ function Workspace() {
|
|
|
123210
123218
|
)
|
|
123211
123219
|
] });
|
|
123212
123220
|
}
|
|
123213
|
-
function Home(
|
|
123221
|
+
function Home({
|
|
123222
|
+
width = 3.5,
|
|
123223
|
+
height = 2,
|
|
123224
|
+
link
|
|
123225
|
+
}) {
|
|
123214
123226
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row bg-neutral-900 overflow-hidden h-[calc(100vh-56px)] relative", children: [
|
|
123215
123227
|
/* @__PURE__ */ jsx(SidePanel, {}),
|
|
123216
123228
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 bg-[#e4e6eb] flex flex-col items-center overflow-hidden", children: [
|
|
123217
123229
|
/* @__PURE__ */ jsx(Toolbar, {}),
|
|
123218
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center relative", children: /* @__PURE__ */ jsx(Workspace, {}) })
|
|
123230
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center relative", children: /* @__PURE__ */ jsx(Workspace, { width, height, link }) })
|
|
123219
123231
|
] })
|
|
123220
123232
|
] });
|
|
123221
123233
|
}
|
|
123222
|
-
function App(
|
|
123234
|
+
function App({
|
|
123235
|
+
width = 3.5,
|
|
123236
|
+
height = 2,
|
|
123237
|
+
link
|
|
123238
|
+
}) {
|
|
123223
123239
|
return /* @__PURE__ */ jsxs("div", { className: "h-screen antialiased", children: [
|
|
123224
123240
|
/* @__PURE__ */ jsx(StaticTour, {}),
|
|
123225
123241
|
/* @__PURE__ */ jsx(GlobalLoader, {}),
|
|
123226
123242
|
/* @__PURE__ */ jsx(Topbar, {}),
|
|
123227
|
-
/* @__PURE__ */ jsx(Home, {})
|
|
123243
|
+
/* @__PURE__ */ jsx(Home, { width, height, link })
|
|
123228
123244
|
] });
|
|
123229
123245
|
}
|
|
123230
123246
|
export {
|
package/dist/vibrant-tool.umd.js
CHANGED
|
@@ -122474,11 +122474,11 @@ END:VCARD`;
|
|
|
122474
122474
|
resizeCanvas();
|
|
122475
122475
|
return canvas2;
|
|
122476
122476
|
}
|
|
122477
|
-
function createWorkarea(canvas2, container) {
|
|
122477
|
+
function createWorkarea(canvas2, container, sizeInInches = { width: 3.5, height: 2 }) {
|
|
122478
122478
|
const containerWidth = container.clientWidth;
|
|
122479
122479
|
const containerHeight = container.clientHeight;
|
|
122480
|
-
const printWidth =
|
|
122481
|
-
const printHeight =
|
|
122480
|
+
const printWidth = sizeInInches.width + 0.125;
|
|
122481
|
+
const printHeight = sizeInInches.height + 0.125;
|
|
122482
122482
|
const printDPI = 72;
|
|
122483
122483
|
const fullWidth = printWidth * printDPI;
|
|
122484
122484
|
const fullHeight = printHeight * printDPI;
|
|
@@ -122628,7 +122628,7 @@ END:VCARD`;
|
|
|
122628
122628
|
canvas2.off("object:rotating", syncBorder);
|
|
122629
122629
|
};
|
|
122630
122630
|
}
|
|
122631
|
-
async function switchCanvasPage(canvas2, currentPage, targetPage, pageJSON, clearSelection, containerRef) {
|
|
122631
|
+
async function switchCanvasPage(canvas2, currentPage, targetPage, pageJSON, clearSelection, containerRef, data) {
|
|
122632
122632
|
if (targetPage === currentPage) return;
|
|
122633
122633
|
const historyStore = useHistoryStore.getState();
|
|
122634
122634
|
pageJSON[currentPage] = canvas2.toObject(["name"]);
|
|
@@ -122641,7 +122641,7 @@ END:VCARD`;
|
|
|
122641
122641
|
} else {
|
|
122642
122642
|
canvas2.discardActiveObject();
|
|
122643
122643
|
canvas2.clear();
|
|
122644
|
-
createWorkarea(canvas2, containerRef.current);
|
|
122644
|
+
createWorkarea(canvas2, containerRef.current, data);
|
|
122645
122645
|
}
|
|
122646
122646
|
useHistoryStore.setState({ isRestoring: false });
|
|
122647
122647
|
}
|
|
@@ -123062,7 +123062,11 @@ END:VCARD`;
|
|
|
123062
123062
|
};
|
|
123063
123063
|
}, [canvas2, saveState]);
|
|
123064
123064
|
}
|
|
123065
|
-
function Workspace(
|
|
123065
|
+
function Workspace({
|
|
123066
|
+
width = 3.5,
|
|
123067
|
+
height = 2,
|
|
123068
|
+
link
|
|
123069
|
+
}) {
|
|
123066
123070
|
const canvasRef = React.useRef(null);
|
|
123067
123071
|
const containerRef = React.useRef(null);
|
|
123068
123072
|
const fabricRef = React.useRef(null);
|
|
@@ -123086,7 +123090,10 @@ END:VCARD`;
|
|
|
123086
123090
|
fabricRef.current = canvas2;
|
|
123087
123091
|
setCanvas(canvas2);
|
|
123088
123092
|
useHistoryStore.getState().setCanvas(canvas2);
|
|
123089
|
-
const workarea = createWorkarea(canvas2, containerRef.current
|
|
123093
|
+
const workarea = createWorkarea(canvas2, containerRef.current, {
|
|
123094
|
+
width,
|
|
123095
|
+
height
|
|
123096
|
+
});
|
|
123090
123097
|
workareaRef.current = workarea;
|
|
123091
123098
|
const cleanupHistory = setupHistoryRecording(canvas2);
|
|
123092
123099
|
const cleanupCrop = setupDoublClickCrop(canvas2);
|
|
@@ -123153,7 +123160,8 @@ END:VCARD`;
|
|
|
123153
123160
|
page,
|
|
123154
123161
|
pageJSON.current,
|
|
123155
123162
|
clearSelection,
|
|
123156
|
-
containerRef
|
|
123163
|
+
containerRef,
|
|
123164
|
+
{ width, height }
|
|
123157
123165
|
);
|
|
123158
123166
|
useEditorStore.getState().setPages({ ...pageJSON.current });
|
|
123159
123167
|
setCurrentPage(page);
|
|
@@ -123212,21 +123220,29 @@ END:VCARD`;
|
|
|
123212
123220
|
)
|
|
123213
123221
|
] });
|
|
123214
123222
|
}
|
|
123215
|
-
function Home(
|
|
123223
|
+
function Home({
|
|
123224
|
+
width = 3.5,
|
|
123225
|
+
height = 2,
|
|
123226
|
+
link
|
|
123227
|
+
}) {
|
|
123216
123228
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col md:flex-row bg-neutral-900 overflow-hidden h-[calc(100vh-56px)] relative", children: [
|
|
123217
123229
|
/* @__PURE__ */ jsxRuntime.jsx(SidePanel, {}),
|
|
123218
123230
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 bg-[#e4e6eb] flex flex-col items-center overflow-hidden", children: [
|
|
123219
123231
|
/* @__PURE__ */ jsxRuntime.jsx(Toolbar, {}),
|
|
123220
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center relative", children: /* @__PURE__ */ jsxRuntime.jsx(Workspace, {}) })
|
|
123232
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center relative", children: /* @__PURE__ */ jsxRuntime.jsx(Workspace, { width, height, link }) })
|
|
123221
123233
|
] })
|
|
123222
123234
|
] });
|
|
123223
123235
|
}
|
|
123224
|
-
function App(
|
|
123236
|
+
function App({
|
|
123237
|
+
width = 3.5,
|
|
123238
|
+
height = 2,
|
|
123239
|
+
link
|
|
123240
|
+
}) {
|
|
123225
123241
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-screen antialiased", children: [
|
|
123226
123242
|
/* @__PURE__ */ jsxRuntime.jsx(StaticTour, {}),
|
|
123227
123243
|
/* @__PURE__ */ jsxRuntime.jsx(GlobalLoader, {}),
|
|
123228
123244
|
/* @__PURE__ */ jsxRuntime.jsx(Topbar, {}),
|
|
123229
|
-
/* @__PURE__ */ jsxRuntime.jsx(Home, {})
|
|
123245
|
+
/* @__PURE__ */ jsxRuntime.jsx(Home, { width, height, link })
|
|
123230
123246
|
] });
|
|
123231
123247
|
}
|
|
123232
123248
|
exports2.VibrantTool = App;
|