@armco/imageeditor 0.0.8 → 0.0.9
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/cjs/Control.js +1 -1
- package/cjs/ImageEditor.js +1 -1
- package/es/Control.js +1 -1
- package/es/ImageEditor.js +44 -43
- package/es/helper.js +2 -1
- package/package.json +35 -7
- package/types/ImageEditor.d.ts +9 -1
package/cjs/Control.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),r=require("@armco/
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),r=require("@armco/shared-components/enums"),n=require("@armco/shared-components/Tooltip"),c=require("@armco/icon"),i=({icon:o,handler:e,tooltip:t})=>s.jsxs(n,{children:[s.jsx("span",{className:"mx-3 p-1 cursor-pointer",slot:r.ArPopoverSlots.ANCHOR,children:s.jsx(c,{icon:o,attributes:{colors:{fillColor:"#ffffff99"},classes:"cursor-pointer",size:"2rem"},events:{onClick:e}})}),s.jsx("span",{slot:r.ArPopoverSlots.POPOVER,children:t})]});module.exports=i;
|
package/cjs/ImageEditor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(".ar-ImageEditor .ar-ImageEditor__image-container{max-width:60vw;max-height:75vh}.ar-ImageEditor .ar-ImageEditor__editor-controls{transition:background-color .5s,box-shadow .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);border-radius:2rem}.ar-ImageEditor .ar-ImageEditor__editor-controls:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button.is-dirty:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__controls{bottom:0}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container{transition:background-color .5s,box-shadow .5s,max-height .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);max-height:3.2rem;overflow:hidden}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container.expanded{max-height:20rem}")),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
"use strict";const t=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";const t=require("react/jsx-runtime"),l=require("react"),f=require("@armco/icon"),s=require("@armco/shared-components"),w=require("@armco/shared-components/Image"),y=require("@armco/shared-components/Tooltip"),B=require("@armco/shared-components/Slider"),P=require("./Control.js"),z=require("./helper.js");require("@armco/shared-components/enums");require("@armco/utils/domHelper");let c={rotateBy:0,brightness:1,contrast:1,saturate:1,grayscale:0,blur:0,sepia:0,opacity:1,scale:1};const C=d=>(d%360+360)%360,j=22.5,F=d=>{const{image:O,imageState:E,onChange:h,onCommit:x,viewOnly:m}=d;c={...c,...E};const v=l.useRef(null),[o,p]=l.useState({...c}),[i,S]=l.useState(),[n,I]=l.useState(),a=(e,r)=>{const u={...o,[e]:r},{rotateBy:g,...A}=u,{rotateBy:b,...q}=c;g!==void 0&&b!==void 0&&I(JSON.stringify(A)!==JSON.stringify(q)||C(g)!==C(b)),p(u),h&&h(u)},R=[{icon:"tb.TbFlipHorizontal",handler:()=>a("flipHorizontal",!o.flipHorizontal),tooltip:"Flip Horizontal"},{icon:"tb.TbFlipVertical",handler:()=>a("flipVertical",!o.flipVertical),tooltip:"Flip Vertical"},{icon:"ai.AiOutlineRotateLeft",handler:()=>a("rotateBy",o.rotateBy-j),tooltip:"Rotate Left"},{icon:"ai.AiOutlineRotateRight",handler:()=>a("rotateBy",o.rotateBy+j),tooltip:"Rotate Right"},{icon:"fi.FiZoomIn",handler:()=>a("scale",(o.scale+1)%10),tooltip:"Zoom In"},{icon:"fi.FiZoomOut",handler:()=>a("scale",(o.scale-1<0?0:o.scale-1)%10),tooltip:"Zoom Out"},{icon:i?"md.MdOutlineExpandLess":"md.MdOutlineExpandMore",handler:()=>S(!i),tooltip:i?"Hide Advanced Controls":"Show Advanced Controls"}],_=[{icon:"fi.FiZoomIn",handler:()=>p({...o,scale:(o.scale+1)%10}),tooltip:"Zoom In"},{icon:"fi.FiZoomOut",handler:()=>p({...o,scale:(o.scale-1<0?0:o.scale-1)%10}),tooltip:"Zoom Out"}],N=[[{label:"Brightness",min:0,max:5,precision:.1,handler:e=>a("brightness",+e.target.value)},{label:"Contrast",min:0,max:5,precision:.1,handler:e=>a("contrast",+e.target.value)}],[{label:"Saturation",min:0,max:10,precision:.2,handler:e=>a("saturate",+e.target.value)},{label:"Grayscale",min:0,max:1,precision:.05,handler:e=>a("grayscale",+e.target.value)}],[{label:"Blur",min:0,max:20,handler:e=>a("blur",+e.target.value)},{label:"Sepia",min:0,max:1,precision:.05,handler:e=>a("sepia",+e.target.value)}],[{label:"Opacity",min:0,max:1,precision:.05,handler:e=>a("opacity",+e.target.value)},{label:"Scale",min:0,max:10,precision:.2,handler:e=>a("scale",+e.target.value)}]];return t.jsxs("div",{className:"ar-ImageEditor d-flex flex-column h-100 overflow-auto flex-center position-relative",children:[!m&&t.jsxs("div",{className:"ar-ImageEditor__editor-controls position-absolute p-1 top-0 end-0 hover-shadow-dark",children:[t.jsxs(y,{children:[t.jsx("span",{className:"ar-ImageEditor__download-button cursor-pointer border-radius-50 p-1 me-2",slot:s.ArPopoverSlots.ANCHOR,children:t.jsx(f,{icon:"md/MdDownload",attributes:{colors:{fillColor:"#232323cc"},size:"1.5rem"},events:{onClick:()=>z.downloadEditedImage(v.current)}})}),t.jsx("span",{slot:s.ArPopoverSlots.POPOVER,children:"Download"})]}),t.jsxs(y,{children:[t.jsx("span",{className:`ar-ImageEditor__commit-button border-radius-50 p-1${n?" cursor-pointer is-dirty":""}`,slot:s.ArPopoverSlots.ANCHOR,children:t.jsx(f,{icon:"io5.IoCheckmarkCircleSharp",slot:s.ArPopoverSlots.ANCHOR,attributes:{colors:{fillColor:n?"#008000":"#00800077"},size:"1.5rem"},events:{onClick:()=>n&&x&&x(o)}})}),t.jsx("span",{slot:s.ArPopoverSlots.POPOVER,children:n?"Save":"Edit image to save"})]})]}),t.jsx("div",{className:"ar-ImageEditor__image-container mb-4",children:t.jsx(w,{ref:v,image:O,fill:!0,preserveAspectRatio:!0,...o})}),t.jsx("div",{className:"ar-ImageEditor__controls py-3 flex-center z-1 position-absolute",children:t.jsxs("div",{className:`ar-ImageEditor__controls-container border-radius prominent hover-shadow-dark${i?" expanded":""}`,children:[t.jsx("div",{className:`ar-ImageEditor__basic-controls px-3 py-2 ${i?"border-bottom":""}`,children:(m?_:R).map(e=>t.jsx(P,{...e}))}),!m&&t.jsx("div",{className:"ar-ImageEditor__advanced-controls mt-2 px-3",children:N.map(e=>t.jsx("div",{className:"row pb-3 border-bottom",children:e.map(r=>t.jsx("div",{className:"col-6",children:t.jsx(B,{label:r.label,min:r.min,max:r.max,onChange:r.handler,precision:r.precision})}))}))})]})})]})};module.exports=F;
|
package/es/Control.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { ArPopoverSlots as r } from "@armco/
|
|
2
|
+
import { ArPopoverSlots as r } from "@armco/shared-components/enums";
|
|
3
3
|
import i from "@armco/shared-components/Tooltip";
|
|
4
4
|
import n from "@armco/icon";
|
|
5
5
|
const a = ({
|
package/es/ImageEditor.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(".ar-ImageEditor .ar-ImageEditor__image-container{max-width:60vw;max-height:75vh}.ar-ImageEditor .ar-ImageEditor__editor-controls{transition:background-color .5s,box-shadow .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);border-radius:2rem}.ar-ImageEditor .ar-ImageEditor__editor-controls:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button.is-dirty:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__controls{bottom:0}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container{transition:background-color .5s,box-shadow .5s,max-height .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);max-height:3.2rem;overflow:hidden}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container.expanded{max-height:20rem}")),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { ArPopoverSlots as n } from "@armco/types";
|
|
3
|
+
import { useRef as F, useState as u } from "react";
|
|
5
4
|
import y from "@armco/icon";
|
|
6
|
-
import
|
|
5
|
+
import { ArPopoverSlots as n } from "@armco/shared-components";
|
|
6
|
+
import H from "@armco/shared-components/Image";
|
|
7
7
|
import C from "@armco/shared-components/Tooltip";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { downloadEditedImage as
|
|
8
|
+
import Z from "@armco/shared-components/Slider";
|
|
9
|
+
import k from "./Control.js";
|
|
10
|
+
import { downloadEditedImage as V } from "./helper.js";
|
|
11
|
+
import "@armco/shared-components/enums";
|
|
12
|
+
import "@armco/utils/domHelper";
|
|
11
13
|
let c = {
|
|
12
14
|
rotateBy: 0,
|
|
13
15
|
brightness: 1,
|
|
@@ -19,48 +21,48 @@ let c = {
|
|
|
19
21
|
opacity: 1,
|
|
20
22
|
scale: 1
|
|
21
23
|
};
|
|
22
|
-
const O = (d) => (d % 360 + 360) % 360, E = 22.5,
|
|
23
|
-
const {
|
|
24
|
+
const O = (d) => (d % 360 + 360) % 360, E = 22.5, Q = (d) => {
|
|
25
|
+
const { image: I, imageState: R, onChange: g, onCommit: v, viewOnly: m } = d;
|
|
24
26
|
c = {
|
|
25
27
|
...c,
|
|
26
|
-
...
|
|
28
|
+
...R
|
|
27
29
|
};
|
|
28
|
-
const b =
|
|
29
|
-
const h = { ...
|
|
30
|
-
f !== void 0 && x !== void 0 &&
|
|
31
|
-
JSON.stringify(
|
|
30
|
+
const b = F(null), [e, p] = u({ ...c }), [r, _] = u(), [s, N] = u(), a = (o, i) => {
|
|
31
|
+
const h = { ...e, [o]: i }, { rotateBy: f, ...A } = h, { rotateBy: x, ...z } = c;
|
|
32
|
+
f !== void 0 && x !== void 0 && N(
|
|
33
|
+
JSON.stringify(A) !== JSON.stringify(z) || O(f) !== O(x)
|
|
32
34
|
), p(h), g && g(h);
|
|
33
|
-
},
|
|
35
|
+
}, S = [
|
|
34
36
|
{
|
|
35
37
|
icon: "tb.TbFlipHorizontal",
|
|
36
|
-
handler: () => a("flipHorizontal", !
|
|
38
|
+
handler: () => a("flipHorizontal", !e.flipHorizontal),
|
|
37
39
|
tooltip: "Flip Horizontal"
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
42
|
icon: "tb.TbFlipVertical",
|
|
41
|
-
handler: () => a("flipVertical", !
|
|
43
|
+
handler: () => a("flipVertical", !e.flipVertical),
|
|
42
44
|
tooltip: "Flip Vertical"
|
|
43
45
|
},
|
|
44
46
|
{
|
|
45
47
|
icon: "ai.AiOutlineRotateLeft",
|
|
46
|
-
handler: () => a("rotateBy",
|
|
48
|
+
handler: () => a("rotateBy", e.rotateBy - E),
|
|
47
49
|
tooltip: "Rotate Left"
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
52
|
icon: "ai.AiOutlineRotateRight",
|
|
51
|
-
handler: () => a("rotateBy",
|
|
53
|
+
handler: () => a("rotateBy", e.rotateBy + E),
|
|
52
54
|
tooltip: "Rotate Right"
|
|
53
55
|
},
|
|
54
56
|
{
|
|
55
57
|
icon: "fi.FiZoomIn",
|
|
56
|
-
handler: () => a("scale", (
|
|
58
|
+
handler: () => a("scale", (e.scale + 1) % 10),
|
|
57
59
|
tooltip: "Zoom In"
|
|
58
60
|
},
|
|
59
61
|
{
|
|
60
62
|
icon: "fi.FiZoomOut",
|
|
61
63
|
handler: () => a(
|
|
62
64
|
"scale",
|
|
63
|
-
(
|
|
65
|
+
(e.scale - 1 < 0 ? 0 : e.scale - 1) % 10
|
|
64
66
|
),
|
|
65
67
|
tooltip: "Zoom Out"
|
|
66
68
|
},
|
|
@@ -69,35 +71,35 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
69
71
|
handler: () => _(!r),
|
|
70
72
|
tooltip: r ? "Hide Advanced Controls" : "Show Advanced Controls"
|
|
71
73
|
}
|
|
72
|
-
],
|
|
74
|
+
], w = [
|
|
73
75
|
{
|
|
74
76
|
icon: "fi.FiZoomIn",
|
|
75
|
-
handler: () => p({ ...
|
|
77
|
+
handler: () => p({ ...e, scale: (e.scale + 1) % 10 }),
|
|
76
78
|
tooltip: "Zoom In"
|
|
77
79
|
},
|
|
78
80
|
{
|
|
79
81
|
icon: "fi.FiZoomOut",
|
|
80
82
|
handler: () => p({
|
|
81
|
-
...
|
|
82
|
-
scale: (
|
|
83
|
+
...e,
|
|
84
|
+
scale: (e.scale - 1 < 0 ? 0 : e.scale - 1) % 10
|
|
83
85
|
}),
|
|
84
86
|
tooltip: "Zoom Out"
|
|
85
87
|
}
|
|
86
|
-
],
|
|
88
|
+
], B = [
|
|
87
89
|
[
|
|
88
90
|
{
|
|
89
91
|
label: "Brightness",
|
|
90
92
|
min: 0,
|
|
91
93
|
max: 5,
|
|
92
94
|
precision: 0.1,
|
|
93
|
-
handler: (
|
|
95
|
+
handler: (o) => a("brightness", +o.target.value)
|
|
94
96
|
},
|
|
95
97
|
{
|
|
96
98
|
label: "Contrast",
|
|
97
99
|
min: 0,
|
|
98
100
|
max: 5,
|
|
99
101
|
precision: 0.1,
|
|
100
|
-
handler: (
|
|
102
|
+
handler: (o) => a("contrast", +o.target.value)
|
|
101
103
|
}
|
|
102
104
|
],
|
|
103
105
|
[
|
|
@@ -106,14 +108,14 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
106
108
|
min: 0,
|
|
107
109
|
max: 10,
|
|
108
110
|
precision: 0.2,
|
|
109
|
-
handler: (
|
|
111
|
+
handler: (o) => a("saturate", +o.target.value)
|
|
110
112
|
},
|
|
111
113
|
{
|
|
112
114
|
label: "Grayscale",
|
|
113
115
|
min: 0,
|
|
114
116
|
max: 1,
|
|
115
117
|
precision: 0.05,
|
|
116
|
-
handler: (
|
|
118
|
+
handler: (o) => a("grayscale", +o.target.value)
|
|
117
119
|
}
|
|
118
120
|
],
|
|
119
121
|
[
|
|
@@ -121,14 +123,14 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
121
123
|
label: "Blur",
|
|
122
124
|
min: 0,
|
|
123
125
|
max: 20,
|
|
124
|
-
handler: (
|
|
126
|
+
handler: (o) => a("blur", +o.target.value)
|
|
125
127
|
},
|
|
126
128
|
{
|
|
127
129
|
label: "Sepia",
|
|
128
130
|
min: 0,
|
|
129
131
|
max: 1,
|
|
130
132
|
precision: 0.05,
|
|
131
|
-
handler: (
|
|
133
|
+
handler: (o) => a("sepia", +o.target.value)
|
|
132
134
|
}
|
|
133
135
|
],
|
|
134
136
|
[
|
|
@@ -137,14 +139,14 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
137
139
|
min: 0,
|
|
138
140
|
max: 1,
|
|
139
141
|
precision: 0.05,
|
|
140
|
-
handler: (
|
|
142
|
+
handler: (o) => a("opacity", +o.target.value)
|
|
141
143
|
},
|
|
142
144
|
{
|
|
143
145
|
label: "Scale",
|
|
144
146
|
min: 0,
|
|
145
147
|
max: 10,
|
|
146
148
|
precision: 0.2,
|
|
147
|
-
handler: (
|
|
149
|
+
handler: (o) => a("scale", +o.target.value)
|
|
148
150
|
}
|
|
149
151
|
]
|
|
150
152
|
];
|
|
@@ -165,7 +167,7 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
165
167
|
size: "1.5rem"
|
|
166
168
|
},
|
|
167
169
|
events: {
|
|
168
|
-
onClick: () =>
|
|
170
|
+
onClick: () => V(b.current)
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
173
|
)
|
|
@@ -189,7 +191,7 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
189
191
|
size: "1.5rem"
|
|
190
192
|
},
|
|
191
193
|
events: {
|
|
192
|
-
onClick: () => s && v && v(
|
|
194
|
+
onClick: () => s && v && v(e)
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
)
|
|
@@ -199,14 +201,13 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
199
201
|
] })
|
|
200
202
|
] }),
|
|
201
203
|
/* @__PURE__ */ t("div", { className: "ar-ImageEditor__image-container mb-4", children: /* @__PURE__ */ t(
|
|
202
|
-
|
|
204
|
+
H,
|
|
203
205
|
{
|
|
204
206
|
ref: b,
|
|
205
|
-
image:
|
|
206
|
-
demo: I,
|
|
207
|
+
image: I,
|
|
207
208
|
fill: !0,
|
|
208
209
|
preserveAspectRatio: !0,
|
|
209
|
-
...
|
|
210
|
+
...e
|
|
210
211
|
}
|
|
211
212
|
) }),
|
|
212
213
|
/* @__PURE__ */ t("div", { className: "ar-ImageEditor__controls py-3 flex-center z-1 position-absolute", children: /* @__PURE__ */ l(
|
|
@@ -218,11 +219,11 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
218
219
|
"div",
|
|
219
220
|
{
|
|
220
221
|
className: `ar-ImageEditor__basic-controls px-3 py-2 ${r ? "border-bottom" : ""}`,
|
|
221
|
-
children: (m ?
|
|
222
|
+
children: (m ? w : S).map((o) => /* @__PURE__ */ t(k, { ...o }))
|
|
222
223
|
}
|
|
223
224
|
),
|
|
224
|
-
!m && /* @__PURE__ */ t("div", { className: "ar-ImageEditor__advanced-controls mt-2 px-3", children:
|
|
225
|
-
|
|
225
|
+
!m && /* @__PURE__ */ t("div", { className: "ar-ImageEditor__advanced-controls mt-2 px-3", children: B.map((o) => /* @__PURE__ */ t("div", { className: "row pb-3 border-bottom", children: o.map((i) => /* @__PURE__ */ t("div", { className: "col-6", children: /* @__PURE__ */ t(
|
|
226
|
+
Z,
|
|
226
227
|
{
|
|
227
228
|
label: i.label,
|
|
228
229
|
min: i.min,
|
|
@@ -237,5 +238,5 @@ const O = (d) => (d % 360 + 360) % 360, E = 22.5, K = (d) => {
|
|
|
237
238
|
] });
|
|
238
239
|
};
|
|
239
240
|
export {
|
|
240
|
-
|
|
241
|
+
Q as default
|
|
241
242
|
};
|
package/es/helper.js
CHANGED
|
@@ -4,7 +4,8 @@ const i = (t) => {
|
|
|
4
4
|
const e = document.createElement("canvas");
|
|
5
5
|
e.width = t.naturalWidth, e.height = t.naturalHeight;
|
|
6
6
|
const a = e.getContext("2d");
|
|
7
|
-
if (!a)
|
|
7
|
+
if (!a)
|
|
8
|
+
return;
|
|
8
9
|
const o = t.style.filter, n = t.style.opacity, s = t.style.transform;
|
|
9
10
|
a.filter = o !== "" ? o : "", a.globalAlpha = n !== "" ? parseFloat(n) : 1, s && s !== "none" && d(a, s, e), a.drawImage(t, 0, 0), c(e.toDataURL());
|
|
10
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armco/imageeditor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "cjs/ImageEditor.js",
|
|
6
6
|
"module": "es/ImageEditor.js",
|
|
@@ -13,13 +13,41 @@
|
|
|
13
13
|
"publish:sh": "./publish.sh",
|
|
14
14
|
"publish:local": "./publish-local.sh"
|
|
15
15
|
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@armco/icon": "^0.0.13",
|
|
18
|
+
"@armco/shared-components": "^0.0.61",
|
|
19
|
+
"@armco/utils": "^0.0.31",
|
|
20
|
+
"@types/node": "^22.5.5",
|
|
21
|
+
"react": ">16.8.0",
|
|
22
|
+
"react-dom": ">16.8.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@armco/types": "^0.0.22",
|
|
26
|
+
"@testing-library/dom": "^9.2.0",
|
|
27
|
+
"@testing-library/jest-dom": "^5.11.4",
|
|
28
|
+
"@testing-library/react": "^14.0.0",
|
|
29
|
+
"@testing-library/user-event": "^14.2.5",
|
|
30
|
+
"@types/react": "^18.0.15",
|
|
31
|
+
"@types/react-dom": "^18.0.6",
|
|
32
|
+
"@types/testing-library__jest-dom": "^5.14.5",
|
|
33
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
34
|
+
"eslint": "^8.0.0",
|
|
35
|
+
"eslint-config-react-app": "^7.0.1",
|
|
36
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
37
|
+
"jsdom": "^21.1.0",
|
|
38
|
+
"prettier": "^2.7.1",
|
|
39
|
+
"prettier-config-nick": "^1.0.2",
|
|
40
|
+
"sass": "^1.63.4",
|
|
41
|
+
"typescript": "^5.0.2",
|
|
42
|
+
"vite": "^4.0.0",
|
|
43
|
+
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
44
|
+
"vite-plugin-dts": "^4.2.2",
|
|
45
|
+
"vite-plugin-externalize-deps": "^0.8.0",
|
|
46
|
+
"vitest": "^0.30.1"
|
|
47
|
+
},
|
|
16
48
|
"peerDependencies": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"@armco/shared-components": "^0.0.57",
|
|
20
|
-
"@armco/icon": "^0.0.10",
|
|
21
|
-
"react": "^18.2.0",
|
|
22
|
-
"react-dom": "^18.2.0"
|
|
49
|
+
"react": ">16.8.0",
|
|
50
|
+
"react-dom": ">16.8.0"
|
|
23
51
|
},
|
|
24
52
|
"eslintConfig": {
|
|
25
53
|
"extends": [
|
package/types/ImageEditor.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseProps, FunctionType } from '@armco/types';
|
|
2
|
+
import { ImageProps } from '@armco/shared-components/types/Image';
|
|
3
|
+
export interface ImageEditorProps extends BaseProps {
|
|
4
|
+
image: string;
|
|
5
|
+
imageState?: Partial<ImageProps>;
|
|
6
|
+
onChange?: FunctionType;
|
|
7
|
+
onCommit?: FunctionType;
|
|
8
|
+
viewOnly?: boolean;
|
|
9
|
+
}
|
|
2
10
|
declare const ImageEditor: (props: ImageEditorProps) => JSX.Element;
|
|
3
11
|
export default ImageEditor;
|