@@ -28,7 +28,7 @@ export function _isSet(cssProperty: CssProperty<any, any>, instance: Style): boo
28
28
29
29
export function _printUnregisteredProperties ( ) : void {
30
30
print ( symbolPropertyMap ) ;
31
- print ( cssSymbolPropertyMap )
31
+ print ( cssSymbolPropertyMap ) ;
32
32
}
33
33
34
34
const enum ValueSource {
@@ -132,11 +132,11 @@ export class Property<T extends ViewBase, U> implements PropertyDescriptor, defi
132
132
this . requestLayout ( ) ;
133
133
}
134
134
}
135
- }
135
+ } ;
136
136
137
137
this . get = function ( this : T ) : U {
138
138
return key in this ? this [ key ] : defaultValue ;
139
- }
139
+ } ;
140
140
141
141
this . nativeValueChange = function ( owner : T , value : U ) : void {
142
142
const currentValue = key in owner ? owner [ key ] : defaultValue ;
@@ -160,7 +160,7 @@ export class Property<T extends ViewBase, U> implements PropertyDescriptor, defi
160
160
owner . requestLayout ( ) ;
161
161
}
162
162
}
163
- }
163
+ } ;
164
164
165
165
symbolPropertyMap [ key ] = this ;
166
166
}
@@ -219,7 +219,7 @@ export class CoercibleProperty<T extends ViewBase, U> implements PropertyDescrip
219
219
const originalValue : U = coerceKey in target ? target [ coerceKey ] : defaultValue ;
220
220
// need that to
AE8F
make coercing but also fire change events
221
221
this . set . call ( target , originalValue ) ;
222
- }
222
+ } ;
223
223
224
224
this . set = function ( this : T , value : U ) : void {
225
225
const reset = value === unsetValue ;
@@ -283,11 +283,11 @@ export class CoercibleProperty<T extends ViewBase, U> implements PropertyDescrip
283
283
this . requestLayout ( ) ;
284
284
}
285
285
}
286
- }
286
+ } ;
287
287
288
288
this . get = function ( ) : U {
289
289
return key in this ? this [ key ] : defaultValue ;
290
- }
290
+ } ;
291
291
292
292
this . nativeValueChange = function ( owner : T , value : U ) : void {
293
293
const currentValue = key in owner ? owner [ key ] : defaultValue ;
@@ -312,7 +312,7 @@ export class CoercibleProperty<T extends ViewBase, U> implements PropertyDescrip
312
312
owner . requestLayout ( ) ;
313
313
}
314
314
}
315
- }
315
+ } ;
316
316
317
317
symbolPropertyMap [ key ] = this ;
318
318
}
@@ -387,7 +387,7 @@ export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> imp
387
387
return true ;
388
388
} ) ;
389
389
}
390
- }
390
+ } ;
391
391
392
392
const setInheritedValue = setFunc ( ValueSource . Inherited ) ;
393
393
this . setInheritedValue = setInheritedValue ;
@@ -403,6 +403,7 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
403
403
404
404
public readonly name : string ;
405
405
public readonly cssName : string ;
406
+ public readonly cssLocalName : string ;
406
407
407
408
protected readonly cssValueDescriptor : PropertyDescriptor ;
408
409
protected readonly localValueDescriptor : PropertyDescriptor ;
@@ -417,8 +418,8 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
417
418
const name = options . name ;
418
419
this . name = name ;
419
420
420
- const cssName = `css-${ options . cssName } ` ;
421
- this . cssName = cssName ;
421
+ this . cssName = `css-${ options . cssName } ` ;
422
+ this . cssLocalName = options . cssName ;
422
423
423
424
const key = Symbol ( name + ":propertyKey" ) ;
424
425
this . key = key ;
@@ -593,6 +594,9 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
593
594
this . registered = true ;
594
595
Object . defineProperty ( cls . prototype , this . name , this . localValueDescriptor ) ;
595
596
Object . defineProperty ( cls . prototype , this . cssName , this . cssValueDescriptor ) ;
597
+ if ( this . cssLocalName !== this . cssName ) {
598
+ Object . defineProperty ( cls . prototype , this . cssLocalName , this . localValueDescriptor ) ;
599
+ }
596
600
}
597
601
}
598
602
@@ -634,7 +638,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
634
638
if ( reset ) {
635
639
// If unsetValue - we want to reset this property.
636
640
let parent = view . parent ;
637
- let style = parent ? parent . style : null
641
+ let style = parent ? parent . style : null ;
638
642
// If we have parent and it has non-default value we use as our inherited value.
639
643
if ( style && style [ sourceKey ] > ValueSource . Default ) {
640
644
newValue = style [ name ] ;
@@ -712,7 +716,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
712
716
return true ;
713
717
} ) ;
714
718
}
715
- }
719
+ } ;
716
720
717
721
const setDefaultFunc = setFunc ( ValueSource . Default ) ;
718
722
const setInheritedFunc = setFunc ( ValueSource . Inherited ) ;
@@ -731,6 +735,7 @@ export class ShorthandProperty<T extends Style, P> implements definitions.Shorth
731
735
public readonly key : symbol ;
732
736
public readonly name : string ;
733
737
public readonly cssName : string ;
738
+ public readonly cssLocalName : string ;
734
739
735
740
protected readonly cssValueDescriptor : PropertyDescriptor ;
736
741
protected readonly localValueDescriptor : PropertyDescriptor ;
@@ -739,14 +744,13 @@ export class ShorthandProperty<T extends Style, P> implements definitions.Shorth
739
744
public readonly sourceKey : symbol ;
740
745
741
746
constructor ( options : definitions . ShorthandPropertyOptions < P > ) {
742
- const name = options . name ;
743
- this . name = name ;
747
+ this . name = options . name ;
744
748
745
- const key = Symbol ( name + ":propertyKey" ) ;
749
+ const key = Symbol ( this . name + ":propertyKey" ) ;
746
750
this . key = key ;
747
751
748
- const cssName = `css-${ options . cssName } ` ;
749
- this . cssName = cssName ;
752
+ this . cssName = `css-${ options . cssName } ` ;
753
+ this . cssLocalName = ` ${ options . cssName } ` ;
750
754
751
755
const converter = options . converter ;
752
756
@@ -792,6 +796,9 @@ export class ShorthandProperty<T extends Style, P> implements definitions.Shorth
792
796
this . registered = true ;
793
797
Object . defineProperty ( cls . prototype , this . name , this . localValueDescriptor ) ;
794
798
Object . defineProperty ( cls . prototype , this . cssName , this . cssValueDescriptor ) ;
799
+ if ( this . cssLocalName !== this . cssName ) {
800
+ Object . defineProperty ( cls . prototype , this . cssLocalName , this . localValueDescriptor ) ;
801
+ }
795
802
}
796
803
}
797
804
@@ -958,5 +965,5 @@ export function makeParser<T>(isValid: (value: any) => boolean): (value: any) =>
958
965
} else {
959
966
throw new Error ( "Invalid value: " + value ) ;
960
967
}
961
- }
968
+ } ;
962
969
}
0 commit comments