@willphan1712000/frontend 1.0.3 → 1.2.0
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/README.md +14 -3
- package/dist/index.d.mts +275 -18
- package/dist/index.d.ts +275 -18
- package/dist/index.js +1524 -43
- package/dist/index.mjs +1476 -44
- package/package.json +8 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,54 @@ function _array_with_holes(arr) {
|
|
|
10
10
|
function _array_without_holes(arr) {
|
|
11
11
|
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
12
|
}
|
|
13
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
|
+
try {
|
|
15
|
+
var info = gen[key](arg);
|
|
16
|
+
var value = info.value;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
reject(error);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (info.done) {
|
|
22
|
+
resolve(value);
|
|
23
|
+
} else {
|
|
24
|
+
Promise.resolve(value).then(_next, _throw);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function _async_to_generator(fn) {
|
|
28
|
+
return function() {
|
|
29
|
+
var self = this, args = arguments;
|
|
30
|
+
return new Promise(function(resolve, reject) {
|
|
31
|
+
var gen = fn.apply(self, args);
|
|
32
|
+
function _next(value) {
|
|
33
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
34
|
+
}
|
|
35
|
+
function _throw(err) {
|
|
36
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
|
+
}
|
|
38
|
+
_next(undefined);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function _class_call_check(instance, Constructor) {
|
|
43
|
+
if (!(instance instanceof Constructor)) {
|
|
44
|
+
throw new TypeError("Cannot call a class as a function");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function _defineProperties(target, props) {
|
|
48
|
+
for(var i = 0; i < props.length; i++){
|
|
49
|
+
var descriptor = props[i];
|
|
50
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
51
|
+
descriptor.configurable = true;
|
|
52
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
53
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
57
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
58
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
59
|
+
return Constructor;
|
|
60
|
+
}
|
|
13
61
|
function _define_property(obj, key, value) {
|
|
14
62
|
if (key in obj) {
|
|
15
63
|
Object.defineProperty(obj, key, {
|
|
@@ -23,6 +71,20 @@ function _define_property(obj, key, value) {
|
|
|
23
71
|
}
|
|
24
72
|
return obj;
|
|
25
73
|
}
|
|
74
|
+
function _extends() {
|
|
75
|
+
_extends = Object.assign || function(target) {
|
|
76
|
+
for(var i = 1; i < arguments.length; i++){
|
|
77
|
+
var source = arguments[i];
|
|
78
|
+
for(var key in source){
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
80
|
+
target[key] = source[key];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return target;
|
|
85
|
+
};
|
|
86
|
+
return _extends.apply(this, arguments);
|
|
87
|
+
}
|
|
26
88
|
function _iterable_to_array(iter) {
|
|
27
89
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
28
90
|
}
|
|
@@ -56,6 +118,10 @@ function _non_iterable_rest() {
|
|
|
56
118
|
function _non_iterable_spread() {
|
|
57
119
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
120
|
}
|
|
121
|
+
function _object_destructuring_empty(o) {
|
|
122
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
123
|
+
return o;
|
|
124
|
+
}
|
|
59
125
|
function _object_spread(target) {
|
|
60
126
|
for(var i = 1; i < arguments.length; i++){
|
|
61
127
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -140,9 +206,102 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
140
206
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
141
207
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
142
208
|
}
|
|
209
|
+
function _ts_generator(thisArg, body) {
|
|
210
|
+
var f, y, t, _ = {
|
|
211
|
+
label: 0,
|
|
212
|
+
sent: function() {
|
|
213
|
+
if (t[0] & 1) throw t[1];
|
|
214
|
+
return t[1];
|
|
215
|
+
},
|
|
216
|
+
trys: [],
|
|
217
|
+
ops: []
|
|
218
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
219
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
220
|
+
return this;
|
|
221
|
+
}), g;
|
|
222
|
+
function verb(n) {
|
|
223
|
+
return function(v) {
|
|
224
|
+
return step([
|
|
225
|
+
n,
|
|
226
|
+
v
|
|
227
|
+
]);
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function step(op) {
|
|
231
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
232
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
233
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
234
|
+
if (y = 0, t) op = [
|
|
235
|
+
op[0] & 2,
|
|
236
|
+
t.value
|
|
237
|
+
];
|
|
238
|
+
switch(op[0]){
|
|
239
|
+
case 0:
|
|
240
|
+
case 1:
|
|
241
|
+
t = op;
|
|
242
|
+
break;
|
|
243
|
+
case 4:
|
|
244
|
+
_.label++;
|
|
245
|
+
return {
|
|
246
|
+
value: op[1],
|
|
247
|
+
done: false
|
|
248
|
+
};
|
|
249
|
+
case 5:
|
|
250
|
+
_.label++;
|
|
251
|
+
y = op[1];
|
|
252
|
+
op = [
|
|
253
|
+
0
|
|
254
|
+
];
|
|
255
|
+
continue;
|
|
256
|
+
case 7:
|
|
257
|
+
op = _.ops.pop();
|
|
258
|
+
_.trys.pop();
|
|
259
|
+
continue;
|
|
260
|
+
default:
|
|
261
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
262
|
+
_ = 0;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
266
|
+
_.label = op[1];
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
270
|
+
_.label = t[1];
|
|
271
|
+
t = op;
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
if (t && _.label < t[2]) {
|
|
275
|
+
_.label = t[2];
|
|
276
|
+
_.ops.push(op);
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
if (t[2]) _.ops.pop();
|
|
280
|
+
_.trys.pop();
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
op = body.call(thisArg, _);
|
|
284
|
+
} catch (e) {
|
|
285
|
+
op = [
|
|
286
|
+
6,
|
|
287
|
+
e
|
|
288
|
+
];
|
|
289
|
+
y = 0;
|
|
290
|
+
} finally{
|
|
291
|
+
f = t = 0;
|
|
292
|
+
}
|
|
293
|
+
if (op[0] & 5) throw op[1];
|
|
294
|
+
return {
|
|
295
|
+
value: op[0] ? op[1] : void 0,
|
|
296
|
+
done: true
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
var __create = Object.create;
|
|
143
301
|
var __defProp = Object.defineProperty;
|
|
144
302
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
145
303
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
304
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
146
305
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
147
306
|
var __export = function(target, all) {
|
|
148
307
|
for(var name in all)__defProp(target, name, {
|
|
@@ -181,6 +340,16 @@ var __copyProps = function(to, from, except, desc) {
|
|
|
181
340
|
}
|
|
182
341
|
return to;
|
|
183
342
|
};
|
|
343
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
344
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
345
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
346
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
347
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
348
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
349
|
+
value: mod,
|
|
350
|
+
enumerable: true
|
|
351
|
+
}) : target, mod);
|
|
352
|
+
};
|
|
184
353
|
var __toCommonJS = function(mod) {
|
|
185
354
|
return __copyProps(__defProp({}, "__esModule", {
|
|
186
355
|
value: true
|
|
@@ -189,15 +358,36 @@ var __toCommonJS = function(mod) {
|
|
|
189
358
|
// index.ts
|
|
190
359
|
var index_exports = {};
|
|
191
360
|
__export(index_exports, {
|
|
361
|
+
Avatar: function() {
|
|
362
|
+
return Avatar_default;
|
|
363
|
+
},
|
|
192
364
|
Button: function() {
|
|
193
365
|
return Button_default;
|
|
194
366
|
},
|
|
367
|
+
Canvas: function() {
|
|
368
|
+
return Canvas;
|
|
369
|
+
},
|
|
195
370
|
ColorPickerSlider: function() {
|
|
196
371
|
return ColorPickerSlider_default;
|
|
197
372
|
},
|
|
198
373
|
DropdownSelect: function() {
|
|
199
374
|
return DropdownSelect_default;
|
|
200
375
|
},
|
|
376
|
+
Image: function() {
|
|
377
|
+
return Image_default;
|
|
378
|
+
},
|
|
379
|
+
ImageEditor: function() {
|
|
380
|
+
return ImageEditor_default;
|
|
381
|
+
},
|
|
382
|
+
ImageUtilities: function() {
|
|
383
|
+
return Image_default2;
|
|
384
|
+
},
|
|
385
|
+
InputFile: function() {
|
|
386
|
+
return InputFile_default;
|
|
387
|
+
},
|
|
388
|
+
InputGoogle: function() {
|
|
389
|
+
return InputGoogle_default;
|
|
390
|
+
},
|
|
201
391
|
MultiSelect: function() {
|
|
202
392
|
return MultiSelect_default;
|
|
203
393
|
},
|
|
@@ -206,6 +396,15 @@ __export(index_exports, {
|
|
|
206
396
|
},
|
|
207
397
|
RangeSlider: function() {
|
|
208
398
|
return RangeSlider_default;
|
|
399
|
+
},
|
|
400
|
+
TextArea: function() {
|
|
401
|
+
return TextArea_default;
|
|
402
|
+
},
|
|
403
|
+
Transform: function() {
|
|
404
|
+
return Transform;
|
|
405
|
+
},
|
|
406
|
+
UploadImage: function() {
|
|
407
|
+
return UploadImage_default;
|
|
209
408
|
}
|
|
210
409
|
});
|
|
211
410
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -223,6 +422,10 @@ function useMyContext() {
|
|
|
223
422
|
var import_react2 = require("react");
|
|
224
423
|
// src/components/DropdownSelect/styles.ts
|
|
225
424
|
var styles = {
|
|
425
|
+
container: {
|
|
426
|
+
width: "100%",
|
|
427
|
+
position: "relative"
|
|
428
|
+
},
|
|
226
429
|
select_box: {
|
|
227
430
|
borderRadius: "10px",
|
|
228
431
|
border: "solid 1px #dadada",
|
|
@@ -299,7 +502,7 @@ var Search = function(param) {
|
|
|
299
502
|
name: "search",
|
|
300
503
|
onChange: function(e) {
|
|
301
504
|
return onSearch(options.filter(function(ele) {
|
|
302
|
-
return ele.
|
|
505
|
+
return ele.label.toLowerCase().includes(e.target.value.toLowerCase());
|
|
303
506
|
}));
|
|
304
507
|
}
|
|
305
508
|
})
|
|
@@ -373,7 +576,7 @@ var Dropdown_default = Dropdown;
|
|
|
373
576
|
var import_io = require("react-icons/io");
|
|
374
577
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
375
578
|
var DropdownSelect = function(param) {
|
|
376
|
-
var options = param.options, value = param.value, onChange = param.onChange
|
|
579
|
+
var options = param.options, value = param.value, onChange = param.onChange;
|
|
377
580
|
var _ref = _sliced_to_array((0, import_react3.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
378
581
|
var _ref1 = _sliced_to_array((0, import_react3.useState)(false), 2), isHoverClose = _ref1[0], setHoverClose = _ref1[1];
|
|
379
582
|
var selectRef = (0, import_react3.useRef)(null);
|
|
@@ -397,10 +600,7 @@ var DropdownSelect = function(param) {
|
|
|
397
600
|
setOpen: setOpen
|
|
398
601
|
},
|
|
399
602
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", {
|
|
400
|
-
style:
|
|
401
|
-
width: "".concat(width, "px"),
|
|
402
|
-
position: "relative"
|
|
403
|
-
},
|
|
603
|
+
style: styles_default.container,
|
|
404
604
|
ref: selectRef,
|
|
405
605
|
children: [
|
|
406
606
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", {
|
|
@@ -1243,7 +1443,7 @@ var import_framer_motion = require("framer-motion");
|
|
|
1243
1443
|
// src/components/Buttons/gradient/styles.ts
|
|
1244
1444
|
var borderRadius = "20px";
|
|
1245
1445
|
var styles6 = function(first, second) {
|
|
1246
|
-
var
|
|
1446
|
+
var styles11 = {
|
|
1247
1447
|
container: {
|
|
1248
1448
|
position: "relative",
|
|
1249
1449
|
borderRadius: borderRadius,
|
|
@@ -1318,21 +1518,21 @@ var styles6 = function(first, second) {
|
|
|
1318
1518
|
width: "100%"
|
|
1319
1519
|
}
|
|
1320
1520
|
};
|
|
1321
|
-
return
|
|
1521
|
+
return styles11;
|
|
1322
1522
|
};
|
|
1323
1523
|
var styles_default6 = styles6;
|
|
1324
1524
|
// src/components/Buttons/gradient/Gradient.tsx
|
|
1325
1525
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1326
1526
|
var Gradient = function() {
|
|
1327
1527
|
var data = useButtonContext();
|
|
1328
|
-
var
|
|
1528
|
+
var styles11 = styles_default6(data.first, data.second);
|
|
1329
1529
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", {
|
|
1330
|
-
style: _object_spread_props(_object_spread({},
|
|
1530
|
+
style: _object_spread_props(_object_spread({}, styles11.container), {
|
|
1331
1531
|
overflow: data.isLoading ? "hidden" : ""
|
|
1332
1532
|
}),
|
|
1333
1533
|
children: [
|
|
1334
1534
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", _object_spread_props(_object_spread({
|
|
1335
|
-
style:
|
|
1535
|
+
style: styles11.btn
|
|
1336
1536
|
}, data.props), {
|
|
1337
1537
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", {
|
|
1338
1538
|
style: {
|
|
@@ -1340,30 +1540,34 @@ var Gradient = function() {
|
|
|
1340
1540
|
},
|
|
1341
1541
|
children: [
|
|
1342
1542
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
|
|
1343
|
-
style:
|
|
1543
|
+
style: styles11.labelBefore
|
|
1344
1544
|
}),
|
|
1345
1545
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
|
|
1346
|
-
style: _object_spread_props(_object_spread({},
|
|
1546
|
+
style: _object_spread_props(_object_spread({}, styles11.label), {
|
|
1347
1547
|
backgroundColor: data.main
|
|
1348
1548
|
}),
|
|
1349
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.
|
|
1350
|
-
style: _object_spread_props(_object_spread({},
|
|
1549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", {
|
|
1550
|
+
style: _object_spread_props(_object_spread({}, styles11.p), {
|
|
1351
1551
|
color: "".concat(data.text)
|
|
1352
1552
|
}),
|
|
1353
|
-
children:
|
|
1553
|
+
children: [
|
|
1554
|
+
data.children,
|
|
1555
|
+
" ",
|
|
1556
|
+
data.content
|
|
1557
|
+
]
|
|
1354
1558
|
})
|
|
1355
1559
|
}),
|
|
1356
1560
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
|
|
1357
|
-
style:
|
|
1561
|
+
style: styles11.labelAfter
|
|
1358
1562
|
})
|
|
1359
1563
|
]
|
|
1360
1564
|
})
|
|
1361
1565
|
})),
|
|
1362
1566
|
!data.isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
|
|
1363
|
-
style:
|
|
1567
|
+
style: styles11.btnAfter
|
|
1364
1568
|
}),
|
|
1365
1569
|
data.isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_framer_motion.motion.div, {
|
|
1366
|
-
style:
|
|
1570
|
+
style: styles11.btnAfter,
|
|
1367
1571
|
animate: {
|
|
1368
1572
|
rotate: 360
|
|
1369
1573
|
},
|
|
@@ -1379,8 +1583,8 @@ var Gradient = function() {
|
|
|
1379
1583
|
var Gradient_default = Gradient;
|
|
1380
1584
|
// src/components/Buttons/solid/styles.ts
|
|
1381
1585
|
var styles7 = function(first) {
|
|
1382
|
-
var
|
|
1383
|
-
|
|
1586
|
+
var styles11 = {
|
|
1587
|
+
btn: {
|
|
1384
1588
|
cursor: "pointer",
|
|
1385
1589
|
position: "relative",
|
|
1386
1590
|
zIndex: 0,
|
|
@@ -1392,7 +1596,7 @@ var styles7 = function(first) {
|
|
|
1392
1596
|
backgroundColor: first,
|
|
1393
1597
|
border: "none"
|
|
1394
1598
|
},
|
|
1395
|
-
|
|
1599
|
+
btnAfter: {
|
|
1396
1600
|
position: "absolute",
|
|
1397
1601
|
top: 0,
|
|
1398
1602
|
left: 0,
|
|
@@ -1402,12 +1606,12 @@ var styles7 = function(first) {
|
|
|
1402
1606
|
backgroundColor: first,
|
|
1403
1607
|
filter: "blur(10px)"
|
|
1404
1608
|
},
|
|
1405
|
-
|
|
1609
|
+
label: {
|
|
1406
1610
|
borderRadius: "0.75rem",
|
|
1407
1611
|
padding: "0.5rem 2rem",
|
|
1408
1612
|
color: "white"
|
|
1409
1613
|
},
|
|
1410
|
-
|
|
1614
|
+
labelBefore: {
|
|
1411
1615
|
position: "absolute",
|
|
1412
1616
|
top: "20%",
|
|
1413
1617
|
right: "50%",
|
|
@@ -1419,7 +1623,7 @@ var styles7 = function(first) {
|
|
|
1419
1623
|
backgroundColor: first,
|
|
1420
1624
|
filter: "blur(15px)"
|
|
1421
1625
|
},
|
|
1422
|
-
|
|
1626
|
+
labelAfter: {
|
|
1423
1627
|
position: "absolute",
|
|
1424
1628
|
top: "20%",
|
|
1425
1629
|
left: "50%",
|
|
@@ -1430,27 +1634,27 @@ var styles7 = function(first) {
|
|
|
1430
1634
|
zIndex: 0,
|
|
1431
1635
|
filter: "blur(20px)"
|
|
1432
1636
|
},
|
|
1433
|
-
|
|
1637
|
+
p: {
|
|
1434
1638
|
zIndex: 1,
|
|
1435
1639
|
position: "relative",
|
|
1436
1640
|
margin: 0
|
|
1437
1641
|
}
|
|
1438
1642
|
};
|
|
1439
|
-
return
|
|
1643
|
+
return styles11;
|
|
1440
1644
|
};
|
|
1441
1645
|
var styles_default7 = styles7;
|
|
1442
1646
|
// src/components/Buttons/solid/Solid.tsx
|
|
1443
1647
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1444
1648
|
var Solid = function() {
|
|
1445
1649
|
var data = useButtonContext();
|
|
1446
|
-
var
|
|
1650
|
+
var styles11 = styles_default7(data.first);
|
|
1447
1651
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
|
|
1448
1652
|
style: {
|
|
1449
1653
|
position: "relative"
|
|
1450
1654
|
},
|
|
1451
1655
|
children: [
|
|
1452
1656
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", _object_spread_props(_object_spread({
|
|
1453
|
-
style:
|
|
1657
|
+
style: styles11.btn
|
|
1454
1658
|
}, data.props), {
|
|
1455
1659
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
|
|
1456
1660
|
style: {
|
|
@@ -1458,27 +1662,31 @@ var Solid = function() {
|
|
|
1458
1662
|
},
|
|
1459
1663
|
children: [
|
|
1460
1664
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {
|
|
1461
|
-
style:
|
|
1665
|
+
style: styles11.labelBefore
|
|
1462
1666
|
}),
|
|
1463
1667
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {
|
|
1464
|
-
style: _object_spread_props(_object_spread({},
|
|
1668
|
+
style: _object_spread_props(_object_spread({}, styles11.label), {
|
|
1465
1669
|
backgroundColor: data.main
|
|
1466
1670
|
}),
|
|
1467
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.
|
|
1468
|
-
style: _object_spread_props(_object_spread({},
|
|
1671
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", {
|
|
1672
|
+
style: _object_spread_props(_object_spread({}, styles11.p), {
|
|
1469
1673
|
color: "".concat(data.text)
|
|
1470
1674
|
}),
|
|
1471
|
-
children:
|
|
1675
|
+
children: [
|
|
1676
|
+
data.children,
|
|
1677
|
+
" ",
|
|
1678
|
+
data.content
|
|
1679
|
+
]
|
|
1472
1680
|
})
|
|
1473
1681
|
}),
|
|
1474
1682
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {
|
|
1475
|
-
style:
|
|
1683
|
+
style: styles11.labelAfter
|
|
1476
1684
|
})
|
|
1477
1685
|
]
|
|
1478
1686
|
})
|
|
1479
1687
|
})),
|
|
1480
1688
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {
|
|
1481
|
-
style:
|
|
1689
|
+
style: styles11.btnAfter
|
|
1482
1690
|
})
|
|
1483
1691
|
]
|
|
1484
1692
|
});
|
|
@@ -1495,14 +1703,15 @@ function useButtonContext() {
|
|
|
1495
1703
|
return data;
|
|
1496
1704
|
}
|
|
1497
1705
|
var Button = function(_param) {
|
|
1498
|
-
var _param_buttonType = _param.buttonType, buttonType = _param_buttonType === void 0 ? "normal" : _param_buttonType,
|
|
1706
|
+
var _param_buttonType = _param.buttonType, buttonType = _param_buttonType === void 0 ? "normal" : _param_buttonType, _param_content = _param.content, content = _param_content === void 0 ? "" : _param_content, _param_main = _param.main, main = _param_main === void 0 ? "#111723" : _param_main, _param_first = _param.first, first = _param_first === void 0 ? "#3e8fbc" : _param_first, _param_second = _param.second, second = _param_second === void 0 ? "#aa6392" : _param_second, _param_text = _param.text, text = _param_text === void 0 ? "#fff" : _param_text, _param_isLoading = _param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, _param_children = _param.children, children = _param_children === void 0 ? void 0 : _param_children, props = _object_without_properties(_param, [
|
|
1499
1707
|
"buttonType",
|
|
1500
1708
|
"content",
|
|
1501
1709
|
"main",
|
|
1502
1710
|
"first",
|
|
1503
1711
|
"second",
|
|
1504
1712
|
"text",
|
|
1505
|
-
"isLoading"
|
|
1713
|
+
"isLoading",
|
|
1714
|
+
"children"
|
|
1506
1715
|
]);
|
|
1507
1716
|
switch(buttonType){
|
|
1508
1717
|
case "gradient":
|
|
@@ -1514,7 +1723,8 @@ var Button = function(_param) {
|
|
|
1514
1723
|
second: second,
|
|
1515
1724
|
text: text,
|
|
1516
1725
|
props: props,
|
|
1517
|
-
isLoading: isLoading
|
|
1726
|
+
isLoading: isLoading,
|
|
1727
|
+
children: children
|
|
1518
1728
|
},
|
|
1519
1729
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Gradient_default, {})
|
|
1520
1730
|
});
|
|
@@ -1526,23 +1736,1294 @@ var Button = function(_param) {
|
|
|
1526
1736
|
first: first,
|
|
1527
1737
|
text: text,
|
|
1528
1738
|
props: props,
|
|
1529
|
-
isLoading: isLoading
|
|
1739
|
+
isLoading: isLoading,
|
|
1740
|
+
children: children
|
|
1530
1741
|
},
|
|
1531
1742
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Solid_default, {})
|
|
1532
1743
|
});
|
|
1533
1744
|
default:
|
|
1534
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.
|
|
1535
|
-
children:
|
|
1745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", _object_spread_props(_object_spread({}, props), {
|
|
1746
|
+
children: [
|
|
1747
|
+
children,
|
|
1748
|
+
" ",
|
|
1749
|
+
content
|
|
1750
|
+
]
|
|
1536
1751
|
}));
|
|
1537
1752
|
}
|
|
1538
1753
|
};
|
|
1539
1754
|
var Button_default = Button;
|
|
1755
|
+
// src/components/Avatar/Avatar.tsx
|
|
1756
|
+
var import_io5 = require("react-icons/io5");
|
|
1757
|
+
var import_fa6 = require("react-icons/fa6");
|
|
1758
|
+
var import_ri = require("react-icons/ri");
|
|
1759
|
+
// src/components/Avatar/styles.ts
|
|
1760
|
+
var others = {
|
|
1761
|
+
iconSize: "20"
|
|
1762
|
+
};
|
|
1763
|
+
var button = {
|
|
1764
|
+
fontSize: "0.8rem",
|
|
1765
|
+
border: "none",
|
|
1766
|
+
borderRadius: "15px",
|
|
1767
|
+
padding: "3%",
|
|
1768
|
+
display: "flex",
|
|
1769
|
+
gap: "5px",
|
|
1770
|
+
justifyContent: "center",
|
|
1771
|
+
alignItems: "center",
|
|
1772
|
+
cursor: "pointer",
|
|
1773
|
+
position: "absolute"
|
|
1774
|
+
};
|
|
1775
|
+
var styles8 = {
|
|
1776
|
+
container: {
|
|
1777
|
+
width: "100%",
|
|
1778
|
+
height: "100%",
|
|
1779
|
+
display: "flex",
|
|
1780
|
+
position: "relative"
|
|
1781
|
+
},
|
|
1782
|
+
image: {
|
|
1783
|
+
borderRadius: "50%",
|
|
1784
|
+
background: "white",
|
|
1785
|
+
objectFit: "cover",
|
|
1786
|
+
width: "100%",
|
|
1787
|
+
height: "100%"
|
|
1788
|
+
},
|
|
1789
|
+
unknown: {
|
|
1790
|
+
display: "flex",
|
|
1791
|
+
justifyContent: "center",
|
|
1792
|
+
alignItems: "center",
|
|
1793
|
+
width: "100%",
|
|
1794
|
+
height: "100%"
|
|
1795
|
+
},
|
|
1796
|
+
upload: _object_spread_props(_object_spread({}, button), {
|
|
1797
|
+
bottom: 0,
|
|
1798
|
+
right: 0
|
|
1799
|
+
}),
|
|
1800
|
+
remove: _object_spread_props(_object_spread({}, button), {
|
|
1801
|
+
top: 0,
|
|
1802
|
+
right: 0
|
|
1803
|
+
}),
|
|
1804
|
+
edit: _object_spread({}, button)
|
|
1805
|
+
};
|
|
1806
|
+
var styles_default8 = styles8;
|
|
1807
|
+
// src/components/Avatar/Avatar.tsx
|
|
1808
|
+
var import_react10 = require("react");
|
|
1809
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1810
|
+
var Avatar = function(param) {
|
|
1811
|
+
var src = param.src, setValue = param.setValue;
|
|
1812
|
+
var setSrc = function setSrc() {
|
|
1813
|
+
return _async_to_generator(function() {
|
|
1814
|
+
var translatedSrc;
|
|
1815
|
+
return _ts_generator(this, function(_state) {
|
|
1816
|
+
switch(_state.label){
|
|
1817
|
+
case 0:
|
|
1818
|
+
return [
|
|
1819
|
+
4,
|
|
1820
|
+
Image_default2.FromStringToImageSrc(src)
|
|
1821
|
+
];
|
|
1822
|
+
case 1:
|
|
1823
|
+
translatedSrc = _state.sent();
|
|
1824
|
+
if (!translatedSrc) return [
|
|
1825
|
+
2
|
|
1826
|
+
];
|
|
1827
|
+
defaultImage.current = translatedSrc;
|
|
1828
|
+
setValue(translatedSrc);
|
|
1829
|
+
return [
|
|
1830
|
+
2
|
|
1831
|
+
];
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1834
|
+
})();
|
|
1835
|
+
};
|
|
1836
|
+
var _ref = _sliced_to_array((0, import_react10.useState)(false), 2), isOpen = _ref[0], setOpen = _ref[1];
|
|
1837
|
+
var _ref1 = _sliced_to_array((0, import_react10.useState)(false), 2), isNew = _ref1[0], setNew = _ref1[1];
|
|
1838
|
+
var uploadImageRef = (0, import_react10.useRef)(null);
|
|
1839
|
+
var defaultImage = (0, import_react10.useRef)("");
|
|
1840
|
+
(0, import_react10.useEffect)(function() {
|
|
1841
|
+
setSrc();
|
|
1842
|
+
}, [
|
|
1843
|
+
src
|
|
1844
|
+
]);
|
|
1845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", {
|
|
1846
|
+
style: styles_default8.container,
|
|
1847
|
+
children: [
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ImageEditor_default, {
|
|
1849
|
+
src: src,
|
|
1850
|
+
setSrc: setValue,
|
|
1851
|
+
isOpen: isOpen,
|
|
1852
|
+
setOpen: setOpen,
|
|
1853
|
+
isNew: isNew
|
|
1854
|
+
}),
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Image_default, {
|
|
1856
|
+
src: src,
|
|
1857
|
+
style: styles_default8.image
|
|
1858
|
+
}),
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Button_default, {
|
|
1860
|
+
style: styles_default8.upload,
|
|
1861
|
+
onClick: function() {
|
|
1862
|
+
var _uploadImageRef_current;
|
|
1863
|
+
return (_uploadImageRef_current = uploadImageRef.current) === null || _uploadImageRef_current === void 0 ? void 0 : _uploadImageRef_current.click();
|
|
1864
|
+
},
|
|
1865
|
+
children: [
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_io5.IoCloudUploadOutline, {
|
|
1867
|
+
size: others.iconSize
|
|
1868
|
+
}),
|
|
1869
|
+
"Upload"
|
|
1870
|
+
]
|
|
1871
|
+
}),
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UploadImage_default, {
|
|
1873
|
+
ref: uploadImageRef,
|
|
1874
|
+
setSrc: function(e) {
|
|
1875
|
+
setValue(e);
|
|
1876
|
+
setOpen(true);
|
|
1877
|
+
setNew(function(prev) {
|
|
1878
|
+
return !prev;
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
}),
|
|
1882
|
+
src !== defaultImage.current && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, {
|
|
1883
|
+
children: [
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Button_default, {
|
|
1885
|
+
style: styles_default8.remove,
|
|
1886
|
+
onClick: function() {
|
|
1887
|
+
setValue(defaultImage.current);
|
|
1888
|
+
setNew(function(prev) {
|
|
1889
|
+
return !prev;
|
|
1890
|
+
});
|
|
1891
|
+
},
|
|
1892
|
+
children: [
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_fa6.FaTrashCan, {
|
|
1894
|
+
size: others.iconSize,
|
|
1895
|
+
color: "red"
|
|
1896
|
+
}),
|
|
1897
|
+
"Remove"
|
|
1898
|
+
]
|
|
1899
|
+
}),
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Button_default, {
|
|
1901
|
+
style: styles_default8.edit,
|
|
1902
|
+
onClick: function() {
|
|
1903
|
+
return setOpen(function(prev) {
|
|
1904
|
+
return !prev;
|
|
1905
|
+
});
|
|
1906
|
+
},
|
|
1907
|
+
children: [
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ri.RiEditLine, {
|
|
1909
|
+
size: others.iconSize
|
|
1910
|
+
}),
|
|
1911
|
+
"Edit"
|
|
1912
|
+
]
|
|
1913
|
+
})
|
|
1914
|
+
]
|
|
1915
|
+
})
|
|
1916
|
+
]
|
|
1917
|
+
});
|
|
1918
|
+
};
|
|
1919
|
+
var Avatar_default = Avatar;
|
|
1920
|
+
// src/components/Input/InputGoogle/InputGoogle.tsx
|
|
1921
|
+
var import_react11 = require("react");
|
|
1922
|
+
// src/components/Input/InputGoogle/InputGoogle.styles.ts
|
|
1923
|
+
var others2 = {
|
|
1924
|
+
topRelease: "50%",
|
|
1925
|
+
topFocus: "0",
|
|
1926
|
+
fontSizeRelease: "16px",
|
|
1927
|
+
fontSizeFocus: "14px",
|
|
1928
|
+
borderRelease: "#cbcbcb",
|
|
1929
|
+
borderFocus: "#0957d0",
|
|
1930
|
+
textRelease: "#000",
|
|
1931
|
+
textFocus: "#0957d0",
|
|
1932
|
+
border: "solid 2px"
|
|
1933
|
+
};
|
|
1934
|
+
var styles9 = {
|
|
1935
|
+
input: {
|
|
1936
|
+
boxSizing: "border-box",
|
|
1937
|
+
height: "40px",
|
|
1938
|
+
width: "100%",
|
|
1939
|
+
border: "".concat(others2.border, " ").concat(others2.borderRelease),
|
|
1940
|
+
borderRadius: "6px",
|
|
1941
|
+
padding: "10px",
|
|
1942
|
+
outline: "none"
|
|
1943
|
+
},
|
|
1944
|
+
container: {
|
|
1945
|
+
width: "100%",
|
|
1946
|
+
position: "relative"
|
|
1947
|
+
},
|
|
1948
|
+
label: {
|
|
1949
|
+
position: "absolute",
|
|
1950
|
+
top: "50%",
|
|
1951
|
+
left: "10px",
|
|
1952
|
+
fontSize: "16px",
|
|
1953
|
+
transform: "translateY(-50%)",
|
|
1954
|
+
transition: "all .1s linear",
|
|
1955
|
+
padding: "0px 5px",
|
|
1956
|
+
backgroundColor: "white"
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
var InputGoogle_styles_default = styles9;
|
|
1960
|
+
// src/components/Input/InputGoogle/InputGoogle.tsx
|
|
1961
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1962
|
+
var InputGoogle = function(_param) {
|
|
1963
|
+
var transitionOnFocus = function transitionOnFocus() {
|
|
1964
|
+
setFocus(true);
|
|
1965
|
+
if (spanRef.current) {
|
|
1966
|
+
spanRef.current.style.top = others2.topFocus;
|
|
1967
|
+
spanRef.current.style.fontSize = others2.fontSizeFocus;
|
|
1968
|
+
}
|
|
1969
|
+
};
|
|
1970
|
+
var transitionOffFocus = function transitionOffFocus() {
|
|
1971
|
+
setFocus(false);
|
|
1972
|
+
if (value) return;
|
|
1973
|
+
if (spanRef.current) {
|
|
1974
|
+
spanRef.current.style.top = others2.topRelease;
|
|
1975
|
+
spanRef.current.style.fontSize = others2.fontSizeRelease;
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
var handleClickOnLabel = function handleClickOnLabel() {
|
|
1979
|
+
var _inputRef_current;
|
|
1980
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
1981
|
+
};
|
|
1982
|
+
var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, _param_setValue = _param.setValue, setValue = _param_setValue === void 0 ? function() {} : _param_setValue, _param_label = _param.label, label = _param_label === void 0 ? "Input Google Component Label" : _param_label, options = _param.options, props = _object_without_properties(_param, [
|
|
1983
|
+
"value",
|
|
1984
|
+
"setValue",
|
|
1985
|
+
"label",
|
|
1986
|
+
"options"
|
|
1987
|
+
]);
|
|
1988
|
+
var _ref = _sliced_to_array((0, import_react11.useState)(false), 2), isFocus = _ref[0], setFocus = _ref[1];
|
|
1989
|
+
var spanRef = (0, import_react11.useRef)(null);
|
|
1990
|
+
var inputRef = (0, import_react11.useRef)(null);
|
|
1991
|
+
var inputBorder = isFocus ? "".concat(others2.border, " ").concat(options ? options.focusColor : others2.borderFocus) : "".concat(others2.border, " ").concat(others2.borderRelease);
|
|
1992
|
+
var labelTextColor = isFocus ? "".concat(options ? options.focusColor : others2.textFocus) : "".concat(others2.textRelease);
|
|
1993
|
+
(0, import_react11.useEffect)(function() {
|
|
1994
|
+
transitionOnFocus();
|
|
1995
|
+
transitionOffFocus();
|
|
1996
|
+
}, []);
|
|
1997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", {
|
|
1998
|
+
style: InputGoogle_styles_default.container,
|
|
1999
|
+
children: [
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", _object_spread({
|
|
2001
|
+
id: "will-input-google",
|
|
2002
|
+
ref: inputRef,
|
|
2003
|
+
value: value,
|
|
2004
|
+
onChange: function(e) {
|
|
2005
|
+
return setValue(e.target.value);
|
|
2006
|
+
},
|
|
2007
|
+
type: "text",
|
|
2008
|
+
style: _object_spread_props(_object_spread({}, InputGoogle_styles_default.input), {
|
|
2009
|
+
border: inputBorder
|
|
2010
|
+
}),
|
|
2011
|
+
onFocus: transitionOnFocus,
|
|
2012
|
+
onBlur: transitionOffFocus
|
|
2013
|
+
}, props)),
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
2015
|
+
ref: spanRef,
|
|
2016
|
+
style: _object_spread_props(_object_spread({}, InputGoogle_styles_default.label), {
|
|
2017
|
+
color: labelTextColor
|
|
2018
|
+
}),
|
|
2019
|
+
onClick: handleClickOnLabel,
|
|
2020
|
+
children: label
|
|
2021
|
+
})
|
|
2022
|
+
]
|
|
2023
|
+
});
|
|
2024
|
+
};
|
|
2025
|
+
var InputGoogle_default = InputGoogle;
|
|
2026
|
+
// src/components/Input/TextArea/TextArea.tsx
|
|
2027
|
+
var import_react12 = require("react");
|
|
2028
|
+
// src/components/Input/TextArea/TextArea.styles.ts
|
|
2029
|
+
var labelHeight = 20;
|
|
2030
|
+
var others3 = {
|
|
2031
|
+
topRelease: "".concat(labelHeight + 5, "px"),
|
|
2032
|
+
topFocus: "0",
|
|
2033
|
+
fontSizeRelease: "16px",
|
|
2034
|
+
fontSizeFocus: "14px",
|
|
2035
|
+
borderRelease: "#cbcbcb",
|
|
2036
|
+
borderFocus: "#0957d0",
|
|
2037
|
+
textRelease: "#000",
|
|
2038
|
+
textFocus: "#0957d0",
|
|
2039
|
+
border: "solid 2px"
|
|
2040
|
+
};
|
|
2041
|
+
var styles10 = {
|
|
2042
|
+
input: {
|
|
2043
|
+
boxSizing: "border-box",
|
|
2044
|
+
height: "100%",
|
|
2045
|
+
width: "100%",
|
|
2046
|
+
border: "".concat(others3.border, " ").concat(others3.borderRelease),
|
|
2047
|
+
borderRadius: "6px",
|
|
2048
|
+
padding: "10px",
|
|
2049
|
+
outline: "none",
|
|
2050
|
+
resize: "none"
|
|
2051
|
+
},
|
|
2052
|
+
container: {
|
|
2053
|
+
width: "100%",
|
|
2054
|
+
height: "100%",
|
|
2055
|
+
position: "relative"
|
|
2056
|
+
},
|
|
2057
|
+
label: {
|
|
2058
|
+
height: "".concat(labelHeight, "px"),
|
|
2059
|
+
position: "absolute",
|
|
2060
|
+
top: "".concat(labelHeight + 5, "px"),
|
|
2061
|
+
left: "10px",
|
|
2062
|
+
fontSize: "16px",
|
|
2063
|
+
transform: "translateY(-50%)",
|
|
2064
|
+
transition: "all .1s linear",
|
|
2065
|
+
padding: "0px 5px",
|
|
2066
|
+
backgroundColor: "white"
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
var TextArea_styles_default = styles10;
|
|
2070
|
+
// src/components/Input/TextArea/TextArea.tsx
|
|
2071
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2072
|
+
var TextArea = function(_param) {
|
|
2073
|
+
var transitionOnFocus = function transitionOnFocus() {
|
|
2074
|
+
setFocus(true);
|
|
2075
|
+
if (spanRef.current) {
|
|
2076
|
+
spanRef.current.style.top = others3.topFocus;
|
|
2077
|
+
spanRef.current.style.fontSize = others3.fontSizeFocus;
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
var transitionOffFocus = function transitionOffFocus() {
|
|
2081
|
+
setFocus(false);
|
|
2082
|
+
if (value) return;
|
|
2083
|
+
if (spanRef.current) {
|
|
2084
|
+
spanRef.current.style.top = others3.topRelease;
|
|
2085
|
+
spanRef.current.style.fontSize = others3.fontSizeRelease;
|
|
2086
|
+
}
|
|
2087
|
+
};
|
|
2088
|
+
var handleClickOnLabel = function handleClickOnLabel() {
|
|
2089
|
+
var _inputRef_current;
|
|
2090
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
2091
|
+
};
|
|
2092
|
+
var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, _param_setValue = _param.setValue, setValue = _param_setValue === void 0 ? function() {} : _param_setValue, _param_label = _param.label, label = _param_label === void 0 ? "Text Component Label" : _param_label, options = _param.options, props = _object_without_properties(_param, [
|
|
2093
|
+
"value",
|
|
2094
|
+
"setValue",
|
|
2095
|
+
"label",
|
|
2096
|
+
"options"
|
|
2097
|
+
]);
|
|
2098
|
+
var _ref = _sliced_to_array((0, import_react12.useState)(false), 2), isFocus = _ref[0], setFocus = _ref[1];
|
|
2099
|
+
var spanRef = (0, import_react12.useRef)(null);
|
|
2100
|
+
var inputRef = (0, import_react12.useRef)(null);
|
|
2101
|
+
var inputBorder = isFocus ? "".concat(others3.border, " ").concat(options ? options.focusColor : others3.borderFocus) : "".concat(others3.border, " ").concat(others3.borderRelease);
|
|
2102
|
+
var labelTextColor = isFocus ? "".concat(options ? options.focusColor : others3.textFocus) : "".concat(others3.textRelease);
|
|
2103
|
+
(0, import_react12.useEffect)(function() {
|
|
2104
|
+
transitionOnFocus();
|
|
2105
|
+
transitionOffFocus();
|
|
2106
|
+
}, []);
|
|
2107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", {
|
|
2108
|
+
style: TextArea_styles_default.container,
|
|
2109
|
+
children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", _object_spread({
|
|
2111
|
+
id: "will-textarea",
|
|
2112
|
+
ref: inputRef,
|
|
2113
|
+
value: value,
|
|
2114
|
+
onChange: function(e) {
|
|
2115
|
+
return setValue(e.target.value);
|
|
2116
|
+
},
|
|
2117
|
+
style: _object_spread_props(_object_spread({}, TextArea_styles_default.input), {
|
|
2118
|
+
border: inputBorder
|
|
2119
|
+
}),
|
|
2120
|
+
onFocus: transitionOnFocus,
|
|
2121
|
+
onBlur: transitionOffFocus
|
|
2122
|
+
}, props)),
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", {
|
|
2124
|
+
ref: spanRef,
|
|
2125
|
+
style: _object_spread_props(_object_spread({}, TextArea_styles_default.label), {
|
|
2126
|
+
color: labelTextColor
|
|
2127
|
+
}),
|
|
2128
|
+
onClick: handleClickOnLabel,
|
|
2129
|
+
children: label
|
|
2130
|
+
})
|
|
2131
|
+
]
|
|
2132
|
+
});
|
|
2133
|
+
};
|
|
2134
|
+
var TextArea_default = TextArea;
|
|
2135
|
+
// src/components/Input/InputFile.tsx
|
|
2136
|
+
var import_react13 = require("react");
|
|
2137
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2138
|
+
var InputFile = function(_param) {
|
|
2139
|
+
var file = _param.file, onChoose = _param.onChoose, _param_onCancel = _param.onCancel, onCancel = _param_onCancel === void 0 ? function() {} : _param_onCancel, _param_acceptType = _param.acceptType, acceptType = _param_acceptType === void 0 ? "image/*" : _param_acceptType, props = _object_without_properties(_param, [
|
|
2140
|
+
"file",
|
|
2141
|
+
"onChoose",
|
|
2142
|
+
"onCancel",
|
|
2143
|
+
"acceptType"
|
|
2144
|
+
]);
|
|
2145
|
+
var _ref = _sliced_to_array((0, import_react13.useState)(Date.now()), 2), key = _ref[0], setKey = _ref[1];
|
|
2146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", _object_spread_props(_object_spread({
|
|
2147
|
+
type: "file"
|
|
2148
|
+
}, props), {
|
|
2149
|
+
onChange: function(e) {
|
|
2150
|
+
var _target_files;
|
|
2151
|
+
var target = e.target;
|
|
2152
|
+
var file2 = (_target_files = target.files) === null || _target_files === void 0 ? void 0 : _target_files[0];
|
|
2153
|
+
if (file2) {
|
|
2154
|
+
setKey(Date.now());
|
|
2155
|
+
onChoose(file2);
|
|
2156
|
+
} else {
|
|
2157
|
+
onCancel();
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
}), key);
|
|
2161
|
+
};
|
|
2162
|
+
var InputFile_default = InputFile;
|
|
2163
|
+
// src/components/Image/UploadImage.tsx
|
|
2164
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2165
|
+
var UploadImage = function(_param) {
|
|
2166
|
+
var handleSetSrc = function handleSetSrc(file) {
|
|
2167
|
+
return _async_to_generator(function() {
|
|
2168
|
+
var src;
|
|
2169
|
+
return _ts_generator(this, function(_state) {
|
|
2170
|
+
switch(_state.label){
|
|
2171
|
+
case 0:
|
|
2172
|
+
return [
|
|
2173
|
+
4,
|
|
2174
|
+
Image_default2.FromFileToImageSrc(file)
|
|
2175
|
+
];
|
|
2176
|
+
case 1:
|
|
2177
|
+
src = _state.sent();
|
|
2178
|
+
if (!src) return [
|
|
2179
|
+
2
|
|
2180
|
+
];
|
|
2181
|
+
setSrc(src);
|
|
2182
|
+
return [
|
|
2183
|
+
2
|
|
2184
|
+
];
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2187
|
+
})();
|
|
2188
|
+
};
|
|
2189
|
+
var _param_setSrc = _param.setSrc, setSrc = _param_setSrc === void 0 ? function() {} : _param_setSrc, props = _object_without_properties(_param, [
|
|
2190
|
+
"setSrc"
|
|
2191
|
+
]);
|
|
2192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, {
|
|
2193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputFile_default, _object_spread_props(_object_spread({
|
|
2194
|
+
onChoose: handleSetSrc,
|
|
2195
|
+
acceptType: "image/*"
|
|
2196
|
+
}, props), {
|
|
2197
|
+
hidden: true
|
|
2198
|
+
}))
|
|
2199
|
+
});
|
|
2200
|
+
};
|
|
2201
|
+
var UploadImage_default = UploadImage;
|
|
2202
|
+
// src/components/Image/Image.tsx
|
|
2203
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2204
|
+
var Image = function(_param) {
|
|
2205
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
2206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", _object_spread_props(_object_spread({
|
|
2207
|
+
style: {
|
|
2208
|
+
width: "100%",
|
|
2209
|
+
height: "100%"
|
|
2210
|
+
}
|
|
2211
|
+
}, props), {
|
|
2212
|
+
alt: "Will-Image-Component",
|
|
2213
|
+
draggable: false
|
|
2214
|
+
}));
|
|
2215
|
+
};
|
|
2216
|
+
var Image_default = Image;
|
|
2217
|
+
// src/components/Image/ImageEditor/ImageEditor.tsx
|
|
2218
|
+
var import_react14 = require("react");
|
|
2219
|
+
// src/components/Image/ImageEditor/ImageEditor.styles.ts
|
|
2220
|
+
var imageEditorStyles = {
|
|
2221
|
+
imageEditor: {
|
|
2222
|
+
width: "100vw",
|
|
2223
|
+
height: "100dvh",
|
|
2224
|
+
display: "flex",
|
|
2225
|
+
flexDirection: "column",
|
|
2226
|
+
justifyContent: "center",
|
|
2227
|
+
alignItems: "center",
|
|
2228
|
+
position: "fixed",
|
|
2229
|
+
top: 0,
|
|
2230
|
+
left: 0,
|
|
2231
|
+
backdropFilter: "blur(20px)",
|
|
2232
|
+
zIndex: 99,
|
|
2233
|
+
paddingLeft: "30px",
|
|
2234
|
+
paddingRight: "30px"
|
|
2235
|
+
},
|
|
2236
|
+
frame: {
|
|
2237
|
+
padding: "50px",
|
|
2238
|
+
backgroundColor: "white",
|
|
2239
|
+
border: "solid 4px #000",
|
|
2240
|
+
borderStyle: "dashed",
|
|
2241
|
+
borderRadius: "50%",
|
|
2242
|
+
overflow: "hidden",
|
|
2243
|
+
maxWidth: "500px",
|
|
2244
|
+
width: "100%",
|
|
2245
|
+
maxHeight: "500px",
|
|
2246
|
+
aspectRatio: 1 / 1,
|
|
2247
|
+
position: "relative"
|
|
2248
|
+
},
|
|
2249
|
+
wrapper: {
|
|
2250
|
+
position: "absolute",
|
|
2251
|
+
transformOrigin: "top left",
|
|
2252
|
+
userSelect: "none"
|
|
2253
|
+
},
|
|
2254
|
+
img: {
|
|
2255
|
+
objectFit: "contain",
|
|
2256
|
+
position: "absolute",
|
|
2257
|
+
top: 0,
|
|
2258
|
+
left: 0,
|
|
2259
|
+
display: "block",
|
|
2260
|
+
zIndex: 1,
|
|
2261
|
+
transform: "translate(-50%, -50%)"
|
|
2262
|
+
},
|
|
2263
|
+
buttons: {
|
|
2264
|
+
display: "flex",
|
|
2265
|
+
justifyContent: "center",
|
|
2266
|
+
alignItems: "center",
|
|
2267
|
+
gap: "20px",
|
|
2268
|
+
padding: "30px"
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
var ImageEditor_styles_default = imageEditorStyles;
|
|
2272
|
+
// src/components/Image/ImageEditor/ImageEditor.tsx
|
|
2273
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2274
|
+
var ImageEditor = function(param) {
|
|
2275
|
+
var src = param.src, _param_setSrc = param.setSrc, setSrc = _param_setSrc === void 0 ? function() {} : _param_setSrc, _param_isOpen = param.isOpen, isOpen = _param_isOpen === void 0 ? false : _param_isOpen, _param_setOpen = param.setOpen, setOpen = _param_setOpen === void 0 ? function() {} : _param_setOpen, _param_isNew = param.isNew, isNew = _param_isNew === void 0 ? false : _param_isNew;
|
|
2276
|
+
var createTransform = function createTransform() {
|
|
2277
|
+
return _async_to_generator(function() {
|
|
2278
|
+
var transform2;
|
|
2279
|
+
return _ts_generator(this, function(_state) {
|
|
2280
|
+
switch(_state.label){
|
|
2281
|
+
case 0:
|
|
2282
|
+
if (!frame.current || !wrapper.current || !img.current) return [
|
|
2283
|
+
2
|
|
2284
|
+
];
|
|
2285
|
+
transform2 = new Transform(wrapper.current, frame.current);
|
|
2286
|
+
return [
|
|
2287
|
+
4,
|
|
2288
|
+
transform2.initialize()
|
|
2289
|
+
];
|
|
2290
|
+
case 1:
|
|
2291
|
+
_state.sent();
|
|
2292
|
+
if (transformState.current) {
|
|
2293
|
+
transform2.setState(transformState.current);
|
|
2294
|
+
} else {
|
|
2295
|
+
transform2.reset();
|
|
2296
|
+
}
|
|
2297
|
+
setTransform(transform2);
|
|
2298
|
+
return [
|
|
2299
|
+
2
|
|
2300
|
+
];
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2303
|
+
})();
|
|
2304
|
+
};
|
|
2305
|
+
var handleCanvasToSrc = function handleCanvasToSrc() {
|
|
2306
|
+
if (!frame.current || !wrapper.current || !img.current || !transform) return;
|
|
2307
|
+
var canvasInstance = new Canvas();
|
|
2308
|
+
var _canvasInstance_createCanvas = canvasInstance.createCanvas(700, 700), canvas = _canvasInstance_createCanvas.canvas, context = _canvasInstance_createCanvas.context;
|
|
2309
|
+
var _transform_exportData = transform.exportData(), x = _transform_exportData.x, y = _transform_exportData.y, angle = _transform_exportData.angle;
|
|
2310
|
+
transformState.current = transform.exportData();
|
|
2311
|
+
var _canvasInstance_drawImage = canvasInstance.drawImage(img.current, context, x, y, 1, angle, canvas, frame.current.clientWidth, frame.current.clientHeight), src2 = _canvasInstance_drawImage.src;
|
|
2312
|
+
return src2;
|
|
2313
|
+
};
|
|
2314
|
+
var handleAccept = function handleAccept() {
|
|
2315
|
+
setSrc(handleCanvasToSrc());
|
|
2316
|
+
setOpen(false);
|
|
2317
|
+
};
|
|
2318
|
+
var handleCancel = function handleCancel() {
|
|
2319
|
+
setOpen(false);
|
|
2320
|
+
};
|
|
2321
|
+
var handleReset = function handleReset() {
|
|
2322
|
+
if (!transform) return;
|
|
2323
|
+
transform.reset();
|
|
2324
|
+
};
|
|
2325
|
+
var frame = (0, import_react14.useRef)(null);
|
|
2326
|
+
var wrapper = (0, import_react14.useRef)(null);
|
|
2327
|
+
var img = (0, import_react14.useRef)(null);
|
|
2328
|
+
var _ref = _sliced_to_array((0, import_react14.useState)(void 0), 2), transform = _ref[0], setTransform = _ref[1];
|
|
2329
|
+
var transformState = (0, import_react14.useRef)(void 0);
|
|
2330
|
+
var originalSrc = (0, import_react14.useMemo)(function() {
|
|
2331
|
+
transformState.current = void 0;
|
|
2332
|
+
return src;
|
|
2333
|
+
}, [
|
|
2334
|
+
isNew
|
|
2335
|
+
]);
|
|
2336
|
+
(0, import_react14.useEffect)(function() {
|
|
2337
|
+
isOpen ? createTransform() : setTransform(void 0);
|
|
2338
|
+
}, [
|
|
2339
|
+
isOpen
|
|
2340
|
+
]);
|
|
2341
|
+
if (!isOpen) return;
|
|
2342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", {
|
|
2343
|
+
style: ImageEditor_styles_default.imageEditor,
|
|
2344
|
+
children: [
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", {
|
|
2346
|
+
children: "Drag, Zoom, or Rotate image"
|
|
2347
|
+
}),
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", {
|
|
2349
|
+
ref: frame,
|
|
2350
|
+
style: ImageEditor_styles_default.frame,
|
|
2351
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", {
|
|
2352
|
+
ref: wrapper,
|
|
2353
|
+
style: ImageEditor_styles_default.wrapper,
|
|
2354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", {
|
|
2355
|
+
src: originalSrc,
|
|
2356
|
+
style: ImageEditor_styles_default.img,
|
|
2357
|
+
ref: img
|
|
2358
|
+
})
|
|
2359
|
+
})
|
|
2360
|
+
}),
|
|
2361
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", {
|
|
2362
|
+
style: ImageEditor_styles_default.buttons,
|
|
2363
|
+
children: [
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default, {
|
|
2365
|
+
buttonType: "solid",
|
|
2366
|
+
content: "Accept",
|
|
2367
|
+
onClick: handleAccept
|
|
2368
|
+
}),
|
|
2369
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default, {
|
|
2370
|
+
buttonType: "solid",
|
|
2371
|
+
content: "Cancel",
|
|
2372
|
+
onClick: handleCancel
|
|
2373
|
+
}),
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default, {
|
|
2375
|
+
buttonType: "solid",
|
|
2376
|
+
content: "Reset",
|
|
2377
|
+
onClick: handleReset
|
|
2378
|
+
})
|
|
2379
|
+
]
|
|
2380
|
+
})
|
|
2381
|
+
]
|
|
2382
|
+
});
|
|
2383
|
+
};
|
|
2384
|
+
var ImageEditor_default = ImageEditor;
|
|
2385
|
+
// src/utilities/canvas/Canvas.ts
|
|
2386
|
+
var Canvas = /*#__PURE__*/ function() {
|
|
2387
|
+
function Canvas() {
|
|
2388
|
+
_class_call_check(this, Canvas);
|
|
2389
|
+
}
|
|
2390
|
+
_create_class(Canvas, [
|
|
2391
|
+
{
|
|
2392
|
+
key: "createCanvas",
|
|
2393
|
+
value: function createCanvas(width, height) {
|
|
2394
|
+
var canvas = document.createElement("canvas");
|
|
2395
|
+
var context = canvas.getContext("2d");
|
|
2396
|
+
canvas.width = width;
|
|
2397
|
+
canvas.height = height;
|
|
2398
|
+
return {
|
|
2399
|
+
canvas: canvas,
|
|
2400
|
+
context: context
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
},
|
|
2404
|
+
{
|
|
2405
|
+
key: "drawImage",
|
|
2406
|
+
value: function drawImage(e, ctx, x, y, scale, angle, canvas, containerWidth, containerHeight) {
|
|
2407
|
+
var ratioX = canvas.width / containerWidth;
|
|
2408
|
+
var ratioY = canvas.height / containerHeight;
|
|
2409
|
+
var finalX = x * ratioX;
|
|
2410
|
+
var finalY = y * ratioY;
|
|
2411
|
+
var midleWidth = e.width * ratioX;
|
|
2412
|
+
var midleHeight = e.height * ratioY;
|
|
2413
|
+
var finalWidth = e.width * ratioX * scale;
|
|
2414
|
+
var finalHeight = e.height * ratioY * scale;
|
|
2415
|
+
ctx.save();
|
|
2416
|
+
ctx.translate(finalX + midleWidth / 2, finalY + midleHeight / 2);
|
|
2417
|
+
ctx.rotate(angle * Math.PI / 180);
|
|
2418
|
+
ctx.drawImage(e, -finalWidth / 2, -finalHeight / 2, finalWidth, finalHeight);
|
|
2419
|
+
ctx.restore();
|
|
2420
|
+
var src = ctx.canvas.toDataURL();
|
|
2421
|
+
var srcEncoded = src.split(",")[1];
|
|
2422
|
+
return {
|
|
2423
|
+
context: ctx,
|
|
2424
|
+
src: src
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2427
|
+
},
|
|
2428
|
+
{
|
|
2429
|
+
key: "drawColor",
|
|
2430
|
+
value: function drawColor(type, color, ctx, width, ratio) {
|
|
2431
|
+
if (type === "") color = "#ffffff";
|
|
2432
|
+
if (type === "gradient") {
|
|
2433
|
+
var breakdownArr = color.split(",");
|
|
2434
|
+
var _ref = [
|
|
2435
|
+
Number(breakdownArr[0]),
|
|
2436
|
+
breakdownArr[1],
|
|
2437
|
+
Number(breakdownArr[2]),
|
|
2438
|
+
breakdownArr[3],
|
|
2439
|
+
Number(breakdownArr[4])
|
|
2440
|
+
], angle = _ref[0], color1 = _ref[1], percent1 = _ref[2], color2 = _ref[3], percent2 = _ref[4];
|
|
2441
|
+
var radians = (angle - 180) * Math.PI / 180;
|
|
2442
|
+
var x0 = width / 2 + width / 2 * Math.cos(radians - Math.PI / 2);
|
|
2443
|
+
var y0 = width * ratio / 2 + width * ratio / 2 * Math.sin(radians - Math.PI / 2);
|
|
2444
|
+
var x1 = width / 2 - width / 2 * Math.cos(radians - Math.PI / 2);
|
|
2445
|
+
var y1 = width * ratio / 2 - width * ratio / 2 * Math.sin(radians - Math.PI / 2);
|
|
2446
|
+
var gradient = ctx.createLinearGradient(x0, y0, x1, y1);
|
|
2447
|
+
gradient.addColorStop(percent1 / 100, color1);
|
|
2448
|
+
gradient.addColorStop(percent2 / 100, color2);
|
|
2449
|
+
ctx.fillStyle = gradient;
|
|
2450
|
+
ctx.fillRect(0, 0, width, width * ratio);
|
|
2451
|
+
var srcEncoded = ctx.canvas.toDataURL().split(",")[1];
|
|
2452
|
+
return [
|
|
2453
|
+
ctx,
|
|
2454
|
+
srcEncoded
|
|
2455
|
+
];
|
|
2456
|
+
} else {
|
|
2457
|
+
ctx.fillStyle = color;
|
|
2458
|
+
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
2459
|
+
var srcEncoded1 = ctx.canvas.toDataURL().split(",")[1];
|
|
2460
|
+
return [
|
|
2461
|
+
ctx,
|
|
2462
|
+
srcEncoded1
|
|
2463
|
+
];
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
]);
|
|
2468
|
+
return Canvas;
|
|
2469
|
+
}();
|
|
2470
|
+
// src/utilities/canvas/Image.ts
|
|
2471
|
+
var Image2 = {
|
|
2472
|
+
/**
|
|
2473
|
+
* Convert file (blob) to base64 string format
|
|
2474
|
+
* @param file
|
|
2475
|
+
* @returns
|
|
2476
|
+
*/ FromFileToImageSrc: function FromFileToImageSrc(file) {
|
|
2477
|
+
return new Promise(function(resolve, reject) {
|
|
2478
|
+
if (!file) return resolve(null);
|
|
2479
|
+
var reader = new FileReader();
|
|
2480
|
+
reader.readAsDataURL(file);
|
|
2481
|
+
reader.onload = function(readerEvent) {
|
|
2482
|
+
var _readerEvent_target;
|
|
2483
|
+
if ((_readerEvent_target = readerEvent.target) === null || _readerEvent_target === void 0 ? void 0 : _readerEvent_target.result) {
|
|
2484
|
+
var _readerEvent_target1;
|
|
2485
|
+
return resolve((_readerEvent_target1 = readerEvent.target) === null || _readerEvent_target1 === void 0 ? void 0 : _readerEvent_target1.result);
|
|
2486
|
+
}
|
|
2487
|
+
reject("Error getting the image source");
|
|
2488
|
+
};
|
|
2489
|
+
reader.onerror = function() {
|
|
2490
|
+
reject("Error getting the image source");
|
|
2491
|
+
};
|
|
2492
|
+
});
|
|
2493
|
+
},
|
|
2494
|
+
FromStringToImageSrc: /**
|
|
2495
|
+
* Convert urlst
|
|
2496
|
+
* @param url
|
|
2497
|
+
* @returns
|
|
2498
|
+
*/ function FromStringToImageSrc(url) {
|
|
2499
|
+
return _async_to_generator(function() {
|
|
2500
|
+
var res, blob, src;
|
|
2501
|
+
return _ts_generator(this, function(_state) {
|
|
2502
|
+
switch(_state.label){
|
|
2503
|
+
case 0:
|
|
2504
|
+
if (!url || Image2.isBase64(url)) return [
|
|
2505
|
+
2,
|
|
2506
|
+
null
|
|
2507
|
+
];
|
|
2508
|
+
return [
|
|
2509
|
+
4,
|
|
2510
|
+
fetch(url)
|
|
2511
|
+
];
|
|
2512
|
+
case 1:
|
|
2513
|
+
res = _state.sent();
|
|
2514
|
+
return [
|
|
2515
|
+
4,
|
|
2516
|
+
res.blob()
|
|
2517
|
+
];
|
|
2518
|
+
case 2:
|
|
2519
|
+
blob = _state.sent();
|
|
2520
|
+
return [
|
|
2521
|
+
4,
|
|
2522
|
+
Image2.FromFileToImageSrc(blob)
|
|
2523
|
+
];
|
|
2524
|
+
case 3:
|
|
2525
|
+
src = _state.sent();
|
|
2526
|
+
return [
|
|
2527
|
+
2,
|
|
2528
|
+
src
|
|
2529
|
+
];
|
|
2530
|
+
}
|
|
2531
|
+
});
|
|
2532
|
+
})();
|
|
2533
|
+
},
|
|
2534
|
+
/**
|
|
2535
|
+
* Check if the url is base64 format
|
|
2536
|
+
* @param url
|
|
2537
|
+
* @deprecated Using a weak condition and might be changed later. Use checkBase64 instead
|
|
2538
|
+
*/ checkBase64: function checkBase64(url) {
|
|
2539
|
+
if (!url || url === "") return false;
|
|
2540
|
+
return url.includes("base64,");
|
|
2541
|
+
},
|
|
2542
|
+
isBase64: function isBase64(url) {
|
|
2543
|
+
return Image2.checkBase64(url);
|
|
2544
|
+
}
|
|
2545
|
+
};
|
|
2546
|
+
var Image_default2 = Image2;
|
|
2547
|
+
// src/utilities/Transform/Transform.ts
|
|
2548
|
+
var import_jquery2 = __toESM(require("jquery"));
|
|
2549
|
+
// src/utilities/Transform/TransformController.ts
|
|
2550
|
+
var import_jquery = __toESM(require("jquery"));
|
|
2551
|
+
var import_fontawesome_svg_core = require("@fortawesome/fontawesome-svg-core");
|
|
2552
|
+
var import_free_solid_svg_icons = require("@fortawesome/free-solid-svg-icons");
|
|
2553
|
+
var TransformController = /*#__PURE__*/ function() {
|
|
2554
|
+
function TransformController(wrapper, frame, controller) {
|
|
2555
|
+
_class_call_check(this, TransformController);
|
|
2556
|
+
this.wrapper = wrapper;
|
|
2557
|
+
this.frame = frame;
|
|
2558
|
+
this.controller = controller;
|
|
2559
|
+
}
|
|
2560
|
+
_create_class(TransformController, [
|
|
2561
|
+
{
|
|
2562
|
+
key: "addController",
|
|
2563
|
+
value: function addController() {
|
|
2564
|
+
var _this = this;
|
|
2565
|
+
return new Promise(function(res) {
|
|
2566
|
+
var styleElement = document.createElement("style");
|
|
2567
|
+
styleElement.textContent = _this.css();
|
|
2568
|
+
document.head.appendChild(styleElement);
|
|
2569
|
+
(0, import_jquery.default)("." + _this.frame).after(_this.controllerTemplate());
|
|
2570
|
+
res();
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
},
|
|
2574
|
+
{
|
|
2575
|
+
key: "css",
|
|
2576
|
+
value: function css() {
|
|
2577
|
+
return "\n .".concat(this.wrapper, " {\n position: absolute;\n transform-origin: top left;\n user-select: none;\n }\n .").concat(this.wrapper, " > img {\n object-fit: contain;\n position: absolute;\n top: 0;\n left: 0;\n display: block;\n z-index: 1;\n transform: translate(-50%, -50%)\n }\n .").concat(this.controller, "--container {\n position: absolute;\n transform-origin: top left;\n user-select: none;\n }\n .").concat(this.controller, " {\n position: absolute;\n user-select: none;\n border: solid 3px #6924d5;\n z-index: 1;\n top: 0;\n left: 0;\n transform: translate(-50%, -50%);\n }\n .").concat(this.controller, " .resize {\n background-color: #fff;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;\n transition: all .1s linear;\n }\n .").concat(this.controller, " .resize.show {\n background-color: #6924d5;\n }\n .").concat(this.controller, " .resize > .circle {\n background-color: #f0f0f0a8;\n position: absolute;\n top: -15px;\n left: -15px;\n width: 50px;\n height: 50px;\n border-radius: 50%;\n box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;\n z-index: -1;\n visibility: hidden;\n transition: all .1s linear;\n }\n .").concat(this.controller, " .resize > .circle.show {\n visibility: visible;\n }\n .").concat(this.controller, " .resize.resize-topleft {\n position: absolute;\n top: -10px;\n left: -10px;\n }\n .").concat(this.controller, " .resize.resize-topright {\n position: absolute;\n top: -10px;\n right: -10px;\n }\n .").concat(this.controller, " .resize.resize-bottomleft {\n position: absolute;\n bottom: -10px;\n left: -10px;\n }\n .").concat(this.controller, " .resize.resize-bottomright {\n position: absolute;\n bottom: -10px;\n right: -10px;\n }\n .").concat(this.controller, " .rotate {\n position: absolute;\n top: -50px;\n left: calc(50% - 15px);\n width: 30px;\n height: 30px;\n background-color: #fff;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .").concat(this.controller, " .delete {\n position: absolute;\n bottom: -50px;\n left: calc(50% + 40px);\n width: 30px;\n height: 30px;\n background-color: #fff;\n border-radius: 50%;\n display: none;\n justify-content: center;\n align-items: center;\n }\n ");
|
|
2578
|
+
}
|
|
2579
|
+
},
|
|
2580
|
+
{
|
|
2581
|
+
key: "controllerTemplate",
|
|
2582
|
+
value: function controllerTemplate() {
|
|
2583
|
+
return '\n <div class="'.concat(this.controller, '--container">\n <div class="').concat(this.controller, '">\n <div class="dot resize resize-topleft"><div class="circle"></div></div>\n <div class="dot resize resize-topright"><div class="circle"></div></div>\n <div class="dot resize resize-bottomleft"><div class="circle"></div></div>\n <div class="dot resize resize-bottomright"><div class="circle"></div></div>\n <div class="dot rotate">').concat((0, import_fontawesome_svg_core.icon)(import_free_solid_svg_icons.faRotate).html[0], '</div>\n <div class="dot rotate shadow" style="visibility: hidden;">').concat((0, import_fontawesome_svg_core.icon)(import_free_solid_svg_icons.faRotate).html[0], '</div>\n <div class="dot delete">').concat((0, import_fontawesome_svg_core.icon)(import_free_solid_svg_icons.faTrash).html[0], '</div>\n <div class="dot delete shadow" style="visibility: hidden;">').concat((0, import_fontawesome_svg_core.icon)(import_free_solid_svg_icons.faTrash).html[0], "</div>\n </div>\n </div>\n ");
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
]);
|
|
2587
|
+
return TransformController;
|
|
2588
|
+
}();
|
|
2589
|
+
// src/utilities/Transform/Transform.ts
|
|
2590
|
+
var Transform = /*#__PURE__*/ function() {
|
|
2591
|
+
function Transform(ele1, ele2, ele3) {
|
|
2592
|
+
_class_call_check(this, Transform);
|
|
2593
|
+
this.ele1 = ele1;
|
|
2594
|
+
this.ele2 = ele2;
|
|
2595
|
+
this.x = 0;
|
|
2596
|
+
this.y = 0;
|
|
2597
|
+
this.angle = 90;
|
|
2598
|
+
this.w = 0;
|
|
2599
|
+
this.h = 0;
|
|
2600
|
+
if (this.ele1 === null) {
|
|
2601
|
+
throw new Error("wrapper elemenet is not defined or not rendered yet");
|
|
2602
|
+
}
|
|
2603
|
+
this.wrapperClass = "_" + (Date.now() + 5e3).toString();
|
|
2604
|
+
(0, import_jquery2.default)(this.ele1).addClass(this.wrapperClass);
|
|
2605
|
+
this.imgFrame = this.ele2;
|
|
2606
|
+
if (this.imgFrame === null) {
|
|
2607
|
+
throw new Error("frame element is not defined or not rendered yet");
|
|
2608
|
+
}
|
|
2609
|
+
this.frameClass = "_" + (Date.now() - 5e3).toString();
|
|
2610
|
+
(0, import_jquery2.default)(this.ele2).addClass(this.frameClass);
|
|
2611
|
+
this.img = this.ele1.querySelector("img");
|
|
2612
|
+
if (this.img === null) {
|
|
2613
|
+
throw new Error("image element is not defined or not rendered yet");
|
|
2614
|
+
}
|
|
2615
|
+
this.ratio = this.img.clientWidth / this.img.clientHeight;
|
|
2616
|
+
this.controllerClassName = "_" + Date.now().toString();
|
|
2617
|
+
this.isRotateOffScreen = false;
|
|
2618
|
+
}
|
|
2619
|
+
_create_class(Transform, [
|
|
2620
|
+
{
|
|
2621
|
+
key: "initialize",
|
|
2622
|
+
value: function initialize() {
|
|
2623
|
+
return _async_to_generator(function() {
|
|
2624
|
+
var transformController;
|
|
2625
|
+
return _ts_generator(this, function(_state) {
|
|
2626
|
+
switch(_state.label){
|
|
2627
|
+
case 0:
|
|
2628
|
+
transformController = new TransformController(this.wrapperClass, this.frameClass, this.controllerClassName);
|
|
2629
|
+
return [
|
|
2630
|
+
4,
|
|
2631
|
+
transformController.addController()
|
|
2632
|
+
];
|
|
2633
|
+
case 1:
|
|
2634
|
+
_state.sent();
|
|
2635
|
+
this.controllerContainer = document.querySelector("." + this.controllerClassName + "--container");
|
|
2636
|
+
this.controller = document.querySelector("." + this.controllerClassName);
|
|
2637
|
+
this.handleElementGoOffScreen("." + this.controllerClassName + " .rotate", "." + this.controllerClassName + " .rotate.shadow", "rotate").handleElementGoOffScreen("." + this.controllerClassName + " .delete", "." + this.controllerClassName + " .delete.shadow", "delete").transform();
|
|
2638
|
+
return [
|
|
2639
|
+
2
|
|
2640
|
+
];
|
|
2641
|
+
}
|
|
2642
|
+
});
|
|
2643
|
+
}).call(this);
|
|
2644
|
+
}
|
|
2645
|
+
},
|
|
2646
|
+
{
|
|
2647
|
+
key: "reset",
|
|
2648
|
+
value: function reset() {
|
|
2649
|
+
this.setState({
|
|
2650
|
+
x: 0,
|
|
2651
|
+
y: this.imgFrame.clientHeight / 2 - this.img.height / 2,
|
|
2652
|
+
angle: 0,
|
|
2653
|
+
w: this.imgFrame.clientWidth
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
},
|
|
2657
|
+
{
|
|
2658
|
+
key: "setState",
|
|
2659
|
+
value: function setState(param) {
|
|
2660
|
+
var x = param.x, y = param.y, angle = param.angle, w = param.w;
|
|
2661
|
+
this.repositionElement(x + this.imgFrame.clientWidth / 2, y + this.img.height / 2);
|
|
2662
|
+
this.rotateBox(angle);
|
|
2663
|
+
this.resize(w, w / this.ratio);
|
|
2664
|
+
this.setValue(x, y, angle, w, w / this.ratio);
|
|
2665
|
+
}
|
|
2666
|
+
},
|
|
2667
|
+
{
|
|
2668
|
+
key: "setValue",
|
|
2669
|
+
value: function setValue(x, y, angle, w, h) {
|
|
2670
|
+
this.x = x !== void 0 ? x : this.x;
|
|
2671
|
+
this.y = y !== void 0 ? y : this.y;
|
|
2672
|
+
this.angle = angle !== void 0 ? angle : this.angle;
|
|
2673
|
+
this.w = w !== void 0 ? w : this.w;
|
|
2674
|
+
this.h = h !== void 0 ? h : this.h;
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
{
|
|
2678
|
+
key: "exportData",
|
|
2679
|
+
value: function exportData() {
|
|
2680
|
+
return {
|
|
2681
|
+
x: this.x,
|
|
2682
|
+
y: this.y,
|
|
2683
|
+
angle: this.angle,
|
|
2684
|
+
w: this.w,
|
|
2685
|
+
h: this.h
|
|
2686
|
+
};
|
|
2687
|
+
}
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
key: "repositionElement",
|
|
2691
|
+
value: function repositionElement(x, y) {
|
|
2692
|
+
var controllerWrapper = this.controllerContainer;
|
|
2693
|
+
var boxWrapper = this.ele1;
|
|
2694
|
+
boxWrapper.style.left = x + "px";
|
|
2695
|
+
boxWrapper.style.top = y + "px";
|
|
2696
|
+
controllerWrapper.style.left = x + this.imgFrame.offsetLeft + 3 + "px";
|
|
2697
|
+
controllerWrapper.style.top = y + this.imgFrame.offsetTop + 3 + "px";
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
key: "resize",
|
|
2702
|
+
value: function resize(w, h) {
|
|
2703
|
+
var controller = this.controller;
|
|
2704
|
+
var img = this.img;
|
|
2705
|
+
var wrapper = this.ele1;
|
|
2706
|
+
controller.style.width = w + "px";
|
|
2707
|
+
controller.style.height = h + "px";
|
|
2708
|
+
img.style.width = w + "px";
|
|
2709
|
+
wrapper.style.width = w + "px";
|
|
2710
|
+
}
|
|
2711
|
+
},
|
|
2712
|
+
{
|
|
2713
|
+
key: "rotateBox",
|
|
2714
|
+
value: function rotateBox(deg) {
|
|
2715
|
+
var controllerWrapper = this.controllerContainer;
|
|
2716
|
+
var boxWrapper = this.ele1;
|
|
2717
|
+
boxWrapper.style.transform = "rotate(".concat(deg, "deg)");
|
|
2718
|
+
controllerWrapper.style.rotate = "".concat(deg, "deg");
|
|
2719
|
+
}
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
key: "handleElementGoOffScreen",
|
|
2723
|
+
value: function handleElementGoOffScreen(main, shadow, type) {
|
|
2724
|
+
var _this = this;
|
|
2725
|
+
var mainEle = document.querySelector(main);
|
|
2726
|
+
var shadowEle = document.querySelector(shadow);
|
|
2727
|
+
var options = {
|
|
2728
|
+
root: null,
|
|
2729
|
+
rootMargin: "0px",
|
|
2730
|
+
threshold: 0.1
|
|
2731
|
+
};
|
|
2732
|
+
var callback = function(entries) {
|
|
2733
|
+
entries.forEach(function(entry) {
|
|
2734
|
+
switch(type){
|
|
2735
|
+
case "rotate":
|
|
2736
|
+
if (!entry.isIntersecting) {
|
|
2737
|
+
mainEle.style.top = "auto";
|
|
2738
|
+
mainEle.style.bottom = "-50px";
|
|
2739
|
+
_this.isRotateOffScreen = true;
|
|
2740
|
+
} else {
|
|
2741
|
+
mainEle.style.bottom = "auto";
|
|
2742
|
+
mainEle.style.top = "-50px";
|
|
2743
|
+
_this.isRotateOffScreen = false;
|
|
2744
|
+
}
|
|
2745
|
+
break;
|
|
2746
|
+
case "delete":
|
|
2747
|
+
if (!entry.isIntersecting) {
|
|
2748
|
+
mainEle.style.bottom = "auto";
|
|
2749
|
+
mainEle.style.top = "-50px";
|
|
2750
|
+
} else {
|
|
2751
|
+
mainEle.style.top = "auto";
|
|
2752
|
+
mainEle.style.bottom = "-50px";
|
|
2753
|
+
}
|
|
2754
|
+
break;
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
};
|
|
2758
|
+
var observer = new IntersectionObserver(callback, options);
|
|
2759
|
+
observer.observe(shadowEle);
|
|
2760
|
+
return this;
|
|
2761
|
+
}
|
|
2762
|
+
},
|
|
2763
|
+
{
|
|
2764
|
+
key: "transform",
|
|
2765
|
+
value: function transform() {
|
|
2766
|
+
var _this = this;
|
|
2767
|
+
var _this1 = this;
|
|
2768
|
+
var controllerWrapper = this.controllerContainer;
|
|
2769
|
+
var boxWrapper = this.ele1;
|
|
2770
|
+
var minWidth = 40;
|
|
2771
|
+
var minHeight = 40;
|
|
2772
|
+
var initX, initY, mousePressX, mousePressY, initW, initH, initRotate;
|
|
2773
|
+
function getCurrentRotation(el) {
|
|
2774
|
+
var st = window.getComputedStyle(el, null);
|
|
2775
|
+
var tm = st.getPropertyValue("-webkit-transform") || st.getPropertyValue("-moz-transform") || st.getPropertyValue("-ms-transform") || st.getPropertyValue("-o-transform") || st.getPropertyValue("transform");
|
|
2776
|
+
"none";
|
|
2777
|
+
if (tm != "none") {
|
|
2778
|
+
var values = tm.split("(")[1].split(")")[0].split(",");
|
|
2779
|
+
var angle = Math.round(Math.atan2(Number(values[1]), Number(values[0])) * (180 / Math.PI));
|
|
2780
|
+
return angle < 0 ? angle + 360 : angle;
|
|
2781
|
+
}
|
|
2782
|
+
return 0;
|
|
2783
|
+
}
|
|
2784
|
+
function mousedownCb(event) {
|
|
2785
|
+
event.target.classList.add("show");
|
|
2786
|
+
event.target.querySelector(".circle").classList.add("show");
|
|
2787
|
+
}
|
|
2788
|
+
function mouseupCb(event) {
|
|
2789
|
+
event.target.classList.remove("show");
|
|
2790
|
+
event.target.querySelector(".circle").classList.remove("show");
|
|
2791
|
+
}
|
|
2792
|
+
var handleDrag = function(event, type) {
|
|
2793
|
+
event.stopPropagation();
|
|
2794
|
+
var initX2 = boxWrapper.offsetLeft;
|
|
2795
|
+
var initY2 = boxWrapper.offsetTop;
|
|
2796
|
+
var mousePressX2 = type === "desk" ? event.clientX : event.touches[0].clientX;
|
|
2797
|
+
var mousePressY2 = type === "desk" ? event.clientY : event.touches[0].clientY;
|
|
2798
|
+
var _this_exportData = _this.exportData(), w = _this_exportData.w, h = _this_exportData.h;
|
|
2799
|
+
var eventMoveHandler = function(event2) {
|
|
2800
|
+
var x = type === "desk" ? event2.clientX : event2.touches[0].clientX;
|
|
2801
|
+
var y = type === "desk" ? event2.clientY : event2.touches[0].clientY;
|
|
2802
|
+
var posX = initX2 + (x - mousePressX2);
|
|
2803
|
+
var posY = initY2 + (y - mousePressY2);
|
|
2804
|
+
_this.repositionElement(posX, posY);
|
|
2805
|
+
_this.setValue(posX - w / 2, posY - h / 2, void 0, void 0, void 0);
|
|
2806
|
+
};
|
|
2807
|
+
if (type === "desk") {
|
|
2808
|
+
controllerWrapper.addEventListener("mousemove", eventMoveHandler, false);
|
|
2809
|
+
window.addEventListener("mouseup", function eventEndHandler() {
|
|
2810
|
+
controllerWrapper.removeEventListener("mousemove", eventMoveHandler, false);
|
|
2811
|
+
window.removeEventListener("mouseup", eventEndHandler);
|
|
2812
|
+
}, false);
|
|
2813
|
+
} else {
|
|
2814
|
+
controllerWrapper.addEventListener("touchmove", eventMoveHandler, {
|
|
2815
|
+
passive: true
|
|
2816
|
+
});
|
|
2817
|
+
window.addEventListener("touchend", function eventEndHandler() {
|
|
2818
|
+
controllerWrapper.removeEventListener("touchmove", eventMoveHandler);
|
|
2819
|
+
window.removeEventListener("touchend", eventEndHandler);
|
|
2820
|
+
}, false);
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
controllerWrapper.addEventListener("mousedown", function(e) {
|
|
2824
|
+
return handleDrag(e, "desk");
|
|
2825
|
+
}, false);
|
|
2826
|
+
controllerWrapper.addEventListener("touchstart", function(e) {
|
|
2827
|
+
return handleDrag(e, "touch");
|
|
2828
|
+
}, {
|
|
2829
|
+
passive: true
|
|
2830
|
+
});
|
|
2831
|
+
var leftTop = document.querySelector("." + this.controllerClassName + " .resize-topleft");
|
|
2832
|
+
var rightTop = document.querySelector("." + this.controllerClassName + " .resize-topright");
|
|
2833
|
+
var rightBottom = document.querySelector("." + this.controllerClassName + " .resize-bottomright");
|
|
2834
|
+
var leftBottom = document.querySelector("." + this.controllerClassName + " .resize-bottomleft");
|
|
2835
|
+
var resizeHandler = function(event) {
|
|
2836
|
+
var left = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, top = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, xResize = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, yResize = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, type = arguments.length > 5 ? arguments[5] : void 0;
|
|
2837
|
+
event.stopPropagation();
|
|
2838
|
+
initX = boxWrapper.offsetLeft;
|
|
2839
|
+
initY = boxWrapper.offsetTop;
|
|
2840
|
+
mousePressX = type === "desk" ? event.clientX : event.touches[0].clientX;
|
|
2841
|
+
mousePressY = type === "desk" ? event.clientY : event.touches[0].clientY;
|
|
2842
|
+
initW = _this1.img.offsetWidth;
|
|
2843
|
+
initH = _this1.img.offsetHeight;
|
|
2844
|
+
initRotate = getCurrentRotation(boxWrapper);
|
|
2845
|
+
var initRadians = initRotate * Math.PI / 180;
|
|
2846
|
+
var cosFraction = Math.cos(initRadians);
|
|
2847
|
+
var sinFraction = Math.sin(initRadians);
|
|
2848
|
+
mousedownCb(event);
|
|
2849
|
+
var vectorC = [
|
|
2850
|
+
mousePressX - initX - _this1.imgFrame.offsetLeft,
|
|
2851
|
+
mousePressY - initY - _this1.imgFrame.offsetTop
|
|
2852
|
+
];
|
|
2853
|
+
var eventMoveHandler = function(event2) {
|
|
2854
|
+
var x = type === "desk" ? event2.clientX : event2.touches[0].clientX;
|
|
2855
|
+
var y = type === "desk" ? event2.clientY : event2.touches[0].clientY;
|
|
2856
|
+
var wDiff = x - mousePressX;
|
|
2857
|
+
var hDiff = y - mousePressY;
|
|
2858
|
+
var vectorD = [
|
|
2859
|
+
wDiff,
|
|
2860
|
+
hDiff
|
|
2861
|
+
];
|
|
2862
|
+
var c = (vectorC[0] * vectorD[0] + vectorC[1] * vectorD[1]) / (vectorC[0] * vectorC[0] + vectorC[1] * vectorC[1]);
|
|
2863
|
+
var vectorH = [
|
|
2864
|
+
c * vectorC[0],
|
|
2865
|
+
c * vectorC[1]
|
|
2866
|
+
];
|
|
2867
|
+
var rotatedWDiff = cosFraction * vectorH[0] + sinFraction * vectorH[1];
|
|
2868
|
+
var rotatedHDiff = cosFraction * vectorH[1] - sinFraction * vectorH[0];
|
|
2869
|
+
rotatedHDiff = rotatedHDiff * rotatedWDiff > 0 ? rotatedWDiff / _this1.ratio : -rotatedWDiff / _this1.ratio;
|
|
2870
|
+
var newW = initW, newH = initH, newX = initX, newY = initY;
|
|
2871
|
+
if (xResize) {
|
|
2872
|
+
if (left) {
|
|
2873
|
+
newW = initW - rotatedWDiff;
|
|
2874
|
+
if (newW < minWidth) {
|
|
2875
|
+
newW = minWidth;
|
|
2876
|
+
rotatedWDiff = initW - minWidth;
|
|
2877
|
+
}
|
|
2878
|
+
} else {
|
|
2879
|
+
newW = initW + rotatedWDiff;
|
|
2880
|
+
if (newW < minWidth) {
|
|
2881
|
+
newW = minWidth;
|
|
2882
|
+
rotatedWDiff = minWidth - initW;
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
newX += 0.5 * rotatedWDiff * cosFraction;
|
|
2886
|
+
newY += 0.5 * rotatedWDiff * sinFraction;
|
|
2887
|
+
}
|
|
2888
|
+
if (yResize) {
|
|
2889
|
+
if (top) {
|
|
2890
|
+
newH = initH - rotatedHDiff;
|
|
2891
|
+
if (newH < minHeight) {
|
|
2892
|
+
newH = minHeight;
|
|
2893
|
+
rotatedHDiff = initH - minHeight;
|
|
2894
|
+
}
|
|
2895
|
+
} else {
|
|
2896
|
+
newH = initH + rotatedHDiff;
|
|
2897
|
+
if (newH < minHeight) {
|
|
2898
|
+
newH = minHeight;
|
|
2899
|
+
rotatedHDiff = minHeight - initH;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
newX -= 0.5 * rotatedHDiff * sinFraction;
|
|
2903
|
+
newY += 0.5 * rotatedHDiff * cosFraction;
|
|
2904
|
+
}
|
|
2905
|
+
_this1.resize(newW, newH);
|
|
2906
|
+
_this1.repositionElement(newX, newY);
|
|
2907
|
+
_this1.setValue(newX - newW / 2, newY - newH / 2, void 0, newW, newH);
|
|
2908
|
+
};
|
|
2909
|
+
if (type === "desk") {
|
|
2910
|
+
window.addEventListener("mousemove", eventMoveHandler, false);
|
|
2911
|
+
window.addEventListener("mouseup", function eventEndHandler() {
|
|
2912
|
+
mouseupCb(event);
|
|
2913
|
+
window.removeEventListener("mousemove", eventMoveHandler, false);
|
|
2914
|
+
window.removeEventListener("mouseup", eventEndHandler);
|
|
2915
|
+
}, false);
|
|
2916
|
+
} else {
|
|
2917
|
+
window.addEventListener("touchmove", eventMoveHandler, {
|
|
2918
|
+
passive: true
|
|
2919
|
+
});
|
|
2920
|
+
window.addEventListener("touchend", function eventEndHandler() {
|
|
2921
|
+
mouseupCb(event);
|
|
2922
|
+
window.removeEventListener("touchmove", eventMoveHandler, false);
|
|
2923
|
+
window.removeEventListener("touchend", eventEndHandler);
|
|
2924
|
+
}, false);
|
|
2925
|
+
}
|
|
2926
|
+
};
|
|
2927
|
+
leftTop.addEventListener("mousedown", function(e) {
|
|
2928
|
+
return resizeHandler(e, true, true, true, true, "desk");
|
|
2929
|
+
});
|
|
2930
|
+
rightTop.addEventListener("mousedown", function(e) {
|
|
2931
|
+
return resizeHandler(e, false, true, true, true, "desk");
|
|
2932
|
+
});
|
|
2933
|
+
rightBottom.addEventListener("mousedown", function(e) {
|
|
2934
|
+
return resizeHandler(e, false, false, true, true, "desk");
|
|
2935
|
+
});
|
|
2936
|
+
leftBottom.addEventListener("mousedown", function(e) {
|
|
2937
|
+
return resizeHandler(e, true, false, true, true, "desk");
|
|
2938
|
+
});
|
|
2939
|
+
leftTop.addEventListener("touchstart", function(e) {
|
|
2940
|
+
return resizeHandler(e, true, true, true, true, "touch");
|
|
2941
|
+
}, {
|
|
2942
|
+
passive: true
|
|
2943
|
+
});
|
|
2944
|
+
rightTop.addEventListener("touchstart", function(e) {
|
|
2945
|
+
return resizeHandler(e, false, true, true, true, "touch");
|
|
2946
|
+
}, {
|
|
2947
|
+
passive: true
|
|
2948
|
+
});
|
|
2949
|
+
rightBottom.addEventListener("touchstart", function(e) {
|
|
2950
|
+
return resizeHandler(e, false, false, true, true, "touch");
|
|
2951
|
+
}, {
|
|
2952
|
+
passive: true
|
|
2953
|
+
});
|
|
2954
|
+
leftBottom.addEventListener("touchstart", function(e) {
|
|
2955
|
+
return resizeHandler(e, true, false, true, true, "touch");
|
|
2956
|
+
}, {
|
|
2957
|
+
passive: true
|
|
2958
|
+
});
|
|
2959
|
+
var rotate = document.querySelector("." + this.controllerClassName + " .rotate");
|
|
2960
|
+
var handleRotate = function(event, type) {
|
|
2961
|
+
event.stopPropagation();
|
|
2962
|
+
initX = event.target.offsetLeft;
|
|
2963
|
+
initY = event.target.offsetTop;
|
|
2964
|
+
mousePressX = type === "desk" ? event.clientX : event.touches[0].clientX;
|
|
2965
|
+
mousePressY = type === "desk" ? event.clientY : event.touches[0].clientY;
|
|
2966
|
+
var arrow = _this.controller;
|
|
2967
|
+
var arrowRects = arrow.getBoundingClientRect();
|
|
2968
|
+
var arrowX = arrowRects.left + arrowRects.width / 2;
|
|
2969
|
+
var arrowY = arrowRects.top + arrowRects.height / 2;
|
|
2970
|
+
var compensation = _this.isRotateOffScreen ? 180 : 0;
|
|
2971
|
+
var eventMoveHandler = function(event2) {
|
|
2972
|
+
var x = type === "desk" ? event2.clientX : event2.touches[0].clientX;
|
|
2973
|
+
var y = type === "desk" ? event2.clientY : event2.touches[0].clientY;
|
|
2974
|
+
var angle = Math.atan2(y - arrowY, x - arrowX) + Math.PI / 2;
|
|
2975
|
+
angle *= 180 / Math.PI;
|
|
2976
|
+
angle += compensation;
|
|
2977
|
+
_this.rotateBox(angle);
|
|
2978
|
+
_this.setValue(void 0, void 0, angle, void 0, void 0);
|
|
2979
|
+
};
|
|
2980
|
+
if (type === "desk") {
|
|
2981
|
+
window.addEventListener("mousemove", eventMoveHandler, false);
|
|
2982
|
+
window.addEventListener("mouseup", function eventEndHandler() {
|
|
2983
|
+
window.removeEventListener("mousemove", eventMoveHandler, false);
|
|
2984
|
+
window.removeEventListener("mouseup", eventEndHandler);
|
|
2985
|
+
}, false);
|
|
2986
|
+
} else {
|
|
2987
|
+
window.addEventListener("touchmove", eventMoveHandler, {
|
|
2988
|
+
passive: true
|
|
2989
|
+
});
|
|
2990
|
+
window.addEventListener("touchend", function eventEndHandler() {
|
|
2991
|
+
window.removeEventListener("touchmove", eventMoveHandler, false);
|
|
2992
|
+
window.removeEventListener("touchend", eventEndHandler);
|
|
2993
|
+
}, false);
|
|
2994
|
+
}
|
|
2995
|
+
};
|
|
2996
|
+
rotate.addEventListener("mousedown", function(e) {
|
|
2997
|
+
return handleRotate(e, "desk");
|
|
2998
|
+
}, false);
|
|
2999
|
+
rotate.addEventListener("touchstart", function(e) {
|
|
3000
|
+
return handleRotate(e, "touch");
|
|
3001
|
+
}, {
|
|
3002
|
+
passive: true
|
|
3003
|
+
});
|
|
3004
|
+
this.reset();
|
|
3005
|
+
return this;
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
]);
|
|
3009
|
+
return Transform;
|
|
3010
|
+
}();
|
|
1540
3011
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1541
3012
|
0 && (module.exports = {
|
|
3013
|
+
Avatar: Avatar,
|
|
1542
3014
|
Button: Button,
|
|
3015
|
+
Canvas: Canvas,
|
|
1543
3016
|
ColorPickerSlider: ColorPickerSlider,
|
|
1544
3017
|
DropdownSelect: DropdownSelect,
|
|
3018
|
+
Image: Image,
|
|
3019
|
+
ImageEditor: ImageEditor,
|
|
3020
|
+
ImageUtilities: ImageUtilities,
|
|
3021
|
+
InputFile: InputFile,
|
|
3022
|
+
InputGoogle: InputGoogle,
|
|
1545
3023
|
MultiSelect: MultiSelect,
|
|
1546
3024
|
OptionSlider: OptionSlider,
|
|
1547
|
-
RangeSlider: RangeSlider
|
|
3025
|
+
RangeSlider: RangeSlider,
|
|
3026
|
+
TextArea: TextArea,
|
|
3027
|
+
Transform: Transform,
|
|
3028
|
+
UploadImage: UploadImage
|
|
1548
3029
|
});
|