@@ -24,6 +24,12 @@ let _id = 0;
24
24
25
25
class Serializer extends EventTarget {
26
26
27
+ static get type ( ) {
28
+
29
+ return 'Serializer' ;
30
+
31
+ }
32
+
27
33
constructor ( ) {
28
34
29
35
super ( ) ;
@@ -74,7 +80,7 @@ class Serializer extends EventTarget {
74
80
75
81
get className ( ) {
76
82
77
- return this . constructor . name ;
83
+ return this . constructor . type || this . constructor . name ;
78
84
79
85
}
80
86
@@ -446,6 +452,12 @@ let selected = null;
446
452
447
453
class Element extends Serializer {
448
454
455
+ static get type ( ) {
456
+
457
+ return 'Element' ;
458
+
459
+ }
460
+
449
461
constructor ( draggable = false ) {
450
462
451
463
super ( ) ;
@@ -1230,6 +1242,12 @@ Element.icons = { unlink: '' };
1230
1242
1231
1243
class Input extends Serializer {
1232
1244
1245
+ static get type ( ) {
1246
+
1247
+ return 'Input' ;
1248
+
1249
+ }
1250
+
1233
1251
constructor ( dom ) {
1234
1252
1235
1253
super ( ) ;
@@ -1388,6 +1406,12 @@ Input.prototype.isInput = true;
1388
1406
1389
1407
class Node extends Serializer {
1390
1408
1409
+ static get type ( ) {
1410
+
1411
+ return 'Node' ;
1412
+
1413
+ }
1414
+
1391
1415
constructor ( ) {
1392
1416
1393
1417
super ( ) ;
@@ -1774,6 +1798,12 @@ Node.prototype.isNode = true;
1774
1798
1775
1799
class DraggableElement extends Element {
1776
1800
1801
+ static get type ( ) {
1802
+
1803
+ return 'DraggableElement' ;
1804
+
1805
+ }
1806
+
1777
1807
constructor ( draggable = true ) {
1778
1808
1779
1809
super ( true ) ;
@@ -1803,6 +1833,12 @@ class DraggableElement extends Element {
1803
1833
1804
1834
class TitleElement extends DraggableElement {
1805
1835
1836
+ static get type ( ) {
1837
+
1838
+ return 'TitleElement' ;
1839
+
1840
+ }
1841
+
1806
1842
constructor ( title , draggable = true ) {
1807
1843
1808
1844
super ( draggable ) ;
@@ -1954,6 +1990,12 @@ const dropNode = new Node().add( new TitleElement( 'File' ) ).setWidth( 250 );
1954
1990
1955
1991
class Canvas extends Serializer {
1956
1992
1993
+ static get type ( ) {
1994
+
1995
+ return 'Canvas' ;
1996
+
1997
+ }
1998
+
1957
1999
constructor ( ) {
1958
2000
1959
2001
super ( ) ;
@@ -2424,7 +2466,10 @@ class Canvas extends Serializer {
2424
2466
2425
2467
get useTransform ( ) {
2426
2468
2427
- return navigator . userAgent . match ( / f i r e f o x / i ) !== null ;
2469
+ const userAgent = navigator . userAgent ;
2470
+ const isSafari = / S a f a r i / . test ( userAgent ) && ! / C h r o m e / . test ( userAgent ) ;
2471
+
2472
+ return ! isSafari ;
2428
2473
2429
2474
}
2430
2475
@@ -3643,6 +3688,12 @@ class Search extends Menu {
3643
3688
3644
3689
class LabelElement extends Element {
3645
3690
3691
+ static get type ( ) {
3692
+
3693
+ return 'LabelElement' ;
3694
+
3695
+ }
3696
+
3646
3697
constructor ( label = '' , align = '' ) {
3647
3698
3648
3699
super ( ) ;
@@ -3746,6 +3797,12 @@ class LabelElement extends Element {
3746
3797
3747
3798
class ButtonInput extends Input {
3748
3799
3800
+ static get type ( ) {
3801
+
3802
+ return 'ButtonInput' ;
3803
+
3804
+ }
3805
+
3749
3806
constructor ( innterText = '' ) {
3750
3807
3751
3808
const dom = document . createElement ( 'button' ) ;
@@ -3814,6 +3871,12 @@ class ButtonInput extends Input {
3814
3871
3815
3872
class ColorInput extends Input {
3816
3873
3874
+ static get type ( ) {
3875
+
3876
+ return 'ColorInput' ;
3877
+
3878
+ }
3879
+
3817
3880
constructor ( value = 0x0099ff ) {
3818
3881
3819
3882
const dom = document . createElement ( 'input' ) ;
@@ -3846,6 +3909,12 @@ class ColorInput extends Input {
3846
3909
3847
3910
class NumberInput extends Input {
3848
3911
3912
+ static get type ( ) {
3913
+
3914
+ return 'NumberInput' ;
3915
+
3916
+ }
3917
+
3849
3918
constructor ( value = 0 , min = - Infinity , max = Infinity , step = .01 ) {
3850
3919
3851
3920
const dom = document . createElement ( 'input' ) ;
@@ -3953,6 +4022,15 @@ class NumberInput extends Input {
3953
4022
3954
4023
}
3955
4024
4025
+ setInterger ( bool ) {
4026
+
4027
+ this . integer = bool ;
4028
+ this . step = .1 ;
4029
+
4030
+ return this . setValue ( this . getValue ( ) ) ;
4031
+
4032
+ }
4033
+
3956
4034
get precision ( ) {
3957
4035
3958
4036
if ( this . integer === true ) return 0 ;
@@ -4025,6 +4103,12 @@ class NumberInput extends Input {
4025
4103
4026
4104
class SelectInput extends Input {
4027
4105
4106
+ static get type ( ) {
4107
+
4108
+ return 'SelectInput' ;
4109
+
4110
+ }
4111
+
4028
4112
constructor ( options = [ ] , value = null ) {
4029
4113
4030
4114
const dom = document . createElement ( 'select' ) ;
@@ -4126,6 +4210,12 @@ const getStep = ( min, max ) => {
4126
4210
4127
4211
class SliderInput extends Input {
4128
4212
4213
+ static get type ( ) {
4214
+
4215
+ return 'SliderInput' ;
4216
+
4217
+ }
4218
+
4129
4219
constructor ( value = 0 , min = 0 , max = 100 ) {
4130
4220
4131
4221
const dom = document . createElement ( 'f-subinputs' ) ;
@@ -4262,6 +4352,12 @@ class SliderInput extends Input {
4262
4352
4263
4353
class StringInput extends Input {
4264
4354
4355
+ static get type ( ) {
4356
+
4357
+ return 'StringInput' ;
4358
+
4359
+ }
4360
+
4265
4361
constructor ( value = '' ) {
4266
4362
4267
4363
const dom = document . createElement ( 'f-string' ) ;
@@ -4426,6 +4522,12 @@ class StringInput extends Input {
4426
4522
4427
4523
class TextInput extends Input {
4428
4524
4525
+ static get type ( ) {
4526
+
4527
+ return 'TextInput' ;
4528
+
4529
+ }
4530
+
4429
4531
constructor ( innerText = '' ) {
4430
4532
4431
4533
const dom = document . createElement ( 'textarea' ) ;
@@ -4467,6 +4569,12 @@ class TextInput extends Input {
4467
4569
4468
4570
class ToggleInput extends Input {
4469
4571
4572
+ static get type ( ) {
4573
+
4574
+ return 'ToggleInput' ;
4575
+
4576
+ }
4577
+
4470
4578
constructor ( value = false ) {
4471
4579
4472
4580
const dom = document . createElement ( 'input' ) ;
@@ -4648,6 +4756,12 @@ class TreeViewNode {
4648
4756
4649
4757
class TreeViewInput extends Input {
4650
4758
4759
+ static get type ( ) {
4760
+
4761
+ return 'TreeViewInput' ;
4762
+
4763
+ }
4764
+
4651
4765
constructor ( options = [ ] ) {
4652
4766
4653
4767
const dom = document . createElement ( 'f-treeview' ) ;
@@ -4728,6 +4842,12 @@ const LoaderLib = {};
4728
4842
4729
4843
class Loader extends EventTarget {
4730
4844
4845
+ static get type ( ) {
4846
+
4847
+ return 'Loader' ;
4848
+
4849
+ }
4850
+
4731
4851
constructor ( parseType = Loader . DEFAULT ) {
4732
4852
4733
4853
super ( ) ;
0 commit comments