labellife-design-tool 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/canvas/workspace.js +321 -92
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +394 -65
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js +20 -0
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +538 -31
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +265 -36
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +395 -67
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js +20 -0
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +540 -33
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useCallback, memo, useRef, useEffect } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react-lite';
|
|
3
|
-
import {
|
|
3
|
+
import { Box, Typography, IconButton, Switch, TextField, Slider, Autocomplete, Divider, Tooltip, ToggleButtonGroup, ToggleButton, Button, Menu, MenuItem, ListItemIcon, ListItemText, Popover, Select, CircularProgress } from '@mui/material';
|
|
4
4
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
5
5
|
import FileUploadIcon from '@mui/icons-material/FileUpload';
|
|
6
6
|
import UndoIcon from '@mui/icons-material/Undo';
|
|
@@ -32,7 +32,9 @@ import '@mui/icons-material/AlignVerticalCenter';
|
|
|
32
32
|
import '@mui/icons-material/AlignVerticalBottom';
|
|
33
33
|
import VerticalAlignTopIcon from '@mui/icons-material/VerticalAlignTop';
|
|
34
34
|
import VerticalAlignBottomIcon from '@mui/icons-material/VerticalAlignBottom';
|
|
35
|
-
import
|
|
35
|
+
import GestureIcon from '@mui/icons-material/Gesture';
|
|
36
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
37
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
36
38
|
|
|
37
39
|
function _arrayLikeToArray(r, a) {
|
|
38
40
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -392,6 +394,433 @@ if (typeof window !== 'undefined' && !window[INPUT_FIELDS_CONFIG_KEY]) {
|
|
|
392
394
|
window[INPUT_FIELDS_CONFIG_KEY] = {};
|
|
393
395
|
}
|
|
394
396
|
|
|
397
|
+
var SliderRow = function SliderRow(_ref) {
|
|
398
|
+
var label = _ref.label,
|
|
399
|
+
value = _ref.value,
|
|
400
|
+
_onChange = _ref.onChange,
|
|
401
|
+
_ref$min = _ref.min,
|
|
402
|
+
min = _ref$min === void 0 ? 0 : _ref$min,
|
|
403
|
+
_ref$max = _ref.max,
|
|
404
|
+
max = _ref$max === void 0 ? 100 : _ref$max,
|
|
405
|
+
_ref$step = _ref.step,
|
|
406
|
+
step = _ref$step === void 0 ? 1 : _ref$step;
|
|
407
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
408
|
+
sx: {
|
|
409
|
+
mb: 1
|
|
410
|
+
},
|
|
411
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
412
|
+
variant: "caption",
|
|
413
|
+
sx: {
|
|
414
|
+
color: '#888',
|
|
415
|
+
display: 'block',
|
|
416
|
+
mb: 0.5
|
|
417
|
+
},
|
|
418
|
+
children: label
|
|
419
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
420
|
+
sx: {
|
|
421
|
+
display: 'flex',
|
|
422
|
+
alignItems: 'center',
|
|
423
|
+
gap: 1
|
|
424
|
+
},
|
|
425
|
+
children: [/*#__PURE__*/jsx(Slider, {
|
|
426
|
+
size: "small",
|
|
427
|
+
value: value,
|
|
428
|
+
onChange: function onChange(_, v) {
|
|
429
|
+
return _onChange(v);
|
|
430
|
+
},
|
|
431
|
+
min: min,
|
|
432
|
+
max: max,
|
|
433
|
+
step: step,
|
|
434
|
+
sx: {
|
|
435
|
+
flex: 1
|
|
436
|
+
}
|
|
437
|
+
}), /*#__PURE__*/jsx(TextField, {
|
|
438
|
+
size: "small",
|
|
439
|
+
type: "number",
|
|
440
|
+
value: typeof value === 'number' ? Math.round(value * 10) / 10 : value,
|
|
441
|
+
onChange: function onChange(e) {
|
|
442
|
+
var v = parseFloat(e.target.value);
|
|
443
|
+
if (!isNaN(v)) _onChange(v);
|
|
444
|
+
},
|
|
445
|
+
onFocus: function onFocus(e) {
|
|
446
|
+
return e.target.select();
|
|
447
|
+
},
|
|
448
|
+
sx: {
|
|
449
|
+
width: 65,
|
|
450
|
+
'& .MuiInputBase-input': {
|
|
451
|
+
fontSize: 12,
|
|
452
|
+
py: 0.5,
|
|
453
|
+
textAlign: 'center'
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
inputProps: {
|
|
457
|
+
min: min,
|
|
458
|
+
max: max,
|
|
459
|
+
step: step
|
|
460
|
+
}
|
|
461
|
+
})]
|
|
462
|
+
})]
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
var TextEffectsPanel = observer(function (_ref2) {
|
|
466
|
+
var store = _ref2.store;
|
|
467
|
+
var panel = store._toolbarPanel;
|
|
468
|
+
if (!panel || panel.type !== 'effects') return null;
|
|
469
|
+
var element = store.getElementById(panel.elementId);
|
|
470
|
+
if (!element || element.type !== 'text') return null;
|
|
471
|
+
var handleClose = function handleClose() {
|
|
472
|
+
return store.closeToolbarPanel();
|
|
473
|
+
};
|
|
474
|
+
var commit = function commit() {
|
|
475
|
+
return store.history.addUndoState();
|
|
476
|
+
};
|
|
477
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
478
|
+
sx: {
|
|
479
|
+
width: 280,
|
|
480
|
+
height: '100%',
|
|
481
|
+
overflowY: 'auto',
|
|
482
|
+
overflowX: 'hidden',
|
|
483
|
+
backgroundColor: '#fff',
|
|
484
|
+
borderRight: '1px solid #e0e0e0',
|
|
485
|
+
flexShrink: 0,
|
|
486
|
+
p: 2
|
|
487
|
+
},
|
|
488
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
489
|
+
sx: {
|
|
490
|
+
display: 'flex',
|
|
491
|
+
alignItems: 'center',
|
|
492
|
+
justifyContent: 'space-between',
|
|
493
|
+
mb: 2
|
|
494
|
+
},
|
|
495
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
496
|
+
variant: "subtitle1",
|
|
497
|
+
sx: {
|
|
498
|
+
fontWeight: 600
|
|
499
|
+
},
|
|
500
|
+
children: t('toolbar.textEffects', 'Text Effects')
|
|
501
|
+
}), /*#__PURE__*/jsx(IconButton, {
|
|
502
|
+
size: "small",
|
|
503
|
+
onClick: handleClose,
|
|
504
|
+
children: /*#__PURE__*/jsx(CloseIcon, {
|
|
505
|
+
fontSize: "small"
|
|
506
|
+
})
|
|
507
|
+
})]
|
|
508
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
509
|
+
sx: {
|
|
510
|
+
mb: 2
|
|
511
|
+
},
|
|
512
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
513
|
+
sx: {
|
|
514
|
+
display: 'flex',
|
|
515
|
+
alignItems: 'center',
|
|
516
|
+
justifyContent: 'space-between',
|
|
517
|
+
mb: 0.5
|
|
518
|
+
},
|
|
519
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
520
|
+
variant: "body2",
|
|
521
|
+
sx: {
|
|
522
|
+
fontWeight: 500
|
|
523
|
+
},
|
|
524
|
+
children: t('toolbar.blur', 'Blur')
|
|
525
|
+
}), /*#__PURE__*/jsx(Switch, {
|
|
526
|
+
size: "small",
|
|
527
|
+
checked: element.blurEnabled,
|
|
528
|
+
onChange: function onChange(e) {
|
|
529
|
+
element.set({
|
|
530
|
+
blurEnabled: e.target.checked
|
|
531
|
+
});
|
|
532
|
+
commit();
|
|
533
|
+
}
|
|
534
|
+
})]
|
|
535
|
+
}), element.blurEnabled && /*#__PURE__*/jsx(SliderRow, {
|
|
536
|
+
label: t('toolbar.blur', 'Blur'),
|
|
537
|
+
value: element.blurRadius,
|
|
538
|
+
onChange: function onChange(v) {
|
|
539
|
+
return element.set({
|
|
540
|
+
blurRadius: v
|
|
541
|
+
});
|
|
542
|
+
},
|
|
543
|
+
min: 0,
|
|
544
|
+
max: 40
|
|
545
|
+
})]
|
|
546
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
547
|
+
sx: {
|
|
548
|
+
mb: 2
|
|
549
|
+
},
|
|
550
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
551
|
+
sx: {
|
|
552
|
+
display: 'flex',
|
|
553
|
+
alignItems: 'center',
|
|
554
|
+
justifyContent: 'space-between',
|
|
555
|
+
mb: 0.5
|
|
556
|
+
},
|
|
557
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
558
|
+
variant: "body2",
|
|
559
|
+
sx: {
|
|
560
|
+
fontWeight: 500
|
|
561
|
+
},
|
|
562
|
+
children: t('toolbar.textStroke', 'Text Stroke')
|
|
563
|
+
}), /*#__PURE__*/jsx(Switch, {
|
|
564
|
+
size: "small",
|
|
565
|
+
checked: element.strokeWidth > 0,
|
|
566
|
+
onChange: function onChange(e) {
|
|
567
|
+
element.set({
|
|
568
|
+
strokeWidth: e.target.checked ? 2 : 0,
|
|
569
|
+
stroke: element.stroke || '#000000'
|
|
570
|
+
});
|
|
571
|
+
commit();
|
|
572
|
+
}
|
|
573
|
+
})]
|
|
574
|
+
}), element.strokeWidth > 0 && /*#__PURE__*/jsxs(Box, {
|
|
575
|
+
sx: {
|
|
576
|
+
display: 'flex',
|
|
577
|
+
alignItems: 'center',
|
|
578
|
+
gap: 1
|
|
579
|
+
},
|
|
580
|
+
children: [/*#__PURE__*/jsx("input", {
|
|
581
|
+
type: "color",
|
|
582
|
+
value: element.stroke || '#000000',
|
|
583
|
+
onChange: function onChange(e) {
|
|
584
|
+
element.set({
|
|
585
|
+
stroke: e.target.value
|
|
586
|
+
});
|
|
587
|
+
commit();
|
|
588
|
+
},
|
|
589
|
+
style: {
|
|
590
|
+
width: 32,
|
|
591
|
+
height: 32,
|
|
592
|
+
border: '1px solid #ccc',
|
|
593
|
+
borderRadius: 4,
|
|
594
|
+
cursor: 'pointer',
|
|
595
|
+
padding: 0
|
|
596
|
+
}
|
|
597
|
+
}), /*#__PURE__*/jsx(TextField, {
|
|
598
|
+
size: "small",
|
|
599
|
+
type: "number",
|
|
600
|
+
value: element.strokeWidth,
|
|
601
|
+
onChange: function onChange(e) {
|
|
602
|
+
var v = parseFloat(e.target.value);
|
|
603
|
+
if (!isNaN(v) && v >= 0) {
|
|
604
|
+
element.set({
|
|
605
|
+
strokeWidth: v
|
|
606
|
+
});
|
|
607
|
+
commit();
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
onFocus: function onFocus(e) {
|
|
611
|
+
return e.target.select();
|
|
612
|
+
},
|
|
613
|
+
sx: {
|
|
614
|
+
width: 65,
|
|
615
|
+
'& .MuiInputBase-input': {
|
|
616
|
+
fontSize: 12,
|
|
617
|
+
py: 0.5,
|
|
618
|
+
textAlign: 'center'
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
inputProps: {
|
|
622
|
+
min: 0,
|
|
623
|
+
max: 20,
|
|
624
|
+
step: 0.5
|
|
625
|
+
}
|
|
626
|
+
})]
|
|
627
|
+
})]
|
|
628
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
629
|
+
sx: {
|
|
630
|
+
mb: 2
|
|
631
|
+
},
|
|
632
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
633
|
+
sx: {
|
|
634
|
+
display: 'flex',
|
|
635
|
+
alignItems: 'center',
|
|
636
|
+
justifyContent: 'space-between',
|
|
637
|
+
mb: 0.5
|
|
638
|
+
},
|
|
639
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
640
|
+
variant: "body2",
|
|
641
|
+
sx: {
|
|
642
|
+
fontWeight: 500
|
|
643
|
+
},
|
|
644
|
+
children: t('toolbar.background', 'Background')
|
|
645
|
+
}), /*#__PURE__*/jsx(Switch, {
|
|
646
|
+
size: "small",
|
|
647
|
+
checked: element.backgroundEnabled,
|
|
648
|
+
onChange: function onChange(e) {
|
|
649
|
+
element.set({
|
|
650
|
+
backgroundEnabled: e.target.checked
|
|
651
|
+
});
|
|
652
|
+
commit();
|
|
653
|
+
}
|
|
654
|
+
})]
|
|
655
|
+
}), element.backgroundEnabled && /*#__PURE__*/jsxs(Fragment, {
|
|
656
|
+
children: [/*#__PURE__*/jsx(SliderRow, {
|
|
657
|
+
label: t('toolbar.cornerRadius', 'Corner radius'),
|
|
658
|
+
value: element.backgroundCornerRadius,
|
|
659
|
+
onChange: function onChange(v) {
|
|
660
|
+
return element.set({
|
|
661
|
+
backgroundCornerRadius: v
|
|
662
|
+
});
|
|
663
|
+
},
|
|
664
|
+
min: 0,
|
|
665
|
+
max: 50,
|
|
666
|
+
step: 0.5
|
|
667
|
+
}), /*#__PURE__*/jsx(SliderRow, {
|
|
668
|
+
label: t('toolbar.padding', 'Padding'),
|
|
669
|
+
value: element.backgroundPadding,
|
|
670
|
+
onChange: function onChange(v) {
|
|
671
|
+
return element.set({
|
|
672
|
+
backgroundPadding: v
|
|
673
|
+
});
|
|
674
|
+
},
|
|
675
|
+
min: 0,
|
|
676
|
+
max: 100
|
|
677
|
+
}), /*#__PURE__*/jsx(SliderRow, {
|
|
678
|
+
label: t('toolbar.opacity', 'Opacity'),
|
|
679
|
+
value: Math.round(element.backgroundOpacity * 100),
|
|
680
|
+
onChange: function onChange(v) {
|
|
681
|
+
return element.set({
|
|
682
|
+
backgroundOpacity: v / 100
|
|
683
|
+
});
|
|
684
|
+
},
|
|
685
|
+
min: 0,
|
|
686
|
+
max: 100
|
|
687
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
688
|
+
sx: {
|
|
689
|
+
mt: 1
|
|
690
|
+
},
|
|
691
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
692
|
+
variant: "caption",
|
|
693
|
+
sx: {
|
|
694
|
+
color: '#888',
|
|
695
|
+
display: 'block',
|
|
696
|
+
mb: 0.5
|
|
697
|
+
},
|
|
698
|
+
children: t('toolbar.color', 'Color')
|
|
699
|
+
}), /*#__PURE__*/jsx("input", {
|
|
700
|
+
type: "color",
|
|
701
|
+
value: element.backgroundColor || '#ffffff',
|
|
702
|
+
onChange: function onChange(e) {
|
|
703
|
+
element.set({
|
|
704
|
+
backgroundColor: e.target.value
|
|
705
|
+
});
|
|
706
|
+
commit();
|
|
707
|
+
},
|
|
708
|
+
style: {
|
|
709
|
+
width: 32,
|
|
710
|
+
height: 32,
|
|
711
|
+
border: '1px solid #ccc',
|
|
712
|
+
borderRadius: 4,
|
|
713
|
+
cursor: 'pointer',
|
|
714
|
+
padding: 0
|
|
715
|
+
}
|
|
716
|
+
})]
|
|
717
|
+
})]
|
|
718
|
+
})]
|
|
719
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
720
|
+
sx: {
|
|
721
|
+
mb: 2
|
|
722
|
+
},
|
|
723
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
724
|
+
sx: {
|
|
725
|
+
display: 'flex',
|
|
726
|
+
alignItems: 'center',
|
|
727
|
+
justifyContent: 'space-between',
|
|
728
|
+
mb: 0.5
|
|
729
|
+
},
|
|
730
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
731
|
+
variant: "body2",
|
|
732
|
+
sx: {
|
|
733
|
+
fontWeight: 500
|
|
734
|
+
},
|
|
735
|
+
children: t('toolbar.shadow', 'Shadow')
|
|
736
|
+
}), /*#__PURE__*/jsx(Switch, {
|
|
737
|
+
size: "small",
|
|
738
|
+
checked: element.shadowEnabled,
|
|
739
|
+
onChange: function onChange(e) {
|
|
740
|
+
element.set({
|
|
741
|
+
shadowEnabled: e.target.checked
|
|
742
|
+
});
|
|
743
|
+
commit();
|
|
744
|
+
}
|
|
745
|
+
})]
|
|
746
|
+
}), element.shadowEnabled && /*#__PURE__*/jsxs(Fragment, {
|
|
747
|
+
children: [/*#__PURE__*/jsx(SliderRow, {
|
|
748
|
+
label: t('toolbar.blur', 'Blur'),
|
|
749
|
+
value: element.shadowBlur,
|
|
750
|
+
onChange: function onChange(v) {
|
|
751
|
+
return element.set({
|
|
752
|
+
shadowBlur: v
|
|
753
|
+
});
|
|
754
|
+
},
|
|
755
|
+
min: 0,
|
|
756
|
+
max: 50
|
|
757
|
+
}), /*#__PURE__*/jsx(SliderRow, {
|
|
758
|
+
label: t('toolbar.offsetX', 'Offset X'),
|
|
759
|
+
value: element.shadowOffsetX,
|
|
760
|
+
onChange: function onChange(v) {
|
|
761
|
+
return element.set({
|
|
762
|
+
shadowOffsetX: v
|
|
763
|
+
});
|
|
764
|
+
},
|
|
765
|
+
min: -50,
|
|
766
|
+
max: 50
|
|
767
|
+
}), /*#__PURE__*/jsx(SliderRow, {
|
|
768
|
+
label: t('toolbar.offsetY', 'Offset Y'),
|
|
769
|
+
value: element.shadowOffsetY,
|
|
770
|
+
onChange: function onChange(v) {
|
|
771
|
+
return element.set({
|
|
772
|
+
shadowOffsetY: v
|
|
773
|
+
});
|
|
774
|
+
},
|
|
775
|
+
min: -50,
|
|
776
|
+
max: 50
|
|
777
|
+
}), /*#__PURE__*/jsx(SliderRow, {
|
|
778
|
+
label: t('toolbar.opacity', 'Opacity'),
|
|
779
|
+
value: Math.round(element.shadowOpacity * 100),
|
|
780
|
+
onChange: function onChange(v) {
|
|
781
|
+
return element.set({
|
|
782
|
+
shadowOpacity: v / 100
|
|
783
|
+
});
|
|
784
|
+
},
|
|
785
|
+
min: 0,
|
|
786
|
+
max: 100
|
|
787
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
788
|
+
sx: {
|
|
789
|
+
mt: 1
|
|
790
|
+
},
|
|
791
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
792
|
+
variant: "caption",
|
|
793
|
+
sx: {
|
|
794
|
+
color: '#888',
|
|
795
|
+
display: 'block',
|
|
796
|
+
mb: 0.5
|
|
797
|
+
},
|
|
798
|
+
children: t('toolbar.color', 'Color')
|
|
799
|
+
}), /*#__PURE__*/jsx("input", {
|
|
800
|
+
type: "color",
|
|
801
|
+
value: element.shadowColor || '#000000',
|
|
802
|
+
onChange: function onChange(e) {
|
|
803
|
+
element.set({
|
|
804
|
+
shadowColor: e.target.value
|
|
805
|
+
});
|
|
806
|
+
commit();
|
|
807
|
+
},
|
|
808
|
+
style: {
|
|
809
|
+
width: 32,
|
|
810
|
+
height: 32,
|
|
811
|
+
border: '1px solid #ccc',
|
|
812
|
+
borderRadius: 4,
|
|
813
|
+
cursor: 'pointer',
|
|
814
|
+
padding: 0
|
|
815
|
+
}
|
|
816
|
+
})]
|
|
817
|
+
})]
|
|
818
|
+
})]
|
|
819
|
+
})]
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
TextEffectsPanel.displayName = 'TextEffectsPanel';
|
|
823
|
+
|
|
395
824
|
var _excluded = ["fontFamily"];
|
|
396
825
|
var _positionMenuItemSx = {
|
|
397
826
|
textTransform: 'none',
|
|
@@ -1365,10 +1794,85 @@ var PositionButton = observer(function (_ref8) {
|
|
|
1365
1794
|
});
|
|
1366
1795
|
});
|
|
1367
1796
|
|
|
1797
|
+
// Curve (text-only) slider popover — same button/popover pattern as
|
|
1798
|
+
// PositionButton, holding the same control previously in the Text
|
|
1799
|
+
// Effects panel's Curve section. No separate enable toggle: curvePower
|
|
1800
|
+
// itself is the on/off state (0 = straight, matching how the renderer
|
|
1801
|
+
// already treats curvePower === 0 as "no curve").
|
|
1802
|
+
var CurveButton = observer(function (_ref0) {
|
|
1803
|
+
var element = _ref0.element;
|
|
1804
|
+
var _useState5 = useState(null),
|
|
1805
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1806
|
+
anchorEl = _useState6[0],
|
|
1807
|
+
setAnchorEl = _useState6[1];
|
|
1808
|
+
var open = Boolean(anchorEl);
|
|
1809
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
1810
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
1811
|
+
size: "small",
|
|
1812
|
+
onClick: function onClick(e) {
|
|
1813
|
+
return setAnchorEl(e.currentTarget);
|
|
1814
|
+
},
|
|
1815
|
+
startIcon: /*#__PURE__*/jsx(GestureIcon, {
|
|
1816
|
+
sx: {
|
|
1817
|
+
fontSize: '16px !important'
|
|
1818
|
+
}
|
|
1819
|
+
}),
|
|
1820
|
+
sx: _objectSpread2({
|
|
1821
|
+
textTransform: 'none',
|
|
1822
|
+
fontSize: 12,
|
|
1823
|
+
whiteSpace: 'nowrap',
|
|
1824
|
+
px: 1.5,
|
|
1825
|
+
minWidth: 'auto'
|
|
1826
|
+
}, open ? {
|
|
1827
|
+
backgroundColor: '#e3f2fd',
|
|
1828
|
+
color: '#0d83cd'
|
|
1829
|
+
} : {}),
|
|
1830
|
+
children: t('toolbar.curve', 'Curve')
|
|
1831
|
+
}), /*#__PURE__*/jsx(Popover, {
|
|
1832
|
+
open: open,
|
|
1833
|
+
anchorEl: anchorEl,
|
|
1834
|
+
onClose: function onClose() {
|
|
1835
|
+
return setAnchorEl(null);
|
|
1836
|
+
},
|
|
1837
|
+
anchorOrigin: {
|
|
1838
|
+
vertical: 'bottom',
|
|
1839
|
+
horizontal: 'left'
|
|
1840
|
+
},
|
|
1841
|
+
transformOrigin: {
|
|
1842
|
+
vertical: 'top',
|
|
1843
|
+
horizontal: 'left'
|
|
1844
|
+
},
|
|
1845
|
+
slotProps: {
|
|
1846
|
+
paper: {
|
|
1847
|
+
sx: {
|
|
1848
|
+
mt: 0.5,
|
|
1849
|
+
p: 2,
|
|
1850
|
+
width: 260,
|
|
1851
|
+
borderRadius: '10px',
|
|
1852
|
+
boxShadow: '0 4px 20px rgba(0,0,0,0.12)'
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
children: /*#__PURE__*/jsx(SliderRow, {
|
|
1857
|
+
label: t('toolbar.curve', 'Curve'),
|
|
1858
|
+
value: element.curvePower,
|
|
1859
|
+
onChange: function onChange(v) {
|
|
1860
|
+
return element.set({
|
|
1861
|
+
curveEnabled: true,
|
|
1862
|
+
curvePower: v
|
|
1863
|
+
});
|
|
1864
|
+
},
|
|
1865
|
+
min: -500,
|
|
1866
|
+
max: 500
|
|
1867
|
+
})
|
|
1868
|
+
})]
|
|
1869
|
+
});
|
|
1870
|
+
});
|
|
1871
|
+
|
|
1368
1872
|
// Common controls for all element types
|
|
1369
|
-
var CommonControls = observer(function (
|
|
1370
|
-
var element =
|
|
1371
|
-
store =
|
|
1873
|
+
var CommonControls = observer(function (_ref1) {
|
|
1874
|
+
var element = _ref1.element,
|
|
1875
|
+
store = _ref1.store;
|
|
1372
1876
|
var isLocked = element.locked;
|
|
1373
1877
|
var handleDuplicate = function handleDuplicate() {
|
|
1374
1878
|
if (element.clone) {
|
|
@@ -1446,6 +1950,9 @@ var CommonControls = observer(function (_ref0) {
|
|
|
1446
1950
|
}), /*#__PURE__*/jsx(PositionButton, {
|
|
1447
1951
|
element: element,
|
|
1448
1952
|
store: store
|
|
1953
|
+
}), element.type === 'text' && /*#__PURE__*/jsx(CurveButton, {
|
|
1954
|
+
element: element,
|
|
1955
|
+
store: store
|
|
1449
1956
|
}), /*#__PURE__*/jsx(Divider, {
|
|
1450
1957
|
orientation: "vertical",
|
|
1451
1958
|
flexItem: true,
|
|
@@ -1489,26 +1996,26 @@ var CommonControls = observer(function (_ref0) {
|
|
|
1489
1996
|
});
|
|
1490
1997
|
|
|
1491
1998
|
// Download button with format/quality popover
|
|
1492
|
-
var DefaultDownloadButton = observer(function (
|
|
1493
|
-
var store =
|
|
1494
|
-
var
|
|
1495
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1496
|
-
anchorEl = _useState6[0],
|
|
1497
|
-
setAnchorEl = _useState6[1];
|
|
1498
|
-
var _useState7 = useState('png'),
|
|
1999
|
+
var DefaultDownloadButton = observer(function (_ref10) {
|
|
2000
|
+
var store = _ref10.store;
|
|
2001
|
+
var _useState7 = useState(null),
|
|
1499
2002
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1500
|
-
|
|
1501
|
-
|
|
2003
|
+
anchorEl = _useState8[0],
|
|
2004
|
+
setAnchorEl = _useState8[1];
|
|
2005
|
+
var _useState9 = useState('png'),
|
|
2006
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
2007
|
+
fileType = _useState0[0],
|
|
2008
|
+
setFileType = _useState0[1];
|
|
1502
2009
|
// Default quality so pixelRatio=1 (output = template's own pixel size).
|
|
1503
2010
|
// qualityToPixelRatio(q) = q * 3, so q = 1/3 → pixelRatio = 1.
|
|
1504
|
-
var
|
|
1505
|
-
_useState0 = _slicedToArray(_useState9, 2),
|
|
1506
|
-
quality = _useState0[0],
|
|
1507
|
-
setQuality = _useState0[1];
|
|
1508
|
-
var _useState1 = useState(false),
|
|
2011
|
+
var _useState1 = useState(1 / 3),
|
|
1509
2012
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
1510
|
-
|
|
1511
|
-
|
|
2013
|
+
quality = _useState10[0],
|
|
2014
|
+
setQuality = _useState10[1];
|
|
2015
|
+
var _useState11 = useState(false),
|
|
2016
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
2017
|
+
exporting = _useState12[0],
|
|
2018
|
+
setExporting = _useState12[1];
|
|
1512
2019
|
var open = Boolean(anchorEl);
|
|
1513
2020
|
var handleClick = function handleClick(e) {
|
|
1514
2021
|
setAnchorEl(e.currentTarget);
|
|
@@ -1741,15 +2248,15 @@ var DefaultDownloadButton = observer(function (_ref1) {
|
|
|
1741
2248
|
});
|
|
1742
2249
|
|
|
1743
2250
|
// Import button — loads a JSON template file into the store
|
|
1744
|
-
var DefaultImportButton = observer(function (
|
|
1745
|
-
var store =
|
|
1746
|
-
var
|
|
1747
|
-
|
|
1748
|
-
importing =
|
|
1749
|
-
setImporting =
|
|
2251
|
+
var DefaultImportButton = observer(function (_ref12) {
|
|
2252
|
+
var store = _ref12.store;
|
|
2253
|
+
var _useState13 = useState(false),
|
|
2254
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
2255
|
+
importing = _useState14[0],
|
|
2256
|
+
setImporting = _useState14[1];
|
|
1750
2257
|
var fileInputRef = React.useRef(null);
|
|
1751
2258
|
var handleFileChange = useCallback(/*#__PURE__*/function () {
|
|
1752
|
-
var
|
|
2259
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
|
|
1753
2260
|
var _e$target$files;
|
|
1754
2261
|
var file, text, jsonData, _t3;
|
|
1755
2262
|
return _regenerator().w(function (_context2) {
|
|
@@ -1787,7 +2294,7 @@ var DefaultImportButton = observer(function (_ref11) {
|
|
|
1787
2294
|
}, _callee2, null, [[2, 4, 5, 6]]);
|
|
1788
2295
|
}));
|
|
1789
2296
|
return function (_x) {
|
|
1790
|
-
return
|
|
2297
|
+
return _ref13.apply(this, arguments);
|
|
1791
2298
|
};
|
|
1792
2299
|
}(), [store]);
|
|
1793
2300
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -1853,10 +2360,10 @@ var rowSx = {
|
|
|
1853
2360
|
display: 'none'
|
|
1854
2361
|
}
|
|
1855
2362
|
};
|
|
1856
|
-
var Toolbar = observer(function (
|
|
1857
|
-
var store =
|
|
1858
|
-
|
|
1859
|
-
components =
|
|
2363
|
+
var Toolbar = observer(function (_ref14) {
|
|
2364
|
+
var store = _ref14.store,
|
|
2365
|
+
_ref14$components = _ref14.components,
|
|
2366
|
+
components = _ref14$components === void 0 ? {} : _ref14$components;
|
|
1860
2367
|
var ActionControls = components.ActionControls;
|
|
1861
2368
|
var ImportButton = 'ImportButton' in components ? components.ImportButton : DefaultImportButton;
|
|
1862
2369
|
var DownloadButton = 'DownloadButton' in components ? components.DownloadButton : DefaultDownloadButton;
|