my-animated-components 1.4.2 → 1.4.4
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/index.d.ts +2 -2
- package/dist/index.js +53 -90
- package/package.json +1 -1
- package/readme.md +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -601,6 +601,6 @@ interface ImageEditorProps {
|
|
|
601
601
|
onCancel: () => void;
|
|
602
602
|
className?: string;
|
|
603
603
|
}
|
|
604
|
-
declare const
|
|
604
|
+
declare const Imageeditor: React$1.FC<ImageEditorProps>;
|
|
605
605
|
|
|
606
|
-
export { Accordion, Alert, Avatar, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Container, Dropdown, DropdownItem, FileUpload, Flex, Grid, Heading, IconButton,
|
|
606
|
+
export { Accordion, Alert, Avatar, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Container, Dropdown, DropdownItem, FileUpload, Flex, Grid, Heading, IconButton, Imageeditor, Input, List, ListItem, Modal, ModalBody, ModalFooter, ModalHeader, NavItem, Navbar, Offcanvas, OffcanvasBody, OffcanvasHeader, Pagination, ProgressBar, Radio, RangeSlider, Select, Skeleton, Slider, Stepper, Switch, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Text, Textarea, Tooltip, motionVariants };
|
package/dist/index.js
CHANGED
|
@@ -1411,13 +1411,13 @@ const Text = ({ children, className = '', size = 'md', weight = 'normal', ...res
|
|
|
1411
1411
|
};
|
|
1412
1412
|
|
|
1413
1413
|
// Custom SVG Icons
|
|
1414
|
-
const CropIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1414
|
+
const CropIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1415
1415
|
React.createElement("path", { d: "M6 2V6H2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1416
1416
|
React.createElement("path", { d: "M18 2V6H22", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1417
1417
|
React.createElement("path", { d: "M18 22V18H22", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1418
1418
|
React.createElement("path", { d: "M6 22V18H2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1419
1419
|
React.createElement("rect", { x: "8", y: "8", width: "8", height: "8", stroke: "currentColor", strokeWidth: "2" })));
|
|
1420
|
-
const PaletteIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1420
|
+
const PaletteIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1421
1421
|
React.createElement("path", { d: "M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
1422
1422
|
React.createElement("path", { d: "M20 12C21.1 12 22 12.9 22 14C22 15.1 21.1 16 20 16C18.9 16 18 15.1 18 14C18 12.9 18.9 12 20 12Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
1423
1423
|
React.createElement("path", { d: "M4 12C5.1 12 6 12.9 6 14C6 15.1 5.1 16 4 16C2.9 16 2 15.1 2 14C2 12.9 2.9 12 4 12Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
@@ -1426,30 +1426,30 @@ const PaletteIcon = ({ size = 16, className = "" }) => (React.createElement("svg
|
|
|
1426
1426
|
React.createElement("path", { d: "M17 7C18.1 7 19 7.9 19 9C19 10.1 18.1 11 17 11C15.9 11 15 10.1 15 9C15 7.9 15.9 7 17 7Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
1427
1427
|
React.createElement("path", { d: "M7 17C8.1 17 9 17.9 9 19C9 20.1 8.1 21 7 21C5.9 21 5 20.1 5 19C5 17.9 5.9 17 7 17Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
1428
1428
|
React.createElement("path", { d: "M17 17C18.1 17 19 17.9 19 19C19 20.1 18.1 21 17 21C15.9 21 15 20.1 15 19C15 17.9 15.9 17 17 17Z", stroke: "currentColor", strokeWidth: "2" })));
|
|
1429
|
-
const SparklesIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1429
|
+
const SparklesIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1430
1430
|
React.createElement("path", { d: "M9.5 1L11 4.5L14.5 6L11 7.5L9.5 11L8 7.5L4.5 6L8 4.5L9.5 1Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
1431
1431
|
React.createElement("path", { d: "M17.5 8L18.5 10.5L21 11.5L18.5 12.5L17.5 15L16.5 12.5L14 11.5L16.5 10.5L17.5 8Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
1432
1432
|
React.createElement("path", { d: "M5.5 13L6.5 15.5L9 16.5L6.5 17.5L5.5 20L4.5 17.5L2 16.5L4.5 15.5L5.5 13Z", stroke: "currentColor", strokeWidth: "2" })));
|
|
1433
|
-
const RotateIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1433
|
+
const RotateIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1434
1434
|
React.createElement("path", { d: "M23 4V10H17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1435
1435
|
React.createElement("path", { d: "M1 20V14H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1436
1436
|
React.createElement("path", { d: "M3.51 9C4.01717 7.56678 4.87913 6.2854 6.01547 5.27542C7.1518 4.26543 8.52547 3.55976 10.0083 3.22426C11.4911 2.88875 13.0348 2.93434 14.4952 3.35677C15.9556 3.77921 17.2853 4.56471 18.36 5.64L23 10M1 14L5.64 18.36C6.71475 19.4353 8.04437 20.2208 9.50481 20.6432C10.9652 21.0657 12.5089 21.1113 13.9917 20.7757C15.4745 20.4402 16.8482 19.7346 17.9845 18.7246C19.1209 17.7146 19.9828 16.4332 20.49 15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1437
|
-
const FlipHorizontalIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1437
|
+
const FlipHorizontalIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1438
1438
|
React.createElement("path", { d: "M3 12H21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1439
1439
|
React.createElement("path", { d: "M12 3V21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1440
1440
|
React.createElement("path", { d: "M7 7L3 12L7 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1441
1441
|
React.createElement("path", { d: "M17 7L21 12L17 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1442
|
-
const FlipVerticalIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1442
|
+
const FlipVerticalIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1443
1443
|
React.createElement("path", { d: "M12 3V21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1444
1444
|
React.createElement("path", { d: "M3 12H21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1445
1445
|
React.createElement("path", { d: "M7 7L12 3L17 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1446
1446
|
React.createElement("path", { d: "M7 17L12 21L17 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1447
|
-
const ZoomInIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1447
|
+
const ZoomInIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1448
1448
|
React.createElement("circle", { cx: "11", cy: "11", r: "8", stroke: "currentColor", strokeWidth: "2" }),
|
|
1449
1449
|
React.createElement("path", { d: "M21 21L16.65 16.65", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1450
1450
|
React.createElement("path", { d: "M11 8V14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1451
1451
|
React.createElement("path", { d: "M8 11H14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })));
|
|
1452
|
-
const SunIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1452
|
+
const SunIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1453
1453
|
React.createElement("circle", { cx: "12", cy: "12", r: "5", stroke: "currentColor", strokeWidth: "2" }),
|
|
1454
1454
|
React.createElement("path", { d: "M12 1V3", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1455
1455
|
React.createElement("path", { d: "M12 21V23", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
@@ -1459,27 +1459,27 @@ const SunIcon = ({ size = 16, className = "" }) => (React.createElement("svg", {
|
|
|
1459
1459
|
React.createElement("path", { d: "M21 12H23", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1460
1460
|
React.createElement("path", { d: "M4.22 19.78L5.64 18.36", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1461
1461
|
React.createElement("path", { d: "M18.36 5.64L19.78 4.22", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })));
|
|
1462
|
-
const ContrastIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1462
|
+
const ContrastIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1463
1463
|
React.createElement("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2" }),
|
|
1464
1464
|
React.createElement("path", { d: "M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18Z", stroke: "currentColor", strokeWidth: "2" })));
|
|
1465
|
-
const DropletIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1465
|
+
const DropletIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1466
1466
|
React.createElement("path", { d: "M12 22C16.4183 22 20 18.4183 20 14C20 8 12 2 12 2C12 2 4 8 4 14C4 18.4183 7.58172 22 12 22Z", stroke: "currentColor", strokeWidth: "2" })));
|
|
1467
|
-
const ApertureIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1467
|
+
const ApertureIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1468
1468
|
React.createElement("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2" }),
|
|
1469
1469
|
React.createElement("path", { d: "M14.31 8L20.05 17.94", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1470
1470
|
React.createElement("path", { d: "M9.69 8L3.95 17.94", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1471
1471
|
React.createElement("path", { d: "M18.62 15L5.38 15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
1472
1472
|
React.createElement("path", { d: "M12 2V22", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })));
|
|
1473
|
-
const XIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1473
|
+
const XIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1474
1474
|
React.createElement("path", { d: "M18 6L6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1475
1475
|
React.createElement("path", { d: "M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1476
|
-
const CheckIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1476
|
+
const CheckIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1477
1477
|
React.createElement("path", { d: "M20 6L9 17L4 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1478
|
-
const ChevronLeftIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1478
|
+
const ChevronLeftIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1479
1479
|
React.createElement("path", { d: "M15 18L9 12L15 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1480
|
-
const ChevronRightIcon = ({ size = 16, className = "" }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className },
|
|
1480
|
+
const ChevronRightIcon = ({ size = 16, className = "", style = {} }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, style: style },
|
|
1481
1481
|
React.createElement("path", { d: "M9 18L15 12L9 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
1482
|
-
const
|
|
1482
|
+
const Imageeditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
1483
1483
|
const canvasRef = React.useRef(null);
|
|
1484
1484
|
const [activeTab, setActiveTab] = React.useState('crop');
|
|
1485
1485
|
const [originalImage, setOriginalImage] = React.useState(null);
|
|
@@ -1529,10 +1529,9 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1529
1529
|
hue,
|
|
1530
1530
|
cropArea
|
|
1531
1531
|
}), [rotation, flipH, flipV, zoom, brightness, contrast, saturation, blur, hue, cropArea]);
|
|
1532
|
-
const saveToHistory = React.useCallback((
|
|
1533
|
-
const currentState = state || getCurrentState();
|
|
1532
|
+
const saveToHistory = React.useCallback(() => {
|
|
1534
1533
|
const newHistory = history.slice(0, historyIndex + 1);
|
|
1535
|
-
newHistory.push(
|
|
1534
|
+
newHistory.push(getCurrentState());
|
|
1536
1535
|
setHistory(newHistory);
|
|
1537
1536
|
setHistoryIndex(newHistory.length - 1);
|
|
1538
1537
|
}, [history, historyIndex, getCurrentState]);
|
|
@@ -1550,7 +1549,7 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1550
1549
|
setHistoryIndex(historyIndex + 1);
|
|
1551
1550
|
}
|
|
1552
1551
|
}, [historyIndex, history]);
|
|
1553
|
-
const applyState =
|
|
1552
|
+
const applyState = (state) => {
|
|
1554
1553
|
setRotation(state.rotation);
|
|
1555
1554
|
setFlipH(state.flipH);
|
|
1556
1555
|
setFlipV(state.flipV);
|
|
@@ -1561,43 +1560,28 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1561
1560
|
setBlur(state.blur);
|
|
1562
1561
|
setHue(state.hue);
|
|
1563
1562
|
setCropArea(state.cropArea);
|
|
1564
|
-
}
|
|
1565
|
-
// Initialize with first state
|
|
1563
|
+
};
|
|
1566
1564
|
React.useEffect(() => {
|
|
1567
|
-
if (imageFile
|
|
1565
|
+
if (imageFile) {
|
|
1568
1566
|
const img = new Image();
|
|
1569
1567
|
img.src = URL.createObjectURL(imageFile);
|
|
1570
1568
|
img.onload = () => {
|
|
1571
1569
|
setOriginalImage(img);
|
|
1572
|
-
const initialState = {
|
|
1573
|
-
rotation: 0,
|
|
1574
|
-
flipH: false,
|
|
1575
|
-
flipV: false,
|
|
1576
|
-
zoom: 1,
|
|
1577
|
-
brightness: 100,
|
|
1578
|
-
contrast: 100,
|
|
1579
|
-
saturation: 100,
|
|
1580
|
-
blur: 0,
|
|
1581
|
-
hue: 0,
|
|
1582
|
-
cropArea: { x: 0, y: 0, width: 100, height: 100 }
|
|
1583
|
-
};
|
|
1584
|
-
setHistory([initialState]);
|
|
1585
|
-
setHistoryIndex(0);
|
|
1586
1570
|
drawCanvas(img);
|
|
1571
|
+
saveToHistory();
|
|
1587
1572
|
};
|
|
1588
1573
|
}
|
|
1589
|
-
}, [imageFile
|
|
1590
|
-
// Draw canvas when state changes
|
|
1574
|
+
}, [imageFile]);
|
|
1591
1575
|
React.useEffect(() => {
|
|
1592
1576
|
if (originalImage) {
|
|
1593
|
-
drawCanvas(originalImage
|
|
1577
|
+
drawCanvas(originalImage);
|
|
1594
1578
|
}
|
|
1595
|
-
}, [rotation, flipH, flipV, zoom, brightness, contrast, saturation, blur, hue
|
|
1596
|
-
const drawCanvas = (img
|
|
1579
|
+
}, [rotation, flipH, flipV, zoom, brightness, contrast, saturation, blur, hue]);
|
|
1580
|
+
const drawCanvas = (img) => {
|
|
1597
1581
|
const canvas = canvasRef.current;
|
|
1598
1582
|
if (!canvas || !img)
|
|
1599
1583
|
return;
|
|
1600
|
-
const ctx = canvas.getContext(
|
|
1584
|
+
const ctx = canvas.getContext('2d');
|
|
1601
1585
|
if (!ctx)
|
|
1602
1586
|
return;
|
|
1603
1587
|
const maxWidth = 1200;
|
|
@@ -1678,24 +1662,15 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1678
1662
|
canvas.height = cropHeight;
|
|
1679
1663
|
ctx.putImageData(imageData, 0, 0);
|
|
1680
1664
|
setCropArea({ x: 0, y: 0, width: 100, height: 100 });
|
|
1681
|
-
|
|
1682
|
-
const newState = {
|
|
1683
|
-
...getCurrentState(),
|
|
1684
|
-
cropArea: { x: 0, y: 0, width: 100, height: 100 }
|
|
1685
|
-
};
|
|
1686
|
-
saveToHistory(newState);
|
|
1665
|
+
saveToHistory();
|
|
1687
1666
|
};
|
|
1688
1667
|
const applyFilter = (filter) => {
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
hue: filter.values.hue
|
|
1696
|
-
};
|
|
1697
|
-
applyState(newState);
|
|
1698
|
-
saveToHistory(newState);
|
|
1668
|
+
setBrightness(filter.values.brightness);
|
|
1669
|
+
setContrast(filter.values.contrast);
|
|
1670
|
+
setSaturation(filter.values.saturation);
|
|
1671
|
+
setBlur(filter.values.blur);
|
|
1672
|
+
setHue(filter.values.hue);
|
|
1673
|
+
saveToHistory();
|
|
1699
1674
|
};
|
|
1700
1675
|
const handleSave = () => {
|
|
1701
1676
|
const canvas = canvasRef.current;
|
|
@@ -1708,12 +1683,6 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1708
1683
|
}
|
|
1709
1684
|
});
|
|
1710
1685
|
};
|
|
1711
|
-
const handleSliderChange = (setter, value) => {
|
|
1712
|
-
setter(value);
|
|
1713
|
-
};
|
|
1714
|
-
const handleSliderChangeEnd = () => {
|
|
1715
|
-
saveToHistory();
|
|
1716
|
-
};
|
|
1717
1686
|
const tabs = [
|
|
1718
1687
|
{ id: 'crop', label: 'Crop', icon: CropIcon },
|
|
1719
1688
|
{ id: 'adjust', label: 'Adjust', icon: PaletteIcon },
|
|
@@ -1724,7 +1693,7 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1724
1693
|
React.createElement("div", { style: { flex: 1, display: 'flex', flexDirection: 'column' } },
|
|
1725
1694
|
React.createElement("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '12px', borderBottom: '1px solid #2a2a2a', backgroundColor: '#1a1a1a' } },
|
|
1726
1695
|
React.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' } },
|
|
1727
|
-
React.createElement(ApertureIcon, {
|
|
1696
|
+
React.createElement(ApertureIcon, { style: { width: 20, height: 20, color: '#3b82f6' } }),
|
|
1728
1697
|
React.createElement("h2", { style: { fontSize: '14px', fontWeight: 600, color: '#ffffff' } }, "Image Editor")),
|
|
1729
1698
|
React.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '4px' } },
|
|
1730
1699
|
React.createElement("div", { style: { width: '1px', height: '20px', backgroundColor: '#2a2a2a', margin: '0 4px' } }),
|
|
@@ -1741,7 +1710,7 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1741
1710
|
alignItems: 'center',
|
|
1742
1711
|
gap: '6px'
|
|
1743
1712
|
}, onMouseEnter: (e) => e.currentTarget.style.opacity = '0.9', onMouseLeave: (e) => e.currentTarget.style.opacity = '1' },
|
|
1744
|
-
React.createElement(CheckIcon,
|
|
1713
|
+
React.createElement(CheckIcon, { style: { width: 14, height: 14 } }),
|
|
1745
1714
|
"Save"),
|
|
1746
1715
|
React.createElement("button", { onClick: onCancel, style: {
|
|
1747
1716
|
padding: '8px',
|
|
@@ -1751,7 +1720,7 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1751
1720
|
cursor: 'pointer',
|
|
1752
1721
|
color: '#e5e5e5'
|
|
1753
1722
|
}, onMouseEnter: (e) => { e.currentTarget.style.backgroundColor = 'rgba(239, 68, 68, 0.1)'; e.currentTarget.style.color = '#ef4444'; }, onMouseLeave: (e) => { e.currentTarget.style.backgroundColor = 'transparent'; e.currentTarget.style.color = '#e5e5e5'; }, title: "Cancel" },
|
|
1754
|
-
React.createElement(XIcon,
|
|
1723
|
+
React.createElement(XIcon, { style: { width: 16, height: 16 } })))),
|
|
1755
1724
|
React.createElement("div", { style: { flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '16px', overflow: 'auto' } },
|
|
1756
1725
|
React.createElement("div", { style: { position: 'relative' } },
|
|
1757
1726
|
React.createElement("canvas", { ref: canvasRef, style: {
|
|
@@ -1790,7 +1759,7 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1790
1759
|
}, onMouseEnter: (e) => { if (activeTab !== tab.id)
|
|
1791
1760
|
e.currentTarget.style.backgroundColor = '#2a2a2a'; }, onMouseLeave: (e) => { if (activeTab !== tab.id)
|
|
1792
1761
|
e.currentTarget.style.backgroundColor = 'transparent'; } },
|
|
1793
|
-
React.createElement(tab.icon,
|
|
1762
|
+
React.createElement(tab.icon, { style: { width: 14, height: 14 } }),
|
|
1794
1763
|
tab.label)))))),
|
|
1795
1764
|
React.createElement(framerMotion.AnimatePresence, null, isPanelOpen && (React.createElement(framerMotion.motion.div, { initial: { width: 0, opacity: 0 }, animate: { width: 280, opacity: 1 }, exit: { width: 0, opacity: 0 }, transition: { duration: 0.2 }, style: { borderLeft: '1px solid #2a2a2a', backgroundColor: '#1a1a1a', overflow: 'hidden' } },
|
|
1796
1765
|
React.createElement("div", { style: { width: 280, height: '100%', overflowY: 'auto', padding: '16px' } },
|
|
@@ -1825,14 +1794,14 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1825
1794
|
justifyContent: 'center',
|
|
1826
1795
|
gap: '6px'
|
|
1827
1796
|
}, onMouseEnter: (e) => e.currentTarget.style.opacity = '0.9', onMouseLeave: (e) => e.currentTarget.style.opacity = '1' },
|
|
1828
|
-
React.createElement(CropIcon,
|
|
1797
|
+
React.createElement(CropIcon, { style: { width: 14, height: 14 } }),
|
|
1829
1798
|
"Apply Crop")))),
|
|
1830
|
-
activeTab === 'adjust' && (React.createElement(framerMotion.motion.div, { key: "adjust", initial: { opacity: 0, x: 10 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -10 },
|
|
1831
|
-
React.createElement(SliderControl, { icon: React.createElement(SunIcon, { className: "text-yellow-500" }), label: "Brightness", value: brightness, onChange:
|
|
1832
|
-
React.createElement(SliderControl, { icon: React.createElement(ContrastIcon, { className: "text-purple-500" }), label: "Contrast", value: contrast, onChange:
|
|
1833
|
-
React.createElement(SliderControl, { icon: React.createElement(DropletIcon, { className: "text-blue-500" }), label: "Saturation", value: saturation, onChange:
|
|
1834
|
-
React.createElement(SliderControl, { icon: React.createElement(ApertureIcon, { className: "text-gray-500" }), label: "Blur", value: blur, onChange:
|
|
1835
|
-
React.createElement(SliderControl, { icon: React.createElement(PaletteIcon, { className: "text-pink-500" }), label: "Hue", value: hue, onChange:
|
|
1799
|
+
activeTab === 'adjust' && (React.createElement(framerMotion.motion.div, { key: "adjust", initial: { opacity: 0, x: 10 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -10 }, className: "space-y-3" },
|
|
1800
|
+
React.createElement(SliderControl, { icon: React.createElement(SunIcon, { className: "text-yellow-500" }), label: "Brightness", value: brightness, onChange: setBrightness, onChangeEnd: saveToHistory, min: 0, max: 200, unit: "%" }),
|
|
1801
|
+
React.createElement(SliderControl, { icon: React.createElement(ContrastIcon, { className: "text-purple-500" }), label: "Contrast", value: contrast, onChange: setContrast, onChangeEnd: saveToHistory, min: 0, max: 200, unit: "%" }),
|
|
1802
|
+
React.createElement(SliderControl, { icon: React.createElement(DropletIcon, { className: "text-blue-500" }), label: "Saturation", value: saturation, onChange: setSaturation, onChangeEnd: saveToHistory, min: 0, max: 200, unit: "%" }),
|
|
1803
|
+
React.createElement(SliderControl, { icon: React.createElement(ApertureIcon, { className: "text-gray-500" }), label: "Blur", value: blur, onChange: setBlur, onChangeEnd: saveToHistory, min: 0, max: 10, step: 0.1, unit: "px" }),
|
|
1804
|
+
React.createElement(SliderControl, { icon: React.createElement(PaletteIcon, { className: "text-pink-500" }), label: "Hue", value: hue, onChange: setHue, onChangeEnd: saveToHistory, min: -180, max: 180, unit: "\u00B0" }))),
|
|
1836
1805
|
activeTab === 'filters' && (React.createElement(framerMotion.motion.div, { key: "filters", initial: { opacity: 0, x: 10 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -10 }, style: { display: 'flex', flexDirection: 'column', gap: '6px' } }, filters.map(filter => (React.createElement("button", { key: filter.id, onClick: () => applyFilter(filter), style: {
|
|
1837
1806
|
width: '100%',
|
|
1838
1807
|
textAlign: 'left',
|
|
@@ -1846,12 +1815,9 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1846
1815
|
fontWeight: 500
|
|
1847
1816
|
}, onMouseEnter: (e) => e.currentTarget.style.backgroundColor = '#3a3a3a', onMouseLeave: (e) => e.currentTarget.style.backgroundColor = '#2a2a2a' }, filter.name))))),
|
|
1848
1817
|
activeTab === 'transform' && (React.createElement(framerMotion.motion.div, { key: "transform", initial: { opacity: 0, x: 10 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -10 }, style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
|
1849
|
-
React.createElement(SliderControl, { icon: React.createElement(RotateIcon, null), label: "Rotation", value: rotation, onChange:
|
|
1818
|
+
React.createElement(SliderControl, { icon: React.createElement(RotateIcon, null), label: "Rotation", value: rotation, onChange: setRotation, onChangeEnd: saveToHistory, min: 0, max: 360, unit: "\u00B0" }),
|
|
1850
1819
|
React.createElement("div", { style: { display: 'flex', gap: '8px' } },
|
|
1851
|
-
React.createElement("button", { onClick: () => {
|
|
1852
|
-
setFlipH(!flipH);
|
|
1853
|
-
handleSliderChangeEnd();
|
|
1854
|
-
}, style: {
|
|
1820
|
+
React.createElement("button", { onClick: () => { setFlipH(!flipH); saveToHistory(); }, style: {
|
|
1855
1821
|
flex: 1,
|
|
1856
1822
|
padding: '8px 12px',
|
|
1857
1823
|
borderRadius: '8px',
|
|
@@ -1868,12 +1834,9 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1868
1834
|
}, onMouseEnter: (e) => { if (!flipH)
|
|
1869
1835
|
e.currentTarget.style.backgroundColor = '#3a3a3a'; }, onMouseLeave: (e) => { if (!flipH)
|
|
1870
1836
|
e.currentTarget.style.backgroundColor = '#2a2a2a'; } },
|
|
1871
|
-
React.createElement(FlipHorizontalIcon,
|
|
1837
|
+
React.createElement(FlipHorizontalIcon, { style: { width: 14, height: 14 } }),
|
|
1872
1838
|
"Flip H"),
|
|
1873
|
-
React.createElement("button", { onClick: () => {
|
|
1874
|
-
setFlipV(!flipV);
|
|
1875
|
-
handleSliderChangeEnd();
|
|
1876
|
-
}, style: {
|
|
1839
|
+
React.createElement("button", { onClick: () => { setFlipV(!flipV); saveToHistory(); }, style: {
|
|
1877
1840
|
flex: 1,
|
|
1878
1841
|
padding: '8px 12px',
|
|
1879
1842
|
borderRadius: '8px',
|
|
@@ -1890,9 +1853,9 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1890
1853
|
}, onMouseEnter: (e) => { if (!flipV)
|
|
1891
1854
|
e.currentTarget.style.backgroundColor = '#3a3a3a'; }, onMouseLeave: (e) => { if (!flipV)
|
|
1892
1855
|
e.currentTarget.style.backgroundColor = '#2a2a2a'; } },
|
|
1893
|
-
React.createElement(FlipVerticalIcon,
|
|
1856
|
+
React.createElement(FlipVerticalIcon, { style: { width: 14, height: 14 } }),
|
|
1894
1857
|
"Flip V")),
|
|
1895
|
-
React.createElement(SliderControl, { icon: React.createElement(ZoomInIcon, null), label: "Zoom", value: zoom, onChange:
|
|
1858
|
+
React.createElement(SliderControl, { icon: React.createElement(ZoomInIcon, null), label: "Zoom", value: zoom, onChange: setZoom, onChangeEnd: saveToHistory, min: 0.5, max: 3, step: 0.1, unit: "x" })))))))),
|
|
1896
1859
|
React.createElement("button", { onClick: () => setIsPanelOpen(!isPanelOpen), style: {
|
|
1897
1860
|
position: 'absolute',
|
|
1898
1861
|
right: isPanelOpen ? '280px' : '0',
|
|
@@ -1905,7 +1868,7 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
1905
1868
|
padding: '4px',
|
|
1906
1869
|
cursor: 'pointer',
|
|
1907
1870
|
color: '#e5e5e5'
|
|
1908
|
-
}, onMouseEnter: (e) => e.currentTarget.style.backgroundColor = '#2a2a2a', onMouseLeave: (e) => e.currentTarget.style.backgroundColor = '#1a1a1a' }, isPanelOpen ? React.createElement(ChevronRightIcon,
|
|
1871
|
+
}, onMouseEnter: (e) => e.currentTarget.style.backgroundColor = '#2a2a2a', onMouseLeave: (e) => e.currentTarget.style.backgroundColor = '#1a1a1a' }, isPanelOpen ? React.createElement(ChevronRightIcon, { style: { width: 16, height: 16 } }) : React.createElement(ChevronLeftIcon, { style: { width: 16, height: 16 } }))), document.body);
|
|
1909
1872
|
};
|
|
1910
1873
|
const SliderControl = ({ icon, label, value, onChange, onChangeEnd, min, max, step = 1, unit }) => {
|
|
1911
1874
|
return (React.createElement("div", null,
|
|
@@ -1967,7 +1930,7 @@ exports.Flex = Flex;
|
|
|
1967
1930
|
exports.Grid = Grid;
|
|
1968
1931
|
exports.Heading = Heading;
|
|
1969
1932
|
exports.IconButton = IconButton;
|
|
1970
|
-
exports.
|
|
1933
|
+
exports.Imageeditor = Imageeditor;
|
|
1971
1934
|
exports.Input = Input;
|
|
1972
1935
|
exports.List = List;
|
|
1973
1936
|
exports.ListItem = ListItem;
|
package/package.json
CHANGED