@akylas/nativescript 8.2.3 → 8.3.0-alpha.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/accessibility/index.ios.js +1 -1
- package/accessibility/index.ios.js.map +1 -1
- package/application/application-common.js.map +1 -1
- package/application/index.android.js.map +1 -1
- package/application/index.ios.d.ts +2 -0
- package/application/index.ios.js +7 -1
- package/application/index.ios.js.map +1 -1
- package/cli-hooks/before-checkForChanges.js +21 -16
- package/color/color-common.js +15 -9
- package/color/color-common.js.map +1 -1
- package/connectivity/index.android.js +11 -10
- package/connectivity/index.android.js.map +1 -1
- package/core-types/index.d.ts +1 -0
- package/core-types/index.js.map +1 -1
- package/css/LICENSE +9 -0
- package/css/Readme.md +278 -0
- package/css-value/LICENSE +9 -0
- package/css-value/Readme.md +45 -0
- package/css-value/UPGRADING.md +26 -0
- package/fetch/LICENSE +20 -0
- package/fetch/README.md +1 -0
- package/image-source/index.android.js +4 -7
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +3 -9
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +8 -2
- package/index.js +13 -2
- package/index.js.map +1 -1
- package/jest.config.d.ts +5 -0
- package/jest.config.js.map +1 -0
- package/js-libs/easysax/LICENSE +20 -0
- package/js-libs/easysax/README.md +46 -0
- package/js-libs/esprima/LICENSE.BSD +19 -0
- package/js-libs/esprima/README.md +24 -0
- package/js-libs/polymer-expressions/LICENSE +27 -0
- package/js-libs/polymer-expressions/README.md +0 -0
- package/package.json +5 -13
- package/platforms/README.md +1 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/platforms/ios/TNSWidgets.xcframework/Info.plist +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSWidgets.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSWidgets.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +1 -1
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/ui/animation/animation-common.d.ts +7 -4
- package/ui/animation/animation-common.js +55 -117
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.d.ts +3 -2
- package/ui/animation/index.android.d.ts +15 -14
- package/ui/animation/index.android.js +94 -20
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.d.ts +33 -16
- package/ui/animation/index.ios.js +256 -202
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +0 -1
- package/ui/animation/keyframe-animation.js +51 -51
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/button/index.ios.js +1 -1
- package/ui/button/index.ios.js.map +1 -1
- package/ui/core/properties/index.d.ts +37 -6
- package/ui/core/properties/index.js +434 -643
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.d.ts +5 -0
- package/ui/core/view/index.ios.d.ts +4 -2
- package/ui/core/view/index.ios.js +33 -10
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +1 -0
- package/ui/core/view/view-common.js +6 -3
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.ios.d.ts +2 -0
- package/ui/core/view/view-helper/index.ios.js +13 -4
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view-base/index.js +4 -5
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js +2 -1
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/frame/frame-common.d.ts +1 -1
- package/ui/frame/frame-common.js +17 -17
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/index.android.js +6 -2
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.ios.js +2 -0
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/html-view/html-view-common.js +2 -1
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/image/image-common.js +2 -2
- package/ui/image/image-common.js.map +1 -1
- package/ui/label/index.ios.js +2 -2
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-common.js +6 -4
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/list-view/list-view-common.js +2 -2
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.ios.d.ts +1 -0
- package/ui/page/index.ios.js +5 -0
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.js +2 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/proxy-view-container/index.d.ts +2 -0
- package/ui/proxy-view-container/index.js +28 -0
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/search-bar/search-bar-common.js +3 -2
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.js +2 -1
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/styling/css-animation-parser.js +3 -2
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/font.ios.js +23 -2
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/style/index.d.ts +3 -1
- package/ui/styling/style/index.js +6 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +1 -0
- package/ui/styling/style-properties.js +57 -69
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +4 -10
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/switch/index.android.js +8 -6
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/switch-common.js +2 -1
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.ios.d.ts +1 -0
- package/ui/tab-view/index.ios.js +54 -24
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.js +5 -4
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/index.android.js +1 -1
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.d.ts +5 -0
- package/ui/text-base/index.ios.js +4 -3
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/text-base-common.d.ts +3 -3
- package/ui/text-base/text-base-common.js +1 -1
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/web-view/index.android.js +4 -2
- package/ui/web-view/index.android.js.map +1 -1
- package/utils/index.android.d.ts +1 -1
- package/utils/index.android.js +1 -1
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.d.ts +1 -1
- package/utils/index.ios.js +1 -1
- package/utils/index.ios.js.map +1 -1
- package/utils/mainthread-helper.ios.d.ts +1 -1
- package/utils/mainthread-helper.ios.js +7 -9
- package/utils/mainthread-helper.ios.js.map +1 -1
- package/utils/native-helper.android.d.ts +2 -0
- package/utils/native-helper.android.js +127 -0
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +22 -0
- package/utils/native-helper.ios.d.ts +3 -0
- package/utils/native-helper.ios.js +90 -0
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/types.d.ts +2 -0
- package/utils/types.js +6 -0
- package/utils/types.js.map +1 -1
- package/platforms/android/core.aar +0 -0
- package/platforms/android/nativescript.aar +0 -0
|
@@ -11,19 +11,6 @@ const symbolPropertyMap = {};
|
|
|
11
11
|
const cssSymbolPropertyMap = {};
|
|
12
12
|
const inheritableProperties = new Array();
|
|
13
13
|
const inheritableCssProperties = new Array();
|
|
14
|
-
function print(map) {
|
|
15
|
-
const symbols = Object.getOwnPropertySymbols(map);
|
|
16
|
-
for (const symbol of symbols) {
|
|
17
|
-
const prop = map[symbol];
|
|
18
|
-
if (!prop.registered) {
|
|
19
|
-
console.log(`Property ${prop.name} not Registered!!!!!`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export function _printUnregisteredProperties() {
|
|
24
|
-
print(symbolPropertyMap);
|
|
25
|
-
print(cssSymbolPropertyMap);
|
|
26
|
-
}
|
|
27
14
|
export function _getProperties() {
|
|
28
15
|
return getPropertiesFromMap(symbolPropertyMap);
|
|
29
16
|
}
|
|
@@ -94,155 +81,186 @@ function getPropertiesFromMap(map) {
|
|
|
94
81
|
Object.getOwnPropertySymbols(map).forEach((symbol) => props.push(map[symbol]));
|
|
95
82
|
return props;
|
|
96
83
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
84
|
+
function overrideHandlers(property) {
|
|
85
|
+
return function (options) {
|
|
86
|
+
if (property instanceof CssAnimationProperty || property instanceof CssProperty || property instanceof ShorthandProperty) {
|
|
87
|
+
Object.keys(options).forEach((key) => {
|
|
88
|
+
if (key === 'cssName') {
|
|
89
|
+
if (options[key] !== undefined) {
|
|
90
|
+
//@ts-ignore ignore readonly
|
|
91
|
+
property.cssName = 'css:' + options[key];
|
|
92
|
+
//@ts-ignore ignore readonly
|
|
93
|
+
property.cssLocalName = options[key];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else if (options[key] !== undefined) {
|
|
97
|
+
property[key] = options[key];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
Object.keys(options).forEach((key) => {
|
|
103
|
+
if (options[key] !== undefined) {
|
|
104
|
+
property[key] = options[key];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function getPropertySetter(property) {
|
|
111
|
+
return function (boxedValue) {
|
|
112
|
+
const reset = boxedValue === unsetValue;
|
|
113
|
+
let value;
|
|
114
|
+
let wrapped;
|
|
115
|
+
const key = property.key;
|
|
116
|
+
const defaultValue = property.defaultValue;
|
|
117
|
+
if (reset) {
|
|
118
|
+
value = property.defaultValue;
|
|
119
|
+
if (property instanceof CoercibleProperty) {
|
|
120
|
+
delete this[property.coerceKey];
|
|
124
121
|
}
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
wrapped = boxedValue && boxedValue.wrapped;
|
|
125
|
+
value = wrapped ? WrappedValue.unwrap(boxedValue) : boxedValue;
|
|
126
|
+
if (property.valueConverter && typeof value === 'string') {
|
|
127
|
+
value = property.valueConverter(value);
|
|
127
128
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
129
|
+
if (property instanceof CoercibleProperty) {
|
|
130
|
+
this[property.coerceKey] = value;
|
|
131
|
+
value = property.coerceValue(this, value);
|
|
130
132
|
}
|
|
131
|
-
}
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
}
|
|
134
|
+
const oldValue = key in this ? this[key] : defaultValue;
|
|
135
|
+
const changed = property.equalityComparer ? !property.equalityComparer(oldValue, value) : oldValue !== value;
|
|
136
|
+
if (wrapped || changed) {
|
|
137
|
+
const defaultValueKey = property.defaultValueKey;
|
|
138
|
+
const setNative = property.setNative;
|
|
139
|
+
const valueChanged = property.valueChanged;
|
|
140
|
+
const getDefault = property.getDefault;
|
|
141
|
+
const eventName = property.eventName;
|
|
142
|
+
const propertyName = property.name;
|
|
137
143
|
if (reset) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
wrapped = boxedValue && boxedValue.wrapped;
|
|
142
|
-
value = wrapped ? WrappedValue.unwrap(boxedValue) : boxedValue;
|
|
143
|
-
if (valueConverter && typeof value === 'string') {
|
|
144
|
-
value = valueConverter(value);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const oldValue = key in this ? this[key] : defaultValue;
|
|
148
|
-
const changed = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
|
|
149
|
-
if (wrapped || changed) {
|
|
150
|
-
if (affectsLayout) {
|
|
151
|
-
this.requestLayout();
|
|
144
|
+
delete this[key];
|
|
145
|
+
if (valueChanged) {
|
|
146
|
+
valueChanged(this, oldValue, value);
|
|
152
147
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
if (this[setNative]) {
|
|
159
|
-
if (this._suspendNativeUpdatesCount) {
|
|
160
|
-
if (this._suspendedUpdates) {
|
|
161
|
-
this._suspendedUpdates[propertyName] = property;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
if (defaultValueKey in this) {
|
|
166
|
-
this[setNative](this[defaultValueKey]);
|
|
167
|
-
delete this[defaultValueKey];
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
this[setNative](defaultValue);
|
|
171
|
-
}
|
|
148
|
+
if (this[setNative]) {
|
|
149
|
+
if (this._suspendNativeUpdatesCount) {
|
|
150
|
+
if (this._suspendedUpdates) {
|
|
151
|
+
this._suspendedUpdates[propertyName] = property;
|
|
172
152
|
}
|
|
173
153
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
valueChanged(this, oldValue, value);
|
|
179
|
-
}
|
|
180
|
-
if (this[setNative]) {
|
|
181
|
-
if (this._suspendNativeUpdatesCount) {
|
|
182
|
-
if (this._suspendedUpdates) {
|
|
183
|
-
this._suspendedUpdates[propertyName] = property;
|
|
184
|
-
}
|
|
154
|
+
else {
|
|
155
|
+
if (defaultValueKey in this) {
|
|
156
|
+
this[setNative](this[defaultValueKey]);
|
|
157
|
+
delete this[defaultValueKey];
|
|
185
158
|
}
|
|
186
159
|
else {
|
|
187
|
-
|
|
188
|
-
this[defaultValueKey] = this[getDefault] ? this[getDefault]() : defaultValue;
|
|
189
|
-
}
|
|
190
|
-
this[setNative](value);
|
|
160
|
+
this[setNative](defaultValue);
|
|
191
161
|
}
|
|
192
162
|
}
|
|
193
163
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
value,
|
|
200
|
-
oldValue,
|
|
201
|
-
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this[key] = value;
|
|
167
|
+
if (valueChanged) {
|
|
168
|
+
valueChanged(this, oldValue, value);
|
|
202
169
|
}
|
|
203
|
-
if (this
|
|
204
|
-
if (
|
|
205
|
-
this.
|
|
170
|
+
if (this[setNative]) {
|
|
171
|
+
if (this._suspendNativeUpdatesCount) {
|
|
172
|
+
if (this._suspendedUpdates) {
|
|
173
|
+
this._suspendedUpdates[propertyName] = property;
|
|
174
|
+
}
|
|
206
175
|
}
|
|
207
176
|
else {
|
|
208
|
-
|
|
177
|
+
if (!(defaultValueKey in this)) {
|
|
178
|
+
this[defaultValueKey] = this[getDefault] ? this[getDefault]() : defaultValue;
|
|
179
|
+
}
|
|
180
|
+
this[setNative](value);
|
|
209
181
|
}
|
|
210
182
|
}
|
|
211
183
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (owner.hasListeners(eventName)) {
|
|
228
|
-
owner.notify({
|
|
229
|
-
object: owner,
|
|
230
|
-
eventName,
|
|
231
|
-
propertyName,
|
|
232
|
-
value,
|
|
233
|
-
oldValue,
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
if (affectsLayout) {
|
|
237
|
-
owner.requestLayout();
|
|
184
|
+
if (this.hasListeners(eventName)) {
|
|
185
|
+
this.notify({
|
|
186
|
+
object: this,
|
|
187
|
+
eventName,
|
|
188
|
+
propertyName,
|
|
189
|
+
value,
|
|
190
|
+
oldValue,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (property.affectsLayout) {
|
|
194
|
+
this.requestLayout();
|
|
195
|
+
}
|
|
196
|
+
if (this.domNode) {
|
|
197
|
+
if (reset) {
|
|
198
|
+
this.domNode.attributeRemoved(propertyName);
|
|
238
199
|
}
|
|
239
|
-
|
|
240
|
-
|
|
200
|
+
else {
|
|
201
|
+
this.domNode.attributeModified(propertyName, value);
|
|
241
202
|
}
|
|
242
203
|
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
export class Property {
|
|
208
|
+
constructor(options) {
|
|
209
|
+
this.enumerable = true;
|
|
210
|
+
this.configurable = true;
|
|
211
|
+
this.overrideHandlers = overrideHandlers(this);
|
|
212
|
+
this.overrideHandlers(options);
|
|
213
|
+
const propertyName = this.name;
|
|
214
|
+
const key = Symbol(propertyName + ':propertyKey');
|
|
215
|
+
this.key = key;
|
|
216
|
+
const getDefault = Symbol(propertyName + ':getDefault');
|
|
217
|
+
this.getDefault = getDefault;
|
|
218
|
+
const setNative = Symbol(propertyName + ':setNative');
|
|
219
|
+
this.setNative = setNative;
|
|
220
|
+
const defaultValueKey = Symbol(propertyName + ':nativeDefaultValue');
|
|
221
|
+
this.defaultValueKey = defaultValueKey;
|
|
222
|
+
this.eventName = propertyName + 'Change';
|
|
223
|
+
const property = this;
|
|
224
|
+
this.set = getPropertySetter(this);
|
|
225
|
+
this.get = function () {
|
|
226
|
+
return key in this ? this[key] : property.defaultValue;
|
|
243
227
|
};
|
|
244
228
|
symbolPropertyMap[key] = this;
|
|
245
229
|
}
|
|
230
|
+
nativeValueChange(owner, value) {
|
|
231
|
+
const key = this.key;
|
|
232
|
+
const defaultValue = this.defaultValue;
|
|
233
|
+
const oldValue = key in owner ? owner[key] : defaultValue;
|
|
234
|
+
const changed = this.equalityComparer ? !this.equalityComparer(oldValue, value) : oldValue !== value;
|
|
235
|
+
if (changed) {
|
|
236
|
+
const defaultValueKey = this.defaultValueKey;
|
|
237
|
+
const getDefault = this.getDefault;
|
|
238
|
+
const eventName = this.eventName;
|
|
239
|
+
const propertyName = this.name;
|
|
240
|
+
owner[key] = value;
|
|
241
|
+
if (this.valueChanged) {
|
|
242
|
+
this.valueChanged(owner, oldValue, value);
|
|
243
|
+
}
|
|
244
|
+
if (owner.nativeViewProtected && !(defaultValueKey in owner)) {
|
|
245
|
+
owner[defaultValueKey] = owner[getDefault] ? owner[getDefault]() : defaultValue;
|
|
246
|
+
}
|
|
247
|
+
if (owner.hasListeners(eventName)) {
|
|
248
|
+
owner.notify({
|
|
249
|
+
object: owner,
|
|
250
|
+
eventName,
|
|
251
|
+
propertyName,
|
|
252
|
+
value,
|
|
253
|
+
oldValue,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (this.affectsLayout) {
|
|
257
|
+
owner.requestLayout();
|
|
258
|
+
}
|
|
259
|
+
if (owner.domNode) {
|
|
260
|
+
owner.domNode.attributeModified(propertyName, value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
246
264
|
register(cls) {
|
|
247
265
|
if (this.registered) {
|
|
248
266
|
throw new Error(`Property ${this.name} already registered.`);
|
|
@@ -258,136 +276,22 @@ Property.prototype.isStyleProperty = false;
|
|
|
258
276
|
export class CoercibleProperty extends Property {
|
|
259
277
|
constructor(options) {
|
|
260
278
|
super(options);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const coerceKey = Symbol(propertyName + ':coerceKey');
|
|
268
|
-
const eventName = propertyName + 'Change';
|
|
269
|
-
let affectsLayout = options.affectsLayout;
|
|
270
|
-
let equalityComparer = options.equalityComparer;
|
|
271
|
-
let valueChanged = options.valueChanged;
|
|
272
|
-
let valueConverter = options.valueConverter;
|
|
273
|
-
let coerceCallback = options.coerceValue;
|
|
274
|
-
const property = this;
|
|
275
|
-
this.overrideHandlers = function (options) {
|
|
276
|
-
if (typeof options.equalityComparer !== 'undefined') {
|
|
277
|
-
equalityComparer = options.equalityComparer;
|
|
278
|
-
}
|
|
279
|
-
if (typeof options.affectsLayout !== 'undefined') {
|
|
280
|
-
affectsLayout = options.affectsLayout;
|
|
281
|
-
}
|
|
282
|
-
if (typeof options.valueChanged !== 'undefined') {
|
|
283
|
-
valueChanged = options.valueChanged;
|
|
284
|
-
}
|
|
285
|
-
if (typeof options.valueConverter !== 'undefined') {
|
|
286
|
-
valueConverter = options.valueConverter;
|
|
287
|
-
}
|
|
288
|
-
if (typeof options.coerceValue !== 'undefined') {
|
|
289
|
-
coerceCallback = options.coerceValue;
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
this.coerce = function (target) {
|
|
293
|
-
const originalValue = coerceKey in target ? target[coerceKey] : defaultValue;
|
|
294
|
-
// need that to make coercing but also fire change events
|
|
295
|
-
target[propertyName] = originalValue;
|
|
296
|
-
};
|
|
297
|
-
this.set = function (boxedValue) {
|
|
298
|
-
const reset = boxedValue === unsetValue;
|
|
299
|
-
let value;
|
|
300
|
-
let wrapped;
|
|
301
|
-
if (reset) {
|
|
302
|
-
value = defaultValue;
|
|
303
|
-
delete this[coerceKey];
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
wrapped = boxedValue && boxedValue.wrapped;
|
|
307
|
-
value = wrapped ? WrappedValue.unwrap(boxedValue) : boxedValue;
|
|
308
|
-
if (valueConverter && typeof value === 'string') {
|
|
309
|
-
value = valueConverter(value);
|
|
310
|
-
}
|
|
311
|
-
this[coerceKey] = value;
|
|
312
|
-
value = coerceCallback(this, value);
|
|
313
|
-
}
|
|
314
|
-
const oldValue = key in this ? this[key] : defaultValue;
|
|
315
|
-
const changed = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
|
|
316
|
-
if (wrapped || changed) {
|
|
317
|
-
if (reset) {
|
|
318
|
-
delete this[key];
|
|
319
|
-
if (valueChanged) {
|
|
320
|
-
valueChanged(this, oldValue, value);
|
|
321
|
-
}
|
|
322
|
-
if (this[setNative]) {
|
|
323
|
-
if (this._suspendNativeUpdatesCount) {
|
|
324
|
-
if (this._suspendedUpdates) {
|
|
325
|
-
this._suspendedUpdates[propertyName] = property;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
if (defaultValueKey in this) {
|
|
330
|
-
this[setNative](this[defaultValueKey]);
|
|
331
|
-
delete this[defaultValueKey];
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
this[setNative](defaultValue);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
this[key] = value;
|
|
341
|
-
if (valueChanged) {
|
|
342
|
-
valueChanged(this, oldValue, value);
|
|
343
|
-
}
|
|
344
|
-
if (this[setNative]) {
|
|
345
|
-
if (this._suspendNativeUpdatesCount) {
|
|
346
|
-
if (this._suspendedUpdates) {
|
|
347
|
-
this._suspendedUpdates[propertyName] = property;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
if (!(defaultValueKey in this)) {
|
|
352
|
-
this[defaultValueKey] = this[getDefault] ? this[getDefault]() : defaultValue;
|
|
353
|
-
}
|
|
354
|
-
this[setNative](value);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (this.hasListeners(eventName)) {
|
|
359
|
-
this.notify({
|
|
360
|
-
object: this,
|
|
361
|
-
eventName,
|
|
362
|
-
propertyName,
|
|
363
|
-
value,
|
|
364
|
-
oldValue,
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
if (affectsLayout) {
|
|
368
|
-
this.requestLayout();
|
|
369
|
-
}
|
|
370
|
-
if (this.domNode) {
|
|
371
|
-
if (reset) {
|
|
372
|
-
this.domNode.attributeRemoved(propertyName);
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
this.domNode.attributeModified(propertyName, value);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
};
|
|
279
|
+
this.coerceKey = Symbol(this.name + ':coerceKey');
|
|
280
|
+
}
|
|
281
|
+
coerce(target) {
|
|
282
|
+
const originalValue = this.coerceKey in target ? target[this.coerceKey] : this.defaultValue;
|
|
283
|
+
// need that to make coercing but also fire change events
|
|
284
|
+
target[this.name] = originalValue;
|
|
380
285
|
}
|
|
381
286
|
}
|
|
382
287
|
export class InheritedProperty extends Property {
|
|
383
288
|
constructor(options) {
|
|
384
289
|
super(options);
|
|
385
|
-
const name = options.name;
|
|
386
290
|
const key = this.key;
|
|
387
|
-
const
|
|
388
|
-
const sourceKey = Symbol(name + ':valueSourceKey');
|
|
291
|
+
const sourceKey = Symbol(this.name + ':valueSourceKey');
|
|
389
292
|
this.sourceKey = sourceKey;
|
|
390
293
|
const setBase = this.set;
|
|
294
|
+
const property = this;
|
|
391
295
|
const setFunc = (valueSource) => function (value) {
|
|
392
296
|
const that = this;
|
|
393
297
|
let unboxedValue;
|
|
@@ -397,11 +301,11 @@ export class InheritedProperty extends Property {
|
|
|
397
301
|
const parent = that.parent;
|
|
398
302
|
// If we have parent and it has non-default value we use as our inherited value.
|
|
399
303
|
if (parent && parent[sourceKey] !== 0 /* Default */) {
|
|
400
|
-
unboxedValue = parent[name];
|
|
304
|
+
unboxedValue = parent[property.name];
|
|
401
305
|
newValueSource = 1 /* Inherited */;
|
|
402
306
|
}
|
|
403
307
|
else {
|
|
404
|
-
unboxedValue = defaultValue;
|
|
308
|
+
unboxedValue = property.defaultValue;
|
|
405
309
|
newValueSource = 0 /* Default */;
|
|
406
310
|
}
|
|
407
311
|
}
|
|
@@ -439,212 +343,133 @@ export class InheritedProperty extends Property {
|
|
|
439
343
|
inheritableProperties.push(this);
|
|
440
344
|
}
|
|
441
345
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
this.cssLocalName = options.cssName;
|
|
449
|
-
const key = Symbol(propertyName + ':propertyKey');
|
|
450
|
-
this.key = key;
|
|
451
|
-
const sourceKey = Symbol(propertyName + ':valueSourceKey');
|
|
452
|
-
this.sourceKey = sourceKey;
|
|
453
|
-
const getDefault = Symbol(propertyName + ':getDefault');
|
|
454
|
-
this.getDefault = getDefault;
|
|
455
|
-
const setNative = Symbol(propertyName + ':setNative');
|
|
456
|
-
this.setNative = setNative;
|
|
457
|
-
const defaultValueKey = Symbol(propertyName + ':nativeDefaultValue');
|
|
458
|
-
this.defaultValueKey = defaultValueKey;
|
|
459
|
-
const defaultValue = options.defaultValue;
|
|
460
|
-
this.defaultValue = defaultValue;
|
|
461
|
-
const eventName = propertyName + 'Change';
|
|
462
|
-
let affectsLayout = options.affectsLayout;
|
|
463
|
-
let equalityComparer = options.equalityComparer;
|
|
464
|
-
let valueChanged = options.valueChanged;
|
|
465
|
-
let valueConverter = options.valueConverter;
|
|
466
|
-
this.overrideHandlers = function (options) {
|
|
467
|
-
if (typeof options.equalityComparer !== 'undefined') {
|
|
468
|
-
equalityComparer = options.equalityComparer;
|
|
469
|
-
}
|
|
470
|
-
if (typeof options.affectsLayout !== 'undefined') {
|
|
471
|
-
affectsLayout = options.affectsLayout;
|
|
472
|
-
}
|
|
473
|
-
if (typeof options.valueChanged !== 'undefined') {
|
|
474
|
-
valueChanged = options.valueChanged;
|
|
475
|
-
}
|
|
476
|
-
if (typeof options.valueConverter !== 'undefined') {
|
|
477
|
-
valueConverter = options.valueConverter;
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
const property = this;
|
|
481
|
-
function setLocalValue(newValue) {
|
|
482
|
-
const view = this.viewRef.get();
|
|
483
|
-
if (!view) {
|
|
484
|
-
Trace.write(`${newValue} not set to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
const reset = newValue === unsetValue || newValue === '';
|
|
488
|
-
let value;
|
|
489
|
-
if (reset) {
|
|
490
|
-
value = defaultValue;
|
|
491
|
-
delete this[sourceKey];
|
|
492
|
-
}
|
|
493
|
-
else {
|
|
494
|
-
this[sourceKey] = 3 /* Local */;
|
|
495
|
-
value = valueConverter && typeof newValue === 'string' ? valueConverter(newValue) : newValue;
|
|
496
|
-
}
|
|
497
|
-
const oldValue = key in this ? this[key] : defaultValue;
|
|
498
|
-
const changed = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
|
|
499
|
-
if (changed) {
|
|
500
|
-
if (reset) {
|
|
501
|
-
delete this[key];
|
|
502
|
-
if (valueChanged) {
|
|
503
|
-
valueChanged(this, oldValue, value);
|
|
504
|
-
}
|
|
505
|
-
if (view[setNative]) {
|
|
506
|
-
if (view._suspendNativeUpdatesCount) {
|
|
507
|
-
if (view._suspendedUpdates) {
|
|
508
|
-
view._suspendedUpdates[propertyName] = property;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
if (defaultValueKey in this) {
|
|
513
|
-
view[setNative](this[defaultValueKey]);
|
|
514
|
-
delete this[defaultValueKey];
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
view[setNative](defaultValue);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
this[key] = value;
|
|
524
|
-
if (valueChanged) {
|
|
525
|
-
valueChanged(this, oldValue, value);
|
|
526
|
-
}
|
|
527
|
-
if (view[setNative]) {
|
|
528
|
-
if (view._suspendNativeUpdatesCount) {
|
|
529
|
-
if (view._suspendedUpdates) {
|
|
530
|
-
view._suspendedUpdates[propertyName] = property;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
if (!(defaultValueKey in this)) {
|
|
535
|
-
this[defaultValueKey] = view[getDefault] ? view[getDefault]() : defaultValue;
|
|
536
|
-
}
|
|
537
|
-
view[setNative](value);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
if (this.hasListeners(eventName)) {
|
|
542
|
-
this.notify({
|
|
543
|
-
object: this,
|
|
544
|
-
eventName,
|
|
545
|
-
propertyName,
|
|
546
|
-
value,
|
|
547
|
-
oldValue,
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
if (affectsLayout) {
|
|
551
|
-
view.requestLayout();
|
|
552
|
-
}
|
|
553
|
-
}
|
|
346
|
+
function setCssFunc(property, valueSource) {
|
|
347
|
+
return function (newValue) {
|
|
348
|
+
const view = this.viewRef.get();
|
|
349
|
+
if (!view) {
|
|
350
|
+
Trace.write(`${newValue} not set to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
351
|
+
return;
|
|
554
352
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if (!view) {
|
|
558
|
-
Trace.write(`${newValue} not set to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
353
|
+
const sourceKey = property.sourceKey;
|
|
354
|
+
if (valueSource === 2 /* Css */) {
|
|
561
355
|
const currentValueSource = this[sourceKey] || 0 /* Default */;
|
|
562
356
|
// We have localValueSource - NOOP.
|
|
563
357
|
if (currentValueSource === 3 /* Local */) {
|
|
564
358
|
return;
|
|
565
359
|
}
|
|
566
|
-
|
|
567
|
-
|
|
360
|
+
}
|
|
361
|
+
const defaultValue = property.defaultValue;
|
|
362
|
+
const key = property.key;
|
|
363
|
+
const reset = newValue === unsetValue || newValue === '';
|
|
364
|
+
let value;
|
|
365
|
+
if (reset) {
|
|
366
|
+
value = defaultValue;
|
|
367
|
+
delete this[sourceKey];
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
this[sourceKey] = valueSource;
|
|
371
|
+
value = property.valueConverter && typeof newValue === 'string' ? property.valueConverter(newValue) : newValue;
|
|
372
|
+
}
|
|
373
|
+
const oldValue = key in this ? this[key] : defaultValue;
|
|
374
|
+
const changed = property.equalityComparer ? !property.equalityComparer(oldValue, value) : oldValue !== value;
|
|
375
|
+
if (changed) {
|
|
376
|
+
const setNative = property.setNative;
|
|
377
|
+
const defaultValueKey = property.defaultValueKey;
|
|
378
|
+
const propertyName = property.name;
|
|
379
|
+
const valueChanged = property.valueChanged;
|
|
380
|
+
const eventName = property.eventName;
|
|
568
381
|
if (reset) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
if (changed) {
|
|
579
|
-
if (reset) {
|
|
580
|
-
delete this[key];
|
|
581
|
-
if (valueChanged) {
|
|
582
|
-
valueChanged(this, oldValue, value);
|
|
382
|
+
delete this[key];
|
|
383
|
+
if (valueChanged) {
|
|
384
|
+
valueChanged(this, oldValue, value);
|
|
385
|
+
}
|
|
386
|
+
if (view[setNative]) {
|
|
387
|
+
if (view._suspendNativeUpdatesCount) {
|
|
388
|
+
if (view._suspendedUpdates) {
|
|
389
|
+
view._suspendedUpdates[propertyName] = property;
|
|
390
|
+
}
|
|
583
391
|
}
|
|
584
|
-
|
|
585
|
-
if (
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}
|
|
392
|
+
else {
|
|
393
|
+
if (defaultValueKey in this) {
|
|
394
|
+
view[setNative](this[defaultValueKey]);
|
|
395
|
+
delete this[defaultValueKey];
|
|
589
396
|
}
|
|
590
397
|
else {
|
|
591
|
-
|
|
592
|
-
view[setNative](this[defaultValueKey]);
|
|
593
|
-
delete this[defaultValueKey];
|
|
594
|
-
}
|
|
595
|
-
else {
|
|
596
|
-
view[setNative](defaultValue);
|
|
597
|
-
}
|
|
398
|
+
view[setNative](defaultValue);
|
|
598
399
|
}
|
|
599
400
|
}
|
|
600
401
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
this[key] = value;
|
|
405
|
+
if (valueChanged) {
|
|
406
|
+
valueChanged(this, oldValue, value);
|
|
407
|
+
}
|
|
408
|
+
if (view[setNative]) {
|
|
409
|
+
if (view._suspendNativeUpdatesCount) {
|
|
410
|
+
if (view._suspendedUpdates) {
|
|
411
|
+
view._suspendedUpdates[propertyName] = property;
|
|
611
412
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
view[
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
if (!(defaultValueKey in this)) {
|
|
416
|
+
const getDefault = property.getDefault;
|
|
417
|
+
this[defaultValueKey] = view[getDefault] ? view[getDefault]() : defaultValue;
|
|
617
418
|
}
|
|
419
|
+
view[setNative](value);
|
|
618
420
|
}
|
|
619
421
|
}
|
|
620
|
-
if (this.hasListeners(eventName)) {
|
|
621
|
-
this.notify({
|
|
622
|
-
object: this,
|
|
623
|
-
eventName,
|
|
624
|
-
propertyName,
|
|
625
|
-
value,
|
|
626
|
-
oldValue,
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
if (affectsLayout) {
|
|
630
|
-
view.requestLayout();
|
|
631
|
-
}
|
|
632
422
|
}
|
|
423
|
+
if (this.hasListeners(eventName)) {
|
|
424
|
+
this.notify({
|
|
425
|
+
object: this,
|
|
426
|
+
eventName,
|
|
427
|
+
propertyName,
|
|
428
|
+
value,
|
|
429
|
+
oldValue,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (property.affectsLayout) {
|
|
433
|
+
view.requestLayout();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
export class CssProperty {
|
|
439
|
+
constructor(options) {
|
|
440
|
+
this.overrideHandlers = overrideHandlers(this);
|
|
441
|
+
this.overrideHandlers(options);
|
|
442
|
+
const propertyName = this.name;
|
|
443
|
+
CssProperty.properties[propertyName] = this;
|
|
444
|
+
if (this.cssLocalName && this.cssLocalName !== propertyName) {
|
|
445
|
+
CssProperty.properties[this.cssLocalName] = this;
|
|
633
446
|
}
|
|
447
|
+
const key = Symbol(propertyName + ':propertyKey');
|
|
448
|
+
this.key = key;
|
|
449
|
+
const sourceKey = Symbol(propertyName + ':valueSourceKey');
|
|
450
|
+
this.sourceKey = sourceKey;
|
|
451
|
+
const getDefault = Symbol(propertyName + ':getDefault');
|
|
452
|
+
this.getDefault = getDefault;
|
|
453
|
+
const setNative = Symbol(propertyName + ':setNative');
|
|
454
|
+
this.setNative = setNative;
|
|
455
|
+
const defaultValueKey = Symbol(propertyName + ':nativeDefaultValue');
|
|
456
|
+
this.defaultValueKey = defaultValueKey;
|
|
457
|
+
this.eventName = propertyName + 'Change';
|
|
458
|
+
const property = this;
|
|
634
459
|
function get() {
|
|
635
|
-
return key in this ? this[key] : defaultValue;
|
|
460
|
+
return key in this ? this[key] : property.defaultValue;
|
|
636
461
|
}
|
|
637
462
|
this.cssValueDescriptor = {
|
|
638
463
|
enumerable: true,
|
|
639
464
|
configurable: true,
|
|
640
465
|
get: get,
|
|
641
|
-
set:
|
|
466
|
+
set: setCssFunc(this, 2 /* Css */),
|
|
642
467
|
};
|
|
643
468
|
this.localValueDescriptor = {
|
|
644
469
|
enumerable: true,
|
|
645
470
|
configurable: true,
|
|
646
471
|
get: get,
|
|
647
|
-
set:
|
|
472
|
+
set: setCssFunc(this, 3 /* Local */),
|
|
648
473
|
};
|
|
649
474
|
cssSymbolPropertyMap[key] = this;
|
|
650
475
|
}
|
|
@@ -652,6 +477,8 @@ export class CssProperty {
|
|
|
652
477
|
if (this.registered) {
|
|
653
478
|
throw new Error(`Property ${this.name} already registered.`);
|
|
654
479
|
}
|
|
480
|
+
// we add it so that overrideHandlers might work
|
|
481
|
+
cssPropertyNames.push(this.cssLocalName);
|
|
655
482
|
this.registered = true;
|
|
656
483
|
Object.defineProperty(cls.prototype, this.name, this.localValueDescriptor);
|
|
657
484
|
Object.defineProperty(cls.prototype, this.cssName, this.cssValueDescriptor);
|
|
@@ -663,28 +490,23 @@ export class CssProperty {
|
|
|
663
490
|
return this.key in instance;
|
|
664
491
|
}
|
|
665
492
|
}
|
|
493
|
+
CssProperty.properties = {};
|
|
666
494
|
CssProperty.prototype.isStyleProperty = true;
|
|
667
495
|
export class CssAnimationProperty {
|
|
668
496
|
constructor(options) {
|
|
669
|
-
|
|
670
|
-
this.
|
|
671
|
-
|
|
497
|
+
this.overrideHandlers = overrideHandlers(this);
|
|
498
|
+
this.overrideHandlers(options);
|
|
499
|
+
const propertyName = this.name;
|
|
672
500
|
CssAnimationProperty.properties[propertyName] = this;
|
|
673
|
-
if (
|
|
674
|
-
CssAnimationProperty.properties[
|
|
501
|
+
if (this.cssLocalName && this.cssLocalName !== propertyName) {
|
|
502
|
+
CssAnimationProperty.properties[this.cssLocalName] = this;
|
|
675
503
|
}
|
|
676
|
-
this._valueConverter = options.valueConverter;
|
|
677
|
-
const cssLocalName = options.cssName || propertyName;
|
|
678
|
-
this.cssLocalName = cssLocalName;
|
|
679
|
-
const cssName = 'css:' + cssLocalName;
|
|
680
|
-
this.cssName = cssName;
|
|
681
504
|
const keyframeName = 'keyframe:' + propertyName;
|
|
682
505
|
this.keyframe = keyframeName;
|
|
683
506
|
const defaultName = 'default:' + propertyName;
|
|
684
507
|
const defaultValueKey = Symbol(defaultName);
|
|
685
508
|
this.defaultValueKey = defaultValueKey;
|
|
686
|
-
|
|
687
|
-
const cssValue = Symbol(cssName);
|
|
509
|
+
const cssValue = Symbol(this.cssName);
|
|
688
510
|
const styleValue = Symbol(`local:${propertyName}`);
|
|
689
511
|
const keyframeValue = Symbol(keyframeName);
|
|
690
512
|
const computedValue = Symbol('computed-value:' + propertyName);
|
|
@@ -694,7 +516,7 @@ export class CssAnimationProperty {
|
|
|
694
516
|
this.getDefault = Symbol(propertyName + ':getDefault');
|
|
695
517
|
const getDefault = this.getDefault;
|
|
696
518
|
const setNative = (this.setNative = Symbol(propertyName + ':setNative'));
|
|
697
|
-
|
|
519
|
+
this.eventName = propertyName + 'Change';
|
|
698
520
|
const property = this;
|
|
699
521
|
function descriptor(symbol, propertySource, enumerable, configurable, getsComputed) {
|
|
700
522
|
return {
|
|
@@ -736,8 +558,8 @@ export class CssAnimationProperty {
|
|
|
736
558
|
}
|
|
737
559
|
}
|
|
738
560
|
else {
|
|
739
|
-
if (
|
|
740
|
-
boxedValue =
|
|
561
|
+
if (property.valueConverter && typeof boxedValue === 'string') {
|
|
562
|
+
boxedValue = property.valueConverter(boxedValue);
|
|
741
563
|
}
|
|
742
564
|
this[symbol] = boxedValue;
|
|
743
565
|
if (this[computedSource] <= propertySource) {
|
|
@@ -748,9 +570,9 @@ export class CssAnimationProperty {
|
|
|
748
570
|
const value = this[computedValue];
|
|
749
571
|
const source = this[computedSource];
|
|
750
572
|
const isSet = source !== 0 /* Default */;
|
|
751
|
-
const computedValueChanged = oldValue !== value && (!
|
|
752
|
-
if (computedValueChanged &&
|
|
753
|
-
|
|
573
|
+
const computedValueChanged = oldValue !== value && (!property.equalityComparer || !property.equalityComparer(oldValue, value));
|
|
574
|
+
if (computedValueChanged && property.valueChanged) {
|
|
575
|
+
property.valueChanged(this, oldValue, value);
|
|
754
576
|
}
|
|
755
577
|
if (view[setNative] && (computedValueChanged || isSet !== wasSet)) {
|
|
756
578
|
if (view._suspendNativeUpdatesCount) {
|
|
@@ -761,7 +583,7 @@ export class CssAnimationProperty {
|
|
|
761
583
|
else {
|
|
762
584
|
if (isSet) {
|
|
763
585
|
if (!wasSet && !(defaultValueKey in this)) {
|
|
764
|
-
this[defaultValueKey] = view[getDefault] ? view[getDefault]() :
|
|
586
|
+
this[defaultValueKey] = view[getDefault] ? view[getDefault]() : property.defaultValue;
|
|
765
587
|
}
|
|
766
588
|
view[setNative](value);
|
|
767
589
|
}
|
|
@@ -770,11 +592,12 @@ export class CssAnimationProperty {
|
|
|
770
592
|
view[setNative](this[defaultValueKey]);
|
|
771
593
|
}
|
|
772
594
|
else {
|
|
773
|
-
view[setNative](
|
|
595
|
+
view[setNative](property.defaultValue);
|
|
774
596
|
}
|
|
775
597
|
}
|
|
776
598
|
}
|
|
777
599
|
}
|
|
600
|
+
const eventName = property.eventName;
|
|
778
601
|
if (computedValueChanged && this.hasListeners(eventName)) {
|
|
779
602
|
this.notify({
|
|
780
603
|
object: this,
|
|
@@ -784,6 +607,9 @@ export class CssAnimationProperty {
|
|
|
784
607
|
oldValue,
|
|
785
608
|
});
|
|
786
609
|
}
|
|
610
|
+
if (property.affectsLayout) {
|
|
611
|
+
view.requestLayout();
|
|
612
|
+
}
|
|
787
613
|
},
|
|
788
614
|
};
|
|
789
615
|
}
|
|
@@ -794,16 +620,18 @@ export class CssAnimationProperty {
|
|
|
794
620
|
symbolPropertyMap[computedValue] = this;
|
|
795
621
|
cssSymbolPropertyMap[computedValue] = this;
|
|
796
622
|
this.register = (cls) => {
|
|
797
|
-
|
|
623
|
+
// we add it so that overrideHandlers might work
|
|
624
|
+
cssPropertyNames.push(this.cssLocalName);
|
|
625
|
+
cls.prototype[computedValue] = this.defaultValue;
|
|
798
626
|
cls.prototype[computedSource] = 0 /* Default */;
|
|
799
627
|
cls.prototype[cssValue] = unsetValue;
|
|
800
628
|
cls.prototype[styleValue] = unsetValue;
|
|
801
629
|
cls.prototype[keyframeValue] = unsetValue;
|
|
802
630
|
Object.defineProperty(cls.prototype, defaultName, defaultPropertyDescriptor);
|
|
803
|
-
Object.defineProperty(cls.prototype, cssName, cssPropertyDescriptor);
|
|
631
|
+
Object.defineProperty(cls.prototype, this.cssName, cssPropertyDescriptor);
|
|
804
632
|
Object.defineProperty(cls.prototype, propertyName, stylePropertyDescriptor);
|
|
805
|
-
if (
|
|
806
|
-
Object.defineProperty(cls.prototype,
|
|
633
|
+
if (this.cssLocalName && this.cssLocalName !== this.name) {
|
|
634
|
+
Object.defineProperty(cls.prototype, this.cssLocalName, stylePropertyDescriptor);
|
|
807
635
|
}
|
|
808
636
|
Object.defineProperty(cls.prototype, keyframeName, keyframePropertyDescriptor);
|
|
809
637
|
};
|
|
@@ -832,200 +660,180 @@ export class CssAnimationProperty {
|
|
|
832
660
|
}
|
|
833
661
|
CssAnimationProperty.properties = {};
|
|
834
662
|
CssAnimationProperty.prototype.isStyleProperty = true;
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
const
|
|
843
|
-
const
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
if (typeof options.equalityComparer !== 'undefined') {
|
|
853
|
-
equalityComparer = options.equalityComparer;
|
|
854
|
-
}
|
|
855
|
-
if (typeof options.affectsLayout !== 'undefined') {
|
|
856
|
-
affectsLayout = options.affectsLayout;
|
|
857
|
-
}
|
|
858
|
-
if (typeof options.valueChanged !== 'undefined') {
|
|
859
|
-
valueChanged = options.valueChanged;
|
|
860
|
-
}
|
|
861
|
-
if (typeof options.valueConverter !== 'undefined') {
|
|
862
|
-
valueConverter = options.valueConverter;
|
|
663
|
+
function setCssInheritedFunc(property, valueSource) {
|
|
664
|
+
return function (boxedValue) {
|
|
665
|
+
const view = this.viewRef.get();
|
|
666
|
+
if (!view) {
|
|
667
|
+
Trace.write(`${boxedValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
const key = property.key;
|
|
671
|
+
const defaultValue = property.defaultValue;
|
|
672
|
+
const sourceKey = property.sourceKey;
|
|
673
|
+
const propertyName = property.name;
|
|
674
|
+
const reset = boxedValue === unsetValue || boxedValue === '';
|
|
675
|
+
const currentValueSource = this[sourceKey] || 0 /* Default */;
|
|
676
|
+
if (reset) {
|
|
677
|
+
// If we want to reset cssValue and we have localValue - return;
|
|
678
|
+
if (valueSource === 2 /* Css */ && currentValueSource === 3 /* Local */) {
|
|
679
|
+
return;
|
|
863
680
|
}
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if (!view) {
|
|
868
|
-
Trace.write(`${boxedValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
if (currentValueSource > valueSource) {
|
|
869
684
|
return;
|
|
870
685
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
686
|
+
}
|
|
687
|
+
const oldValue = key in this ? this[key] : defaultValue;
|
|
688
|
+
let value;
|
|
689
|
+
let unsetNativeValue = false;
|
|
690
|
+
if (reset) {
|
|
691
|
+
// If unsetValue - we want to reset this property.
|
|
692
|
+
const parent = view.parent;
|
|
693
|
+
const style = parent ? parent.style : null;
|
|
694
|
+
// If we have parent and it has non-default value we use as our inherited value.
|
|
695
|
+
if (style && style[sourceKey] > 0 /* Default */) {
|
|
696
|
+
value = style[propertyName];
|
|
697
|
+
this[sourceKey] = 1 /* Inherited */;
|
|
698
|
+
this[key] = value;
|
|
878
699
|
}
|
|
879
700
|
else {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
701
|
+
value = defaultValue;
|
|
702
|
+
delete this[sourceKey];
|
|
703
|
+
delete this[key];
|
|
704
|
+
unsetNativeValue = true;
|
|
883
705
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
if (
|
|
888
|
-
|
|
889
|
-
const parent = view.parent;
|
|
890
|
-
const style = parent ? parent.style : null;
|
|
891
|
-
// If we have parent and it has non-default value we use as our inherited value.
|
|
892
|
-
if (style && style[sourceKey] > 0 /* Default */) {
|
|
893
|
-
value = style[propertyName];
|
|
894
|
-
this[sourceKey] = 1 /* Inherited */;
|
|
895
|
-
this[key] = value;
|
|
896
|
-
}
|
|
897
|
-
else {
|
|
898
|
-
value = defaultValue;
|
|
899
|
-
delete this[sourceKey];
|
|
900
|
-
delete this[key];
|
|
901
|
-
unsetNativeValue = true;
|
|
902
|
-
}
|
|
706
|
+
}
|
|
707
|
+
else {
|
|
708
|
+
this[sourceKey] = valueSource;
|
|
709
|
+
if (property.valueConverter && typeof boxedValue === 'string') {
|
|
710
|
+
value = property.valueConverter(boxedValue);
|
|
903
711
|
}
|
|
904
712
|
else {
|
|
905
|
-
|
|
906
|
-
if (valueConverter && typeof boxedValue === 'string') {
|
|
907
|
-
value = valueConverter(boxedValue);
|
|
908
|
-
}
|
|
909
|
-
else {
|
|
910
|
-
value = boxedValue;
|
|
911
|
-
}
|
|
912
|
-
this[key] = value;
|
|
713
|
+
value = boxedValue;
|
|
913
714
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
715
|
+
this[key] = value;
|
|
716
|
+
}
|
|
717
|
+
const changed = property.equalityComparer ? !property.equalityComparer(oldValue, value) : oldValue !== value;
|
|
718
|
+
if (changed) {
|
|
719
|
+
const setNative = property.setNative;
|
|
720
|
+
const defaultValueKey = property.defaultValueKey;
|
|
721
|
+
const eventName = property.eventName;
|
|
722
|
+
const getDefault = property.getDefault;
|
|
723
|
+
if (property.valueChanged) {
|
|
724
|
+
property.valueChanged(this, oldValue, value);
|
|
725
|
+
}
|
|
726
|
+
if (view[setNative]) {
|
|
727
|
+
if (view._suspendNativeUpdatesCount) {
|
|
728
|
+
if (view._suspendedUpdates) {
|
|
729
|
+
view._suspendedUpdates[propertyName] = property;
|
|
924
730
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
else {
|
|
932
|
-
view[setNative](defaultValue);
|
|
933
|
-
}
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
if (unsetNativeValue) {
|
|
734
|
+
if (defaultValueKey in this) {
|
|
735
|
+
view[setNative](this[defaultValueKey]);
|
|
736
|
+
delete this[defaultValueKey];
|
|
934
737
|
}
|
|
935
738
|
else {
|
|
936
|
-
|
|
937
|
-
this[defaultValueKey] = view[getDefault] ? view[getDefault]() : defaultValue;
|
|
938
|
-
}
|
|
939
|
-
view[setNative](value);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
if (this.hasListeners(eventName)) {
|
|
944
|
-
this.notify({
|
|
945
|
-
object: this,
|
|
946
|
-
eventName,
|
|
947
|
-
propertyName,
|
|
948
|
-
value,
|
|
949
|
-
oldValue,
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
if (affectsLayout) {
|
|
953
|
-
view.requestLayout();
|
|
954
|
-
}
|
|
955
|
-
view.eachChild((child) => {
|
|
956
|
-
const childStyle = child.style;
|
|
957
|
-
const childValueSource = childStyle[sourceKey] || 0 /* Default */;
|
|
958
|
-
if (reset) {
|
|
959
|
-
if (childValueSource === 1 /* Inherited */) {
|
|
960
|
-
setDefaultFunc.call(childStyle, unsetValue);
|
|
739
|
+
view[setNative](defaultValue);
|
|
961
740
|
}
|
|
962
741
|
}
|
|
963
742
|
else {
|
|
964
|
-
if (
|
|
965
|
-
|
|
743
|
+
if (!(defaultValueKey in this)) {
|
|
744
|
+
this[defaultValueKey] = view[getDefault] ? view[getDefault]() : defaultValue;
|
|
966
745
|
}
|
|
746
|
+
view[setNative](value);
|
|
967
747
|
}
|
|
968
|
-
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
if (this.hasListeners(eventName)) {
|
|
751
|
+
this.notify({
|
|
752
|
+
object: this,
|
|
753
|
+
eventName,
|
|
754
|
+
propertyName,
|
|
755
|
+
value,
|
|
756
|
+
oldValue,
|
|
969
757
|
});
|
|
970
758
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
759
|
+
if (property.affectsLayout) {
|
|
760
|
+
view.requestLayout();
|
|
761
|
+
}
|
|
762
|
+
view.eachChild((child) => {
|
|
763
|
+
const childStyle = child.style;
|
|
764
|
+
const childValueSource = childStyle[sourceKey] || 0 /* Default */;
|
|
765
|
+
if (reset) {
|
|
766
|
+
if (childValueSource === 1 /* Inherited */) {
|
|
767
|
+
property.setDefaultValue.call(childStyle, unsetValue);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
if (childValueSource <= 1 /* Inherited */) {
|
|
772
|
+
property.setInheritedValue.call(childStyle, value);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return true;
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
export class InheritedCssProperty extends CssProperty {
|
|
781
|
+
constructor(options) {
|
|
782
|
+
super(options);
|
|
783
|
+
const propertyName = options.name;
|
|
784
|
+
InheritedCssProperty.properties[propertyName] = this;
|
|
785
|
+
this.setDefaultValue = setCssInheritedFunc(this, 0 /* Default */);
|
|
786
|
+
this.setInheritedValue = setCssInheritedFunc(this, 1 /* Inherited */);
|
|
787
|
+
this.cssValueDescriptor.set = setCssInheritedFunc(this, 2 /* Css */);
|
|
788
|
+
this.localValueDescriptor.set = setCssInheritedFunc(this, 3 /* Local */);
|
|
977
789
|
inheritableCssProperties.push(this);
|
|
978
790
|
}
|
|
979
791
|
}
|
|
792
|
+
InheritedCssProperty.properties = {};
|
|
793
|
+
function setShorthandFunc(property, valueSource) {
|
|
794
|
+
return function (newValue) {
|
|
795
|
+
const view = this.viewRef.get();
|
|
796
|
+
if (!view) {
|
|
797
|
+
Trace.write(`setLocalValue not executed to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
view._batchUpdate(() => {
|
|
801
|
+
for (const [p, v] of property.converter(newValue)) {
|
|
802
|
+
if (valueSource === 2 /* Css */) {
|
|
803
|
+
this[p.cssName] = v;
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
this[p.name] = v;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
}
|
|
980
812
|
export class ShorthandProperty {
|
|
981
813
|
constructor(options) {
|
|
982
|
-
this.
|
|
814
|
+
this.overrideHandlers = overrideHandlers(this);
|
|
815
|
+
this.overrideHandlers(options);
|
|
983
816
|
const key = Symbol(this.name + ':propertyKey');
|
|
817
|
+
ShorthandProperty.properties[this.name] = this;
|
|
984
818
|
this.key = key;
|
|
985
|
-
this.cssName = `css:${options.cssName}`;
|
|
986
|
-
this.cssLocalName = `${options.cssName}`;
|
|
987
|
-
const converter = options.converter;
|
|
988
|
-
function setLocalValue(value) {
|
|
989
|
-
const view = this.viewRef.get();
|
|
990
|
-
if (!view) {
|
|
991
|
-
Trace.write(`setLocalValue not executed to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
view._batchUpdate(() => {
|
|
995
|
-
for (const [p, v] of converter(value)) {
|
|
996
|
-
this[p.name] = v;
|
|
997
|
-
}
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
function setCssValue(value) {
|
|
1001
|
-
const view = this.viewRef.get();
|
|
1002
|
-
if (!view) {
|
|
1003
|
-
Trace.write(`setCssValue not executed to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
|
1004
|
-
return;
|
|
1005
|
-
}
|
|
1006
|
-
view._batchUpdate(() => {
|
|
1007
|
-
for (const [p, v] of converter(value)) {
|
|
1008
|
-
this[p.cssName] = v;
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
819
|
this.cssValueDescriptor = {
|
|
1013
820
|
enumerable: true,
|
|
1014
821
|
configurable: true,
|
|
1015
822
|
get: options.getter,
|
|
1016
|
-
set:
|
|
823
|
+
set: setShorthandFunc(this, 2 /* Css */),
|
|
1017
824
|
};
|
|
1018
825
|
this.localValueDescriptor = {
|
|
1019
826
|
enumerable: true,
|
|
1020
827
|
configurable: true,
|
|
1021
828
|
get: options.getter,
|
|
1022
|
-
set:
|
|
829
|
+
set: setShorthandFunc(this, 3 /* Local */),
|
|
1023
830
|
};
|
|
831
|
+
const property = this;
|
|
1024
832
|
this.propertyBagDescriptor = {
|
|
1025
833
|
enumerable: false,
|
|
1026
834
|
configurable: true,
|
|
1027
835
|
set(value) {
|
|
1028
|
-
converter(value).forEach(([property, value]) => {
|
|
836
|
+
property.converter(value).forEach(([property, value]) => {
|
|
1029
837
|
this[property.cssLocalName] = value;
|
|
1030
838
|
});
|
|
1031
839
|
},
|
|
@@ -1045,9 +853,10 @@ export class ShorthandProperty {
|
|
|
1045
853
|
Object.defineProperty(cls.prototype.PropertyBag, this.cssLocalName, this.propertyBagDescriptor);
|
|
1046
854
|
}
|
|
1047
855
|
}
|
|
1048
|
-
|
|
856
|
+
ShorthandProperty.properties = {};
|
|
857
|
+
function inheritablePropertyValuesOn(view, properties) {
|
|
1049
858
|
const array = new Array();
|
|
1050
|
-
for (const prop of
|
|
859
|
+
for (const prop of properties) {
|
|
1051
860
|
const sourceKey = prop.sourceKey;
|
|
1052
861
|
const valueSource = view[sourceKey] || 0 /* Default */;
|
|
1053
862
|
if (valueSource !== 0 /* Default */) {
|
|
@@ -1058,19 +867,6 @@ function inheritablePropertyValuesOn(view) {
|
|
|
1058
867
|
}
|
|
1059
868
|
return array;
|
|
1060
869
|
}
|
|
1061
|
-
function inheritableCssPropertyValuesOn(style) {
|
|
1062
|
-
const array = new Array();
|
|
1063
|
-
for (const prop of inheritableCssProperties) {
|
|
1064
|
-
const sourceKey = prop.sourceKey;
|
|
1065
|
-
const valueSource = style[sourceKey] || 0 /* Default */;
|
|
1066
|
-
if (valueSource !== 0 /* Default */) {
|
|
1067
|
-
// use prop.name as it will return value or default value.
|
|
1068
|
-
// prop.key will return undefined if property is set the same value as default one.
|
|
1069
|
-
array.push({ property: prop, value: style[prop.name] });
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
return array;
|
|
1073
|
-
}
|
|
1074
870
|
export const initNativeView = profile('"properties".initNativeView', function initNativeView(view) {
|
|
1075
871
|
const wasSuspended = view.suspendRequestLayout;
|
|
1076
872
|
view.suspendRequestLayout = true;
|
|
@@ -1224,8 +1020,14 @@ export function resetCSSProperties(style) {
|
|
|
1224
1020
|
}
|
|
1225
1021
|
}
|
|
1226
1022
|
}
|
|
1023
|
+
export function propagateInheritableCssProperties(style, child) {
|
|
1024
|
+
return _propagateInheritableProperties(style, child, inheritableCssProperties);
|
|
1025
|
+
}
|
|
1227
1026
|
export function propagateInheritableProperties(view, child) {
|
|
1228
|
-
|
|
1027
|
+
return _propagateInheritableProperties(view, child, inheritableProperties);
|
|
1028
|
+
}
|
|
1029
|
+
function _propagateInheritableProperties(view, child, properties) {
|
|
1030
|
+
const inheritablePropertyValues = inheritablePropertyValuesOn(view, properties);
|
|
1229
1031
|
for (const pair of inheritablePropertyValues) {
|
|
1230
1032
|
const prop = pair.property;
|
|
1231
1033
|
const sourceKey = prop.sourceKey;
|
|
@@ -1235,17 +1037,6 @@ export function propagateInheritableProperties(view, child) {
|
|
|
1235
1037
|
}
|
|
1236
1038
|
}
|
|
1237
1039
|
}
|
|
1238
|
-
export function propagateInheritableCssProperties(parentStyle, childStyle) {
|
|
1239
|
-
const inheritableCssPropertyValues = inheritableCssPropertyValuesOn(parentStyle);
|
|
1240
|
-
for (const pair of inheritableCssPropertyValues) {
|
|
1241
|
-
const prop = pair.property;
|
|
1242
|
-
const sourceKey = prop.sourceKey;
|
|
1243
|
-
const currentValueSource = childStyle[sourceKey] || 0 /* Default */;
|
|
1244
|
-
if (currentValueSource <= 1 /* Inherited */) {
|
|
1245
|
-
prop.setInheritedValue.call(childStyle, pair.value, 1 /* Inherited */);
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
1040
|
export function makeValidator(...values) {
|
|
1250
1041
|
const set = new Set(values);
|
|
1251
1042
|
return (value) => set.has(value);
|