@threedddplus/logoeditor 0.0.1 → 0.0.3
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/LICENSE +20 -20
- package/README.md +181 -181
- package/dist/index.d.ts +4 -1
- package/dist/logoeditor.cjs.development.js +110 -45
- package/dist/logoeditor.cjs.development.js.map +1 -1
- package/dist/logoeditor.cjs.production.min.js +1 -1
- package/dist/logoeditor.cjs.production.min.js.map +1 -1
- package/dist/logoeditor.esm.js +110 -45
- package/dist/logoeditor.esm.js.map +1 -1
- package/dist/store/auth/index.d.ts +2 -0
- package/example/index.html +14 -14
- package/example/index.tsx +41 -41
- package/example/package.json +25 -25
- package/example/tsconfig.json +18 -18
- package/example/yarn.lock +5601 -5601
- package/package.json +125 -125
- package/example/.npmignore +0 -3
package/dist/logoeditor.esm.js
CHANGED
@@ -937,6 +937,8 @@ var setSessionStorage = function setSessionStorage(cname, cvalue) {
|
|
937
937
|
|
938
938
|
var authSlice = function authSlice(set, get) {
|
939
939
|
return {
|
940
|
+
customUploadLogoColorList: [],
|
941
|
+
defaultColorList: [],
|
940
942
|
priceLevel: '',
|
941
943
|
token: '',
|
942
944
|
clearLoginInfo: function clearLoginInfo() {
|
@@ -1235,40 +1237,77 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
1235
1237
|
return console.log('error', error);
|
1236
1238
|
});
|
1237
1239
|
},
|
1240
|
+
// loadingRetrivedFiles: (data: any) => {
|
1241
|
+
// let canvas = use3dddPlus.getState().fabricCanvas;
|
1242
|
+
// canvas.loadFromJSON(JSON.parse(data), function () {
|
1243
|
+
// canvas.renderAll.bind(canvas);
|
1244
|
+
// use3dddPlus.setState({ selectedStepper: undefined });
|
1245
|
+
// let objImage = canvas?.getObjects()._objects;
|
1246
|
+
// let _Fills = [];
|
1247
|
+
// objImage?.forEach((ele) => {
|
1248
|
+
// ele.set({ strokeWidth: 0 });
|
1249
|
+
// use3dddPlus.setState({ fillColor: [...ele.fill] });
|
1250
|
+
// _Fills.push(ele.fill);
|
1251
|
+
// });
|
1252
|
+
// use3dddPlus.setState({
|
1253
|
+
// //@ts-ignore
|
1254
|
+
// fillColor: use3dddPlus.getState().removeDuplicates(_Fills),
|
1255
|
+
// });
|
1256
|
+
// //@ts-ignore
|
1257
|
+
// _Fills = use3dddPlus.getState().removeDuplicates(_Fills);
|
1258
|
+
// const fillColors = {};
|
1259
|
+
// _Fills.map((item, index) => {
|
1260
|
+
// fillColors['layer' + index] = item;
|
1261
|
+
// });
|
1262
|
+
// use3dddPlus.setState({ colorFill: fillColors });
|
1263
|
+
// canvas?.getObjects().set({
|
1264
|
+
// colorFill: fillColors,
|
1265
|
+
// // setControlVisible:false,
|
1266
|
+
// });
|
1267
|
+
// });
|
1268
|
+
// },
|
1238
1269
|
loadingRetrivedFiles: function loadingRetrivedFiles(data) {
|
1239
1270
|
var canvas = use3dddPlus.getState().fabricCanvas;
|
1240
1271
|
canvas.loadFromJSON(JSON.parse(data), function () {
|
1241
|
-
canvas.renderAll
|
1272
|
+
canvas.renderAll();
|
1242
1273
|
use3dddPlus.setState({
|
1243
1274
|
selectedStepper: undefined
|
1244
1275
|
});
|
1245
|
-
var objImage = canvas.getObjects()
|
1246
|
-
var _Fills = [];
|
1276
|
+
var objImage = canvas == null ? void 0 : canvas.getObjects();
|
1247
1277
|
objImage == null ? void 0 : objImage.forEach(function (ele) {
|
1248
|
-
ele.
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1278
|
+
if (ele.type === 'path') {
|
1279
|
+
// Assuming SVG paths have fill property
|
1280
|
+
var fillColor = ele.fill;
|
1281
|
+
ele.set({
|
1282
|
+
strokeWidth: 0
|
1283
|
+
});
|
1284
|
+
use3dddPlus.setState({
|
1285
|
+
fillColor: [].concat(fillColor)
|
1286
|
+
});
|
1287
|
+
}
|
1255
1288
|
});
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1289
|
+
var _Fills = objImage == null ? void 0 : objImage.filter(function (ele) {
|
1290
|
+
return ele.type === 'path';
|
1291
|
+
}).map(function (ele) {
|
1292
|
+
return ele.fill;
|
1259
1293
|
});
|
1260
|
-
//@ts-ignore
|
1261
1294
|
_Fills = use3dddPlus.getState().removeDuplicates(_Fills);
|
1262
|
-
var fillColors = {
|
1263
|
-
|
1264
|
-
|
1265
|
-
});
|
1295
|
+
var fillColors = _Fills.reduce(function (colors, item, index) {
|
1296
|
+
colors['layer' + index] = item;
|
1297
|
+
return colors;
|
1298
|
+
}, {});
|
1266
1299
|
use3dddPlus.setState({
|
1300
|
+
fillColor: _Fills,
|
1267
1301
|
colorFill: fillColors
|
1268
1302
|
});
|
1269
|
-
|
1270
|
-
|
1303
|
+
objImage == null ? void 0 : objImage.filter(function (ele) {
|
1304
|
+
return ele.type === 'path';
|
1305
|
+
}).forEach(function (obj) {
|
1306
|
+
obj.set({
|
1307
|
+
colorFill: fillColors
|
1308
|
+
});
|
1271
1309
|
});
|
1310
|
+
canvas == null ? void 0 : canvas.renderAll();
|
1272
1311
|
});
|
1273
1312
|
},
|
1274
1313
|
uploadLogoConfig: function () {
|
@@ -1322,8 +1361,8 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
1322
1361
|
};
|
1323
1362
|
};
|
1324
1363
|
|
1325
|
-
/* This Source Code Form is subject to the terms of the Mozilla Public
|
1326
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
1364
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
1365
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
1327
1366
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1328
1367
|
|
1329
1368
|
function TIFFParser() {
|
@@ -1927,8 +1966,8 @@ TIFFParser.prototype = {
|
|
1927
1966
|
}
|
1928
1967
|
}
|
1929
1968
|
|
1930
|
-
/* for (var i = 0, numFileDirectories = this.fileDirectories.length; i < numFileDirectories; i++) {
|
1931
|
-
// Stuff
|
1969
|
+
/* for (var i = 0, numFileDirectories = this.fileDirectories.length; i < numFileDirectories; i++) {
|
1970
|
+
// Stuff
|
1932
1971
|
}*/
|
1933
1972
|
|
1934
1973
|
return this.canvas;
|
@@ -2484,7 +2523,7 @@ var AddMascots = function AddMascots(props) {
|
|
2484
2523
|
}, {
|
2485
2524
|
tag: 'g',
|
2486
2525
|
attr: {
|
2487
|
-
'
|
2526
|
+
'clipPath': 'url(#a)'
|
2488
2527
|
},
|
2489
2528
|
child: [{
|
2490
2529
|
tag: 'path',
|
@@ -2566,7 +2605,7 @@ var ProductColor = function ProductColor(props) {
|
|
2566
2605
|
}, {
|
2567
2606
|
tag: 'g',
|
2568
2607
|
attr: {
|
2569
|
-
'
|
2608
|
+
'clipPath': 'url(#a)'
|
2570
2609
|
},
|
2571
2610
|
child: [{
|
2572
2611
|
tag: 'path',
|
@@ -2615,7 +2654,7 @@ var FlipH = function FlipH(props) {
|
|
2615
2654
|
tag: 'g',
|
2616
2655
|
attr: {
|
2617
2656
|
'data-name': 'Group 577',
|
2618
|
-
'
|
2657
|
+
'clipPath': 'url(#a)',
|
2619
2658
|
fill: '#353535'
|
2620
2659
|
},
|
2621
2660
|
child: [{
|
@@ -2751,7 +2790,7 @@ var FlipV = function FlipV(props) {
|
|
2751
2790
|
tag: 'g',
|
2752
2791
|
attr: {
|
2753
2792
|
'data-name': 'Group 577',
|
2754
|
-
'
|
2793
|
+
'clipPath': 'url(#a)',
|
2755
2794
|
fill: '#353535',
|
2756
2795
|
transform: 'rotate(90 12.239 21.239)'
|
2757
2796
|
},
|
@@ -3164,7 +3203,7 @@ var EyeDropper = function EyeDropper(props) {
|
|
3164
3203
|
}, {
|
3165
3204
|
tag: 'g',
|
3166
3205
|
attr: {
|
3167
|
-
'
|
3206
|
+
'clipPath': 'url(#a)'
|
3168
3207
|
},
|
3169
3208
|
child: [{
|
3170
3209
|
tag: 'path',
|
@@ -3530,9 +3569,13 @@ var initCanvas = function initCanvas() {
|
|
3530
3569
|
if (!(canv != null && canv.getObjects())) {
|
3531
3570
|
return;
|
3532
3571
|
}
|
3533
|
-
var allColor =
|
3534
|
-
|
3535
|
-
|
3572
|
+
var allColor = new Set(canv == null ? void 0 : (_canv$getObjects = canv.getObjects()) == null ? void 0 : _canv$getObjects.map(function (item) {
|
3573
|
+
// Check if 'item' and 'colorFill' are not undefined or null
|
3574
|
+
if (item && item['colorFill'] != null) {
|
3575
|
+
return Object.values(item['colorFill']);
|
3576
|
+
}
|
3577
|
+
return [];
|
3578
|
+
}).flat()); // FOR REMOVING ALL DUPLICATE COLOR CODES
|
3536
3579
|
// const allColor =[];
|
3537
3580
|
use3dddPlus.setState({
|
3538
3581
|
allColor: allColor
|
@@ -3926,6 +3969,7 @@ var ColorPalette = function ColorPalette(_ref) {
|
|
3926
3969
|
className: "flex flex-wrap gap-x-[0.8125rem] gap-y-[0.3125rem] pb-[2.0938rem] max-h-[3.75rem] overflow-y-auto"
|
3927
3970
|
}, colorList == null ? void 0 : colorList.map(function (color, index) {
|
3928
3971
|
return React.createElement(ColorBox, {
|
3972
|
+
key: "main-" + mainIndex + "-" + index,
|
3929
3973
|
color: color,
|
3930
3974
|
index: index,
|
3931
3975
|
onClick: function onClick() {
|
@@ -3941,6 +3985,7 @@ var ColorPalette = function ColorPalette(_ref) {
|
|
3941
3985
|
className: "flex flex-wrap gap-x-[0.8125rem] gap-y-[0.3125rem] border-b border-b-[#EBEBEB] " + previousClass
|
3942
3986
|
}, previousColor == null ? void 0 : previousColor.map(function (color, index) {
|
3943
3987
|
return React.createElement(ColorBox, {
|
3988
|
+
key: "previous-" + mainIndex + "-" + index,
|
3944
3989
|
color: color,
|
3945
3990
|
index: 'previous' + index,
|
3946
3991
|
onClick: function onClick() {
|
@@ -4598,8 +4643,10 @@ var MyLogo$1 = function MyLogo(_ref) {
|
|
4598
4643
|
className: "flex ml-[33px] mt-[30px] overflow-y-auto overflow-x-hidden h-[65vh]"
|
4599
4644
|
}, React.createElement("div", {
|
4600
4645
|
className: "max-h-[140px] grid gap-3.5 grid-cols-3 md:grid-cols-4 lg:grid-cols-5 w-full "
|
4601
|
-
}, retriveLogoDesign.length > 0 ? retriveLogoDesign.map(function (logo) {
|
4602
|
-
return React.createElement(React.Fragment,
|
4646
|
+
}, retriveLogoDesign.length > 0 ? retriveLogoDesign.map(function (logo, index) {
|
4647
|
+
return React.createElement(React.Fragment, {
|
4648
|
+
key: index
|
4649
|
+
}, React.createElement(Card, {
|
4603
4650
|
cardClass: "rounded-none bg-white cursor-pointer",
|
4604
4651
|
style: {
|
4605
4652
|
boxShadow: '0px 0px 6px #98989829'
|
@@ -4790,14 +4837,14 @@ var ImageEdit = function ImageEdit(_ref) {
|
|
4790
4837
|
}, "Flip"), React.createElement("div", {
|
4791
4838
|
className: "flex gap-x-[1rem] mt-[12px]"
|
4792
4839
|
}, React.createElement(IconButton, {
|
4793
|
-
key: "
|
4840
|
+
key: "index_flipX",
|
4794
4841
|
label: "",
|
4795
4842
|
icon: React.createElement(FlipH, null),
|
4796
4843
|
onClick: flipX,
|
4797
4844
|
className: "w-[45px] h-[45px] bg-[#fff] cursor-pointer border border-[#EBEBEB]",
|
4798
4845
|
size: "1.8rem"
|
4799
4846
|
}), React.createElement(IconButton, {
|
4800
|
-
key: "
|
4847
|
+
key: "index_flipY",
|
4801
4848
|
label: "",
|
4802
4849
|
onClick: flipY,
|
4803
4850
|
icon: React.createElement(FlipV, null),
|
@@ -5223,9 +5270,10 @@ var Rightmenu = function Rightmenu() {
|
|
5223
5270
|
id: "FontStyleNumber",
|
5224
5271
|
onChange: fontChange,
|
5225
5272
|
className: INPUT_BG_COLOR + " font-bold " + TEXT_COLOR_1 + " " + TEXT_SIZE_3 + " border border-solid\t " + BORDER_COLOR_1 + " select select-bordered w-full rounded-none focus:outline-current focus:outline-offset-0 focus:rounded-sm mb-[16.5px]"
|
5226
|
-
}, fontFamilies.map(function (list) {
|
5273
|
+
}, fontFamilies.map(function (list, index) {
|
5227
5274
|
return React.createElement(React.Fragment, null, React.createElement("option", {
|
5228
|
-
value: list.name
|
5275
|
+
value: list.name,
|
5276
|
+
key: index
|
5229
5277
|
}, list.name));
|
5230
5278
|
})), React.createElement("div", {
|
5231
5279
|
className: "uppercase font-bold text-sm mb-[8.5px]"
|
@@ -5362,7 +5410,7 @@ var Rightmenu = function Rightmenu() {
|
|
5362
5410
|
className: "uppercase font-bold pt-[17px]"
|
5363
5411
|
}, "Color in Canvas"), React.createElement("div", {
|
5364
5412
|
className: "flex gap-x-[1rem] mt-[12px] mb-[12px]"
|
5365
|
-
}, allColor == null ? void 0 : allColor.map(function (item) {
|
5413
|
+
}, allColor.length > 0 && (allColor == null ? void 0 : allColor.map(function (item) {
|
5366
5414
|
return React.createElement(ColorImpl, {
|
5367
5415
|
mClass: 'ml-[36px]',
|
5368
5416
|
key: item,
|
@@ -5370,7 +5418,7 @@ var Rightmenu = function Rightmenu() {
|
|
5370
5418
|
property: item,
|
5371
5419
|
color: item
|
5372
5420
|
});
|
5373
|
-
})), React.createElement("button", {
|
5421
|
+
}))), React.createElement("button", {
|
5374
5422
|
onClick: nudgeMove,
|
5375
5423
|
id: "down",
|
5376
5424
|
className: "font-medium text-orange-400"
|
@@ -5414,7 +5462,7 @@ var Rightmenu = function Rightmenu() {
|
|
5414
5462
|
className: "uppercase font-bold pt-[17px]"
|
5415
5463
|
}, "Color in Canvas"), React.createElement("div", {
|
5416
5464
|
className: "flex gap-x-[1rem] mt-[12px]"
|
5417
|
-
}, allColor == null ? void 0 : allColor.map(function (item) {
|
5465
|
+
}, allColor.length > 0 && (allColor == null ? void 0 : allColor.map(function (item) {
|
5418
5466
|
return React.createElement(ColorImpl, {
|
5419
5467
|
mClass: 'ml-[36px]',
|
5420
5468
|
key: item,
|
@@ -5422,7 +5470,7 @@ var Rightmenu = function Rightmenu() {
|
|
5422
5470
|
property: item,
|
5423
5471
|
color: item
|
5424
5472
|
});
|
5425
|
-
})))), React.createElement("button", {
|
5473
|
+
}))))), React.createElement("button", {
|
5426
5474
|
type: "button",
|
5427
5475
|
className: "mt-3 inline-flex justify-center bg-white px-[110px] py-2 text-sm font-medium text-[#E11A38] shadow-sm ring-1 ring-inset ring-[#E11A38] hover:bg-gray-50 sm:mt-0 w-full",
|
5428
5476
|
onClick: onSave
|
@@ -5848,14 +5896,31 @@ var MiddleMenu = function MiddleMenu(_ref) {
|
|
5848
5896
|
*/
|
5849
5897
|
var LogoEditor = function LogoEditor(_ref) {
|
5850
5898
|
var stepperId = _ref.stepperId,
|
5851
|
-
onApply = _ref.onApply
|
5899
|
+
onApply = _ref.onApply,
|
5900
|
+
customLogoColorList = _ref.customLogoColorList,
|
5901
|
+
defaultColorList = _ref.defaultColorList,
|
5902
|
+
logoData = _ref.logoData;
|
5852
5903
|
var _use3dddPlus = use3dddPlus(function (state) {
|
5853
|
-
return [state.setSelectedStepper];
|
5904
|
+
return [state.setSelectedStepper, state.myLogoHandler];
|
5854
5905
|
}),
|
5855
|
-
setSelectedStepper = _use3dddPlus[0]
|
5906
|
+
setSelectedStepper = _use3dddPlus[0],
|
5907
|
+
myLogoHandler = _use3dddPlus[1];
|
5856
5908
|
React.useEffect(function () {
|
5857
5909
|
setSelectedStepper(stepperId);
|
5910
|
+
if (stepperId == undefined) {
|
5911
|
+
myLogoHandler(logoData);
|
5912
|
+
}
|
5858
5913
|
}, [stepperId]);
|
5914
|
+
React.useEffect(function () {
|
5915
|
+
use3dddPlus.setState({
|
5916
|
+
customUploadLogoColorList: customLogoColorList
|
5917
|
+
});
|
5918
|
+
}, [customLogoColorList]);
|
5919
|
+
React.useEffect(function () {
|
5920
|
+
use3dddPlus.setState({
|
5921
|
+
defaultColorList: defaultColorList
|
5922
|
+
});
|
5923
|
+
}, [defaultColorList]);
|
5859
5924
|
return (
|
5860
5925
|
// <Modal
|
5861
5926
|
// backdropStyle={`z-[7]`}
|