labellife-design-tool 1.2.1 → 1.2.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/lib/lib/index.js
CHANGED
|
@@ -3331,27 +3331,53 @@ var CanvasEditor = ({
|
|
|
3331
3331
|
width: 800,
|
|
3332
3332
|
height: 600
|
|
3333
3333
|
});
|
|
3334
|
-
const [design, setDesign] = useState3({
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3334
|
+
const [design, setDesign] = useState3(() => {
|
|
3335
|
+
if (externalStore) {
|
|
3336
|
+
return externalStore.design;
|
|
3337
|
+
}
|
|
3338
|
+
return {
|
|
3339
|
+
id: Date.now().toString(),
|
|
3340
|
+
name: "Untitled Design",
|
|
3341
|
+
width: 800,
|
|
3342
|
+
height: 600,
|
|
3343
|
+
pages: [
|
|
3344
|
+
{
|
|
3345
|
+
id: "1",
|
|
3346
|
+
name: "Page 1",
|
|
3347
|
+
elements: [],
|
|
3348
|
+
background: "#ffffff"
|
|
3349
|
+
}
|
|
3350
|
+
],
|
|
3351
|
+
fonts: FONT_FAMILIES,
|
|
3352
|
+
colors: DEFAULT_COLORS
|
|
3353
|
+
};
|
|
3349
3354
|
});
|
|
3350
|
-
const [currentPageId, setCurrentPageId] = useState3("1");
|
|
3355
|
+
const [currentPageId, setCurrentPageId] = useState3(() => externalStore?.activePageId || "1");
|
|
3351
3356
|
const [selectedId, setSelectedId] = useState3(null);
|
|
3352
3357
|
const [selectedIds, setSelectedIds] = useState3([]);
|
|
3353
3358
|
const [tool, setTool] = useState3("select");
|
|
3354
3359
|
const [activePanelId, setActivePanelId] = useState3("elements");
|
|
3360
|
+
useEffect4(() => {
|
|
3361
|
+
if (externalStore) {
|
|
3362
|
+
const handleDesignChange = (newDesign) => {
|
|
3363
|
+
setDesign(newDesign);
|
|
3364
|
+
};
|
|
3365
|
+
const handleActivePageChange = (pageId) => {
|
|
3366
|
+
setCurrentPageId(pageId);
|
|
3367
|
+
};
|
|
3368
|
+
const handleActivePanelChange = (panelId) => {
|
|
3369
|
+
setActivePanelId(panelId || "elements");
|
|
3370
|
+
};
|
|
3371
|
+
externalStore.on("designChanged", handleDesignChange);
|
|
3372
|
+
externalStore.on("activePageChanged", handleActivePageChange);
|
|
3373
|
+
externalStore.on("activePanelChanged", handleActivePanelChange);
|
|
3374
|
+
return () => {
|
|
3375
|
+
externalStore.off("designChanged");
|
|
3376
|
+
externalStore.off("activePageChanged");
|
|
3377
|
+
externalStore.off("activePanelChanged");
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
}, [externalStore]);
|
|
3355
3381
|
const [showUnsplash, setShowUnsplash] = useState3(false);
|
|
3356
3382
|
const [unsplashQuery, setUnsplashQuery] = useState3("");
|
|
3357
3383
|
const [unsplashResults, setUnsplashResults] = useState3([]);
|
|
@@ -3407,17 +3433,18 @@ var CanvasEditor = ({
|
|
|
3407
3433
|
textCase: "none",
|
|
3408
3434
|
strikethrough: false
|
|
3409
3435
|
};
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3436
|
+
const newDesign = {
|
|
3437
|
+
...design,
|
|
3438
|
+
pages: design.pages.map((page) => page.id === currentPageId ? { ...page, elements: [...page.elements, newElement] } : page)
|
|
3439
|
+
};
|
|
3440
|
+
setDesign(newDesign);
|
|
3441
|
+
saveToHistory(newDesign);
|
|
3442
|
+
if (externalStore) {
|
|
3443
|
+
externalStore.setDesign(newDesign);
|
|
3444
|
+
}
|
|
3418
3445
|
setSelectedId(newElement.id);
|
|
3419
3446
|
setTool("select");
|
|
3420
|
-
}, [currentPageId, saveToHistory, design.width, design.height]);
|
|
3447
|
+
}, [currentPageId, saveToHistory, design.width, design.height, externalStore]);
|
|
3421
3448
|
const addShape = useCallback4((shapeType) => {
|
|
3422
3449
|
const newElement = {
|
|
3423
3450
|
id: Date.now().toString(),
|
package/dist/lib/wordpress.js
CHANGED
|
@@ -3331,27 +3331,53 @@ var CanvasEditor = ({
|
|
|
3331
3331
|
width: 800,
|
|
3332
3332
|
height: 600
|
|
3333
3333
|
});
|
|
3334
|
-
const [design, setDesign] = useState3({
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3334
|
+
const [design, setDesign] = useState3(() => {
|
|
3335
|
+
if (externalStore) {
|
|
3336
|
+
return externalStore.design;
|
|
3337
|
+
}
|
|
3338
|
+
return {
|
|
3339
|
+
id: Date.now().toString(),
|
|
3340
|
+
name: "Untitled Design",
|
|
3341
|
+
width: 800,
|
|
3342
|
+
height: 600,
|
|
3343
|
+
pages: [
|
|
3344
|
+
{
|
|
3345
|
+
id: "1",
|
|
3346
|
+
name: "Page 1",
|
|
3347
|
+
elements: [],
|
|
3348
|
+
background: "#ffffff"
|
|
3349
|
+
}
|
|
3350
|
+
],
|
|
3351
|
+
fonts: FONT_FAMILIES,
|
|
3352
|
+
colors: DEFAULT_COLORS
|
|
3353
|
+
};
|
|
3349
3354
|
});
|
|
3350
|
-
const [currentPageId, setCurrentPageId] = useState3("1");
|
|
3355
|
+
const [currentPageId, setCurrentPageId] = useState3(() => externalStore?.activePageId || "1");
|
|
3351
3356
|
const [selectedId, setSelectedId] = useState3(null);
|
|
3352
3357
|
const [selectedIds, setSelectedIds] = useState3([]);
|
|
3353
3358
|
const [tool, setTool] = useState3("select");
|
|
3354
3359
|
const [activePanelId, setActivePanelId] = useState3("elements");
|
|
3360
|
+
useEffect4(() => {
|
|
3361
|
+
if (externalStore) {
|
|
3362
|
+
const handleDesignChange = (newDesign) => {
|
|
3363
|
+
setDesign(newDesign);
|
|
3364
|
+
};
|
|
3365
|
+
const handleActivePageChange = (pageId) => {
|
|
3366
|
+
setCurrentPageId(pageId);
|
|
3367
|
+
};
|
|
3368
|
+
const handleActivePanelChange = (panelId) => {
|
|
3369
|
+
setActivePanelId(panelId || "elements");
|
|
3370
|
+
};
|
|
3371
|
+
externalStore.on("designChanged", handleDesignChange);
|
|
3372
|
+
externalStore.on("activePageChanged", handleActivePageChange);
|
|
3373
|
+
externalStore.on("activePanelChanged", handleActivePanelChange);
|
|
3374
|
+
return () => {
|
|
3375
|
+
externalStore.off("designChanged");
|
|
3376
|
+
externalStore.off("activePageChanged");
|
|
3377
|
+
externalStore.off("activePanelChanged");
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
}, [externalStore]);
|
|
3355
3381
|
const [showUnsplash, setShowUnsplash] = useState3(false);
|
|
3356
3382
|
const [unsplashQuery, setUnsplashQuery] = useState3("");
|
|
3357
3383
|
const [unsplashResults, setUnsplashResults] = useState3([]);
|
|
@@ -3407,17 +3433,18 @@ var CanvasEditor = ({
|
|
|
3407
3433
|
textCase: "none",
|
|
3408
3434
|
strikethrough: false
|
|
3409
3435
|
};
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3436
|
+
const newDesign = {
|
|
3437
|
+
...design,
|
|
3438
|
+
pages: design.pages.map((page) => page.id === currentPageId ? { ...page, elements: [...page.elements, newElement] } : page)
|
|
3439
|
+
};
|
|
3440
|
+
setDesign(newDesign);
|
|
3441
|
+
saveToHistory(newDesign);
|
|
3442
|
+
if (externalStore) {
|
|
3443
|
+
externalStore.setDesign(newDesign);
|
|
3444
|
+
}
|
|
3418
3445
|
setSelectedId(newElement.id);
|
|
3419
3446
|
setTool("select");
|
|
3420
|
-
}, [currentPageId, saveToHistory, design.width, design.height]);
|
|
3447
|
+
}, [currentPageId, saveToHistory, design.width, design.height, externalStore]);
|
|
3421
3448
|
const addShape = useCallback4((shapeType) => {
|
|
3422
3449
|
const newElement = {
|
|
3423
3450
|
id: Date.now().toString(),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Config
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
import { SimpleCanvasStore } from "./store/simpleStore";
|
|
3
4
|
declare const CanvasEditor: React.FC<{
|
|
4
5
|
name: string;
|
|
5
6
|
config?: Config;
|
|
6
|
-
store?:
|
|
7
|
+
store?: SimpleCanvasStore;
|
|
7
8
|
}>;
|
|
8
9
|
export default CanvasEditor;
|
|
9
10
|
//# sourceMappingURL=CanvasEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasEditor.d.ts","sourceRoot":"","sources":["../../src/CanvasEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6F,MAAM,OAAO,CAAC;AAkFlH,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"CanvasEditor.d.ts","sourceRoot":"","sources":["../../src/CanvasEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6F,MAAM,OAAO,CAAC;AAkFlH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAqB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAqhCxF,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED