@nativescript/core 8.2.0-custom.1 → 8.2.1

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.
Files changed (213) hide show
  1. package/accessibility/accessibility-service.android.js +11 -9
  2. package/accessibility/accessibility-service.android.js.map +1 -1
  3. package/accessibility/index.android.js +16 -15
  4. package/accessibility/index.android.js.map +1 -1
  5. package/application/application-common.d.ts +2 -0
  6. package/application/application-common.js +2 -0
  7. package/application/application-common.js.map +1 -1
  8. package/application/index.android.d.ts +14 -1
  9. package/application/index.android.js +36 -2
  10. package/application/index.android.js.map +1 -1
  11. package/application/index.d.ts +37 -0
  12. package/application/index.ios.d.ts +7 -1
  13. package/application/index.ios.js +63 -14
  14. package/application/index.ios.js.map +1 -1
  15. package/color/color-common.js +4 -2
  16. package/color/color-common.js.map +1 -1
  17. package/config/config.interface.d.ts +9 -1
  18. package/connectivity/index.ios.js +1 -0
  19. package/connectivity/index.ios.js.map +1 -1
  20. package/css/parser.js +0 -1
  21. package/css/parser.js.map +1 -1
  22. package/debugger/webinspector-network.ios.js.map +1 -1
  23. package/file-system/file-system-access.android.d.ts +57 -1
  24. package/file-system/file-system-access.android.js +293 -0
  25. package/file-system/file-system-access.android.js.map +1 -1
  26. package/file-system/file-system-access.d.ts +73 -1
  27. package/file-system/index.js +18 -16
  28. package/file-system/index.js.map +1 -1
  29. package/global-types.d.ts +1 -0
  30. package/image-asset/index.ios.js +7 -12
  31. package/image-asset/index.ios.js.map +1 -1
  32. package/image-source/index.ios.js +20 -17
  33. package/image-source/index.ios.js.map +1 -1
  34. package/index.d.ts +8 -4
  35. package/index.js +14 -4
  36. package/index.js.map +1 -1
  37. package/module-name-resolver/qualifier-matcher/index.js +6 -4
  38. package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
  39. package/package.json +44 -29
  40. package/platforms/android/res/values/ids.xml +4 -0
  41. package/platforms/android/widgets-release.aar +0 -0
  42. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
  43. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
  44. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  45. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
  46. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
  47. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +1 -1
  48. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  49. package/platforms/ios/src/NativeScriptUtils.h +16 -0
  50. package/platforms/ios/src/NativeScriptUtils.m +134 -0
  51. package/platforms/ios/src/UIView+NativeScript.h +13 -0
  52. package/platforms/ios/src/UIView+NativeScript.m +127 -0
  53. package/platforms/ios/src/module.modulemap +10 -0
  54. package/platforms/ios/typings/objc!NativeScriptUtils.d.ts +19 -0
  55. package/references.d.ts +5 -1
  56. package/ui/action-bar/index.android.d.ts +2 -0
  57. package/ui/action-bar/index.android.js +30 -1
  58. package/ui/action-bar/index.android.js.map +1 -1
  59. package/ui/animation/index.android.js +40 -62
  60. package/ui/animation/index.android.js.map +1 -1
  61. package/ui/animation/index.ios.js +10 -1
  62. package/ui/animation/index.ios.js.map +1 -1
  63. package/ui/animation/keyframe-animation.js +1 -2
  64. package/ui/animation/keyframe-animation.js.map +1 -1
  65. package/ui/builder/binding-builder.js +1 -1
  66. package/ui/builder/binding-builder.js.map +1 -1
  67. package/ui/button/button-common.js.map +1 -1
  68. package/ui/button/index.android.d.ts +2 -0
  69. package/ui/button/index.android.js +26 -0
  70. package/ui/button/index.android.js.map +1 -1
  71. package/ui/core/bindable/bindable-expressions.d.ts +7 -0
  72. package/ui/core/bindable/bindable-expressions.js +257 -0
  73. package/ui/core/bindable/bindable-expressions.js.map +1 -0
  74. package/ui/core/bindable/index.js +41 -33
  75. package/ui/core/bindable/index.js.map +1 -1
  76. package/ui/core/view/index.android.d.ts +5 -0
  77. package/ui/core/view/index.android.js +112 -9
  78. package/ui/core/view/index.android.js.map +1 -1
  79. package/ui/core/view/index.d.ts +10 -2
  80. package/ui/core/view/index.ios.d.ts +1 -0
  81. package/ui/core/view/index.ios.js +17 -3
  82. package/ui/core/view/index.ios.js.map +1 -1
  83. package/ui/core/view/view-common.d.ts +9 -2
  84. package/ui/core/view/view-common.js +47 -1
  85. package/ui/core/view/view-common.js.map +1 -1
  86. package/ui/core/view-base/index.d.ts +10 -0
  87. package/ui/core/view-base/index.js +5 -1
  88. package/ui/core/view-base/index.js.map +1 -1
  89. package/ui/date-picker/date-picker-common.d.ts +8 -0
  90. package/ui/date-picker/date-picker-common.js +25 -0
  91. package/ui/date-picker/date-picker-common.js.map +1 -1
  92. package/ui/date-picker/index.android.d.ts +2 -0
  93. package/ui/date-picker/index.android.js +30 -3
  94. package/ui/date-picker/index.android.js.map +1 -1
  95. package/ui/date-picker/index.ios.js +49 -8
  96. package/ui/date-picker/index.ios.js.map +1 -1
  97. package/ui/frame/fragment.android.js +3 -0
  98. package/ui/frame/fragment.android.js.map +1 -1
  99. package/ui/frame/fragment.transitions.android.d.ts +1 -0
  100. package/ui/frame/fragment.transitions.android.js +25 -28
  101. package/ui/frame/fragment.transitions.android.js.map +1 -1
  102. package/ui/frame/fragment.transitions.ios.js +3 -3
  103. package/ui/frame/frame-common.js.map +1 -1
  104. package/ui/frame/index.android.d.ts +1 -0
  105. package/ui/frame/index.android.js +45 -5
  106. package/ui/frame/index.android.js.map +1 -1
  107. package/ui/frame/index.d.ts +1 -0
  108. package/ui/frame/index.ios.js +8 -8
  109. package/ui/gestures/gestures-common.d.ts +6 -0
  110. package/ui/gestures/gestures-common.js +7 -0
  111. package/ui/gestures/gestures-common.js.map +1 -1
  112. package/ui/gestures/index.android.js +16 -6
  113. package/ui/gestures/index.android.js.map +1 -1
  114. package/ui/gestures/index.d.ts +21 -0
  115. package/ui/gestures/index.ios.js +9 -2
  116. package/ui/gestures/index.ios.js.map +1 -1
  117. package/ui/gestures/touch-manager.d.ts +53 -0
  118. package/ui/gestures/touch-manager.js +205 -0
  119. package/ui/gestures/touch-manager.js.map +1 -0
  120. package/ui/image/image-common.d.ts +1 -0
  121. package/ui/image/image-common.js +4 -0
  122. package/ui/image/image-common.js.map +1 -1
  123. package/ui/image/index.ios.d.ts +2 -0
  124. package/ui/image/index.ios.js +64 -27
  125. package/ui/image/index.ios.js.map +1 -1
  126. package/ui/index.d.ts +2 -2
  127. package/ui/index.js +1 -1
  128. package/ui/index.js.map +1 -1
  129. package/ui/layouts/root-layout/index.android.js +17 -2
  130. package/ui/layouts/root-layout/index.android.js.map +1 -1
  131. package/ui/layouts/root-layout/index.d.ts +2 -0
  132. package/ui/layouts/root-layout/index.ios.d.ts +3 -0
  133. package/ui/layouts/root-layout/index.ios.js +30 -9
  134. package/ui/layouts/root-layout/index.ios.js.map +1 -1
  135. package/ui/layouts/root-layout/root-layout-common.d.ts +5 -2
  136. package/ui/layouts/root-layout/root-layout-common.js +76 -62
  137. package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
  138. package/ui/list-view/list-view-common.js.map +1 -1
  139. package/ui/page/page-common.js.map +1 -1
  140. package/ui/placeholder/index.android.js.map +1 -1
  141. package/ui/repeater/index.js.map +1 -1
  142. package/ui/scroll-view/index.android.js +2 -1
  143. package/ui/scroll-view/index.android.js.map +1 -1
  144. package/ui/scroll-view/scroll-view-common.js.map +1 -1
  145. package/ui/search-bar/search-bar-common.js.map +1 -1
  146. package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
  147. package/ui/slider/slider-common.js.map +1 -1
  148. package/ui/styling/background-common.d.ts +1 -2
  149. package/ui/styling/background-common.js.map +1 -1
  150. package/ui/styling/background.android.d.ts +1 -3
  151. package/ui/styling/background.android.js +2 -124
  152. package/ui/styling/background.android.js.map +1 -1
  153. package/ui/styling/background.d.ts +60 -56
  154. package/ui/styling/background.ios.js +3 -34
  155. package/ui/styling/background.ios.js.map +1 -1
  156. package/ui/styling/css-animation-parser.js +1 -1
  157. package/ui/styling/css-animation-parser.js.map +1 -1
  158. package/ui/styling/css-selector/index.js +2 -2
  159. package/ui/styling/css-selector/index.js.map +1 -1
  160. package/ui/styling/font-common.js +5 -10
  161. package/ui/styling/font-common.js.map +1 -1
  162. package/ui/styling/font.ios.js +9 -91
  163. package/ui/styling/font.ios.js.map +1 -1
  164. package/ui/styling/linear-gradient.d.ts +7 -2
  165. package/ui/styling/linear-gradient.js.map +1 -1
  166. package/ui/styling/style-properties.js +3 -3
  167. package/ui/styling/style-properties.js.map +1 -1
  168. package/ui/switch/index.android.js +5 -2
  169. package/ui/switch/index.android.js.map +1 -1
  170. package/ui/switch/index.ios.d.ts +2 -0
  171. package/ui/switch/index.ios.js +61 -7
  172. package/ui/switch/index.ios.js.map +1 -1
  173. package/ui/switch/switch-common.js +6 -1
  174. package/ui/switch/switch-common.js.map +1 -1
  175. package/ui/tab-view/index.android.d.ts +1 -0
  176. package/ui/tab-view/index.android.js +23 -3
  177. package/ui/tab-view/index.android.js.map +1 -1
  178. package/ui/tab-view/index.d.ts +9 -0
  179. package/ui/tab-view/index.ios.d.ts +13 -3
  180. package/ui/tab-view/index.ios.js +47 -40
  181. package/ui/tab-view/index.ios.js.map +1 -1
  182. package/ui/tab-view/tab-view-common.d.ts +2 -0
  183. package/ui/tab-view/tab-view-common.js +2 -0
  184. package/ui/tab-view/tab-view-common.js.map +1 -1
  185. package/ui/text-base/index.android.js +19 -13
  186. package/ui/text-base/index.android.js.map +1 -1
  187. package/ui/text-base/index.ios.d.ts +7 -6
  188. package/ui/text-base/index.ios.js +69 -193
  189. package/ui/text-base/index.ios.js.map +1 -1
  190. package/ui/text-field/index.android.js +1 -1
  191. package/ui/text-field/index.android.js.map +1 -1
  192. package/ui/text-field/text-field-common.js.map +1 -1
  193. package/ui/time-picker/index.ios.js +1 -1
  194. package/ui/time-picker/index.ios.js.map +1 -1
  195. package/ui/utils.d.ts +31 -1
  196. package/ui/utils.ios.d.ts +16 -0
  197. package/ui/utils.ios.js +41 -0
  198. package/ui/utils.ios.js.map +1 -1
  199. package/ui/web-view/web-view-common.js.map +1 -1
  200. package/utils/index.d.ts +21 -0
  201. package/utils/native-helper.android.js +7 -1
  202. package/utils/native-helper.android.js.map +1 -1
  203. package/utils/utils-common.d.ts +3 -0
  204. package/utils/utils-common.js +30 -0
  205. package/utils/utils-common.js.map +1 -1
  206. package/js-libs/esprima/esprima.d.ts +0 -266
  207. package/js-libs/esprima/esprima.js +0 -1042
  208. package/js-libs/esprima/package.json +0 -75
  209. package/js-libs/polymer-expressions/package.json +0 -6
  210. package/js-libs/polymer-expressions/path-parser.js +0 -393
  211. package/js-libs/polymer-expressions/polymer-expressions.d.ts +0 -14
  212. package/js-libs/polymer-expressions/polymer-expressions.js +0 -541
  213. package/ui/styling/gradient.d.ts +0 -17
@@ -1,541 +0,0 @@
1
- // Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
2
- // This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
3
- // The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
4
- // The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
5
- // Code distributed by Google as part of the polymer project is also
6
- // subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
7
-
8
- // Hack to resolve https://github.com/webpack/enhanced-resolve/issues/197 .
9
- // This issue causes an require like this (`../esprima`) to be resolved to (`esprima`) by the Angular webpack plugin
10
- var esprima = require("../../js-libs/esprima").esprima;
11
-
12
- var Path = require("./path-parser").Path;
13
-
14
- (function (global) {
15
- 'use strict';
16
-
17
- // TODO(rafaelw): Implement simple LRU.
18
- var expressionParseCache = Object.create(null);
19
-
20
- function getExpression(expressionText) {
21
- var expression = expressionParseCache[expressionText];
22
- if (!expression) {
23
- var delegate = new ASTDelegate();
24
- esprima.parse(expressionText, delegate);
25
- expression = new Expression(delegate);
26
- expressionParseCache[expressionText] = expression;
27
- }
28
- return expression;
29
- }
30
-
31
- function Literal(value) {
32
- this.value = value;
33
- this.valueFn_ = undefined;
34
- }
35
-
36
- Literal.prototype = {
37
- valueFn: function () {
38
- if (!this.valueFn_) {
39
- var value = this.value;
40
- this.valueFn_ = function () {
41
- return value;
42
- }
43
- }
44
-
45
- return this.valueFn_;
46
- }
47
- }
48
-
49
- function IdentPath(name) {
50
- this.name = name;
51
- this.path = Path.get(name);
52
- }
53
-
54
- IdentPath.prototype = {
55
- valueFn: function () {
56
- if (!this.valueFn_) {
57
- var name = this.name;
58
- var path = this.path;
59
- this.valueFn_ = function (model, observer, changedModel) {
60
- if (observer)
61
- observer.addPath(model, path);
62
-
63
- if (changedModel) {
64
- var result = path.getValueFrom(changedModel);
65
- if (result !== undefined) {
66
- return result;
67
- }
68
- }
69
-
70
- return path.getValueFrom(model);
71
- }
72
- }
73
-
74
- return this.valueFn_;
75
- },
76
-
77
- setValue: function (model, newValue) {
78
- if (this.path.length == 1) {
79
- model = findScope(model, this.path[0]);
80
- }
81
-
82
- return this.path.setValueFrom(model, newValue);
83
- }
84
- };
85
-
86
- function MemberExpression(object, property, accessor) {
87
- this.computed = accessor == '[';
88
-
89
- this.dynamicDeps = typeof object == 'function' ||
90
- object.dynamicDeps ||
91
- (this.computed && !(property instanceof Literal));
92
-
93
- this.simplePath =
94
- !this.dynamicDeps &&
95
- (property instanceof IdentPath || property instanceof Literal) &&
96
- (object instanceof MemberExpression || object instanceof IdentPath);
97
-
98
- this.object = this.simplePath ? object : getFn(object);
99
- this.property = !this.computed || this.simplePath ?
100
- property : getFn(property);
101
- }
102
-
103
- MemberExpression.prototype = {
104
- get fullPath() {
105
- if (!this.fullPath_) {
106
-
107
- var parts = this.object instanceof MemberExpression ?
108
- this.object.fullPath.slice() : [this.object.name];
109
- parts.push(this.property instanceof IdentPath ?
110
- this.property.name : this.property.value);
111
- this.fullPath_ = Path.get(parts);
112
- }
113
-
114
- return this.fullPath_;
115
- },
116
-
117
- valueFn: function () {
118
- if (!this.valueFn_) {
119
- var object = this.object;
120
-
121
- if (this.simplePath) {
122
- var path = this.fullPath;
123
-
124
- this.valueFn_ = function (model, observer) {
125
- if (observer)
126
- observer.addPath(model, path);
127
-
128
- return path.getValueFrom(model);
129
- };
130
- } else if (!this.computed) {
131
- var path = Path.get(this.property.name);
132
-
133
- this.valueFn_ = function (model, observer, filterRegistry) {
134
- var context = object(model, observer, filterRegistry);
135
-
136
- if (observer)
137
- observer.addPath(context, path);
138
-
139
- return path.getValueFrom(context);
140
- }
141
- } else {
142
- // Computed property.
143
- var property = this.property;
144
-
145
- this.valueFn_ = function (model, observer, filterRegistry) {
146
- var context = object(model, observer, filterRegistry);
147
- var propName = property(model, observer, filterRegistry);
148
- if (observer)
149
- observer.addPath(context, [propName]);
150
-
151
- return context ? context[propName] : undefined;
152
- };
153
- }
154
- }
155
- return this.valueFn_;
156
- },
157
-
158
- setValue: function (model, newValue) {
159
- if (this.simplePath) {
160
- this.fullPath.setValueFrom(model, newValue);
161
- return newValue;
162
- }
163
-
164
- var object = this.object(model);
165
- var propName = this.property instanceof IdentPath ? this.property.name :
166
- this.property(model);
167
- return object[propName] = newValue;
168
- }
169
- };
170
-
171
- function Filter(name, args) {
172
- this.name = name;
173
- this.args = [];
174
- for (var i = 0; i < args.length; i++) {
175
- this.args[i] = getFn(args[i]);
176
- }
177
- }
178
-
179
- Filter.prototype = {
180
- transform: function (model, observer, filterRegistry, toModelDirection,
181
- initialArgs) {
182
- var fn = filterRegistry[this.name];
183
- var context = model;
184
- if (fn) {
185
- context = undefined;
186
- } else {
187
- fn = context[this.name];
188
- if (!fn) {
189
- console.error('Cannot find function or filter: ' + this.name);
190
- return;
191
- }
192
- }
193
-
194
- // If toModelDirection is falsey, then the "normal" (dom-bound) direction
195
- // is used. Otherwise, it looks for a 'toModel' property function on the
196
- // object.
197
- if (toModelDirection) {
198
- fn = fn.toModel;
199
- } else if (typeof fn.toView == 'function') {
200
- fn = fn.toView;
201
- }
202
-
203
- if (typeof fn != 'function') {
204
- console.error('Cannot find function or filter: ' + this.name);
205
- return;
206
- }
207
-
208
- var args = initialArgs || [];
209
- for (var i = 0; i < this.args.length; i++) {
210
- args.push(getFn(this.args[i])(model, observer, filterRegistry));
211
- }
212
-
213
- return fn.apply(context, args);
214
- }
215
- };
216
-
217
- function notImplemented() { throw Error('Not Implemented'); }
218
-
219
- var unaryOperators = {
220
- '+': function (v) { return +v; },
221
- '-': function (v) { return -v; },
222
- '!': function (v) { return !v; }
223
- };
224
-
225
- var binaryOperators = {
226
- '+': function (l, r) { return l + r; },
227
- '-': function (l, r) { return l - r; },
228
- '*': function (l, r) { return l * r; },
229
- '/': function (l, r) { return l / r; },
230
- '%': function (l, r) { return l % r; },
231
- '<': function (l, r) { return l < r; },
232
- '>': function (l, r) { return l > r; },
233
- '<=': function (l, r) { return l <= r; },
234
- '>=': function (l, r) { return l >= r; },
235
- '==': function (l, r) { return l == r; },
236
- '!=': function (l, r) { return l != r; },
237
- '===': function (l, r) { return l === r; },
238
- '!==': function (l, r) { return l !== r; },
239
- '&&': function (l, r) { return l && r; },
240
- '||': function (l, r) { return l || r; },
241
- };
242
-
243
- function getFn(arg) {
244
- return typeof arg == 'function' ? arg : arg.valueFn();
245
- }
246
-
247
- function ASTDelegate() {
248
- this.expression = null;
249
- this.filters = [];
250
- this.deps = {};
251
- this.currentPath = undefined;
252
- this.scopeIdent = undefined;
253
- this.indexIdent = undefined;
254
- this.dynamicDeps = false;
255
- }
256
-
257
- ASTDelegate.prototype = {
258
- createUnaryExpression: function (op, argument) {
259
- if (!unaryOperators[op])
260
- throw Error('Disallowed operator: ' + op);
261
-
262
- argument = getFn(argument);
263
-
264
- return function (model, observer, filterRegistry) {
265
- return unaryOperators[op](argument(model, observer, filterRegistry));
266
- };
267
- },
268
-
269
- createBinaryExpression: function (op, left, right) {
270
- if (!binaryOperators[op])
271
- throw Error('Disallowed operator: ' + op);
272
-
273
- left = getFn(left);
274
- right = getFn(right);
275
-
276
- switch (op) {
277
- case '||':
278
- this.dynamicDeps = true;
279
- return function (model, observer, filterRegistry) {
280
- return left(model, observer, filterRegistry) ||
281
- right(model, observer, filterRegistry);
282
- };
283
- case '&&':
284
- this.dynamicDeps = true;
285
- return function (model, observer, filterRegistry) {
286
- return left(model, observer, filterRegistry) &&
287
- right(model, observer, filterRegistry);
288
- };
289
- }
290
-
291
- return function (model, observer, filterRegistry) {
292
- return binaryOperators[op](left(model, observer, filterRegistry),
293
- right(model, observer, filterRegistry));
294
- };
295
- },
296
-
297
- createConditionalExpression: function (test, consequent, alternate) {
298
- test = getFn(test);
299
- consequent = getFn(consequent);
300
- alternate = getFn(alternate);
301
-
302
- this.dynamicDeps = true;
303
-
304
- return function (model, observer, filterRegistry) {
305
- return test(model, observer, filterRegistry) ?
306
- consequent(model, observer, filterRegistry) :
307
- alternate(model, observer, filterRegistry);
308
- }
309
- },
310
-
311
- createIdentifier: function (name) {
312
- var ident = new IdentPath(name);
313
- ident.type = 'Identifier';
314
- return ident;
315
- },
316
-
317
- createMemberExpression: function (accessor, object, property) {
318
- var ex = new MemberExpression(object, property, accessor);
319
- if (ex.dynamicDeps)
320
- this.dynamicDeps = true;
321
- return ex;
322
- },
323
-
324
- createCallExpression: function (expression, args) {
325
- if (!(expression instanceof IdentPath))
326
- throw Error('Only identifier function invocations are allowed');
327
-
328
- var filter = new Filter(expression.name, args);
329
-
330
- return function (model, observer, filterRegistry) {
331
- return filter.transform(model, observer, filterRegistry, false);
332
- };
333
- },
334
-
335
- createLiteral: function (token) {
336
- return new Literal(token.value);
337
- },
338
-
339
- createArrayExpression: function (elements) {
340
- for (var i = 0; i < elements.length; i++)
341
- elements[i] = getFn(elements[i]);
342
-
343
- return function (model, observer, filterRegistry) {
344
- var arr = []
345
- for (var i = 0; i < elements.length; i++)
346
- arr.push(elements[i](model, observer, filterRegistry));
347
- return arr;
348
- }
349
- },
350
-
351
- createProperty: function (kind, key, value) {
352
- return {
353
- key: key instanceof IdentPath ? key.name : key.value,
354
- value: value
355
- };
356
- },
357
-
358
- createObjectExpression: function (properties) {
359
- for (var i = 0; i < properties.length; i++)
360
- properties[i].value = getFn(properties[i].value);
361
-
362
- return function (model, observer, filterRegistry) {
363
- var obj = {};
364
- for (var i = 0; i < properties.length; i++)
365
- obj[properties[i].key] =
366
- properties[i].value(model, observer, filterRegistry);
367
- return obj;
368
- }
369
- },
370
-
371
- createFilter: function (name, args) {
372
- this.filters.push(new Filter(name, args));
373
- },
374
-
375
- createAsExpression: function (expression, scopeIdent) {
376
- this.expression = expression;
377
- this.scopeIdent = scopeIdent;
378
- },
379
-
380
- createInExpression: function (scopeIdent, indexIdent, expression) {
381
- this.expression = expression;
382
- this.scopeIdent = scopeIdent;
383
- this.indexIdent = indexIdent;
384
- },
385
-
386
- createTopLevel: function (expression) {
387
- this.expression = expression;
388
- },
389
-
390
- createThisExpression: notImplemented
391
- }
392
-
393
- function Expression(delegate) {
394
- this.scopeIdent = delegate.scopeIdent;
395
- this.indexIdent = delegate.indexIdent;
396
-
397
- if (!delegate.expression)
398
- throw Error('No expression found.');
399
-
400
- this.expression = delegate.expression;
401
- getFn(this.expression); // forces enumeration of path dependencies
402
-
403
- this.filters = delegate.filters;
404
- this.dynamicDeps = delegate.dynamicDeps;
405
- }
406
-
407
- Expression.prototype = {
408
- getValue: function (model, isBackConvert, changedModel, observer) {
409
- var value = getFn(this.expression)(model.context, observer, changedModel);
410
- for (var i = 0; i < this.filters.length; i++) {
411
- value = this.filters[i].transform(model.context, observer, model.context, isBackConvert, [value]);
412
- }
413
-
414
- return value;
415
- },
416
-
417
- setValue: function (model, newValue, filterRegistry) {
418
- var count = this.filters ? this.filters.length : 0;
419
- while (count-- > 0) {
420
- newValue = this.filters[count].transform(model, undefined,
421
- filterRegistry, true, [newValue]);
422
- }
423
-
424
- if (this.expression.setValue)
425
- return this.expression.setValue(model, newValue);
426
- }
427
- }
428
-
429
- /**
430
- * Converts a style property name to a css property name. For example:
431
- * "WebkitUserSelect" to "-webkit-user-select"
432
- */
433
- function convertStylePropertyName(name) {
434
- return String(name).replace(/[A-Z]/g, function (c) {
435
- return '-' + c.toLowerCase();
436
- });
437
- }
438
-
439
- var parentScopeName = '@' + Math.random().toString(36).slice(2);
440
-
441
- // Single ident paths must bind directly to the appropriate scope object.
442
- // I.e. Pushed values in two-bindings need to be assigned to the actual model
443
- // object.
444
- function findScope(model, prop) {
445
- while (model[parentScopeName] &&
446
- !Object.prototype.hasOwnProperty.call(model, prop)) {
447
- model = model[parentScopeName];
448
- }
449
-
450
- return model;
451
- }
452
-
453
- function isLiteralExpression(pathString) {
454
- switch (pathString) {
455
- case '':
456
- return false;
457
-
458
- case 'false':
459
- case 'null':
460
- case 'true':
461
- return true;
462
- }
463
-
464
- if (!isNaN(Number(pathString)))
465
- return true;
466
-
467
- return false;
468
- };
469
-
470
- function PolymerExpressions() { }
471
-
472
- PolymerExpressions.prototype = {
473
- // "built-in" filters
474
- styleObject: function (value) {
475
- var parts = [];
476
- for (var key in value) {
477
- parts.push(convertStylePropertyName(key) + ': ' + value[key]);
478
- }
479
- return parts.join('; ');
480
- },
481
-
482
- tokenList: function (value) {
483
- var tokens = [];
484
- for (var key in value) {
485
- if (value[key])
486
- tokens.push(key);
487
- }
488
- return tokens.join(' ');
489
- },
490
-
491
- // binding delegate API
492
- prepareInstancePositionChanged: function (template) {
493
- var indexIdent = template.polymerExpressionIndexIdent_;
494
- if (!indexIdent)
495
- return;
496
-
497
- return function (templateInstance, index) {
498
- templateInstance.model[indexIdent] = index;
499
- };
500
- },
501
-
502
- prepareInstanceModel: function (template) {
503
- var scopeName = template.polymerExpressionScopeIdent_;
504
- if (!scopeName)
505
- return;
506
-
507
- var parentScope = template.templateInstance ?
508
- template.templateInstance.model :
509
- template.model;
510
-
511
- var indexName = template.polymerExpressionIndexIdent_;
512
-
513
- return function (model) {
514
- return createScopeObject(parentScope, model, scopeName, indexName);
515
- };
516
- }
517
- };
518
-
519
- var createScopeObject = ('__proto__' in {}) ?
520
- function (parentScope, model, scopeName, indexName) {
521
- var scope = {};
522
- scope[scopeName] = model;
523
- scope[indexName] = undefined;
524
- scope[parentScopeName] = parentScope;
525
- scope.__proto__ = parentScope;
526
- return scope;
527
- } :
528
- function (parentScope, model, scopeName, indexName) {
529
- var scope = Object.create(parentScope);
530
- Object.defineProperty(scope, scopeName,
531
- { value: model, configurable: true, writable: true });
532
- Object.defineProperty(scope, indexName,
533
- { value: undefined, configurable: true, writable: true });
534
- Object.defineProperty(scope, parentScopeName,
535
- { value: parentScope, configurable: true, writable: true });
536
- return scope;
537
- };
538
-
539
- global.PolymerExpressions = PolymerExpressions;
540
- PolymerExpressions.getExpression = getExpression;
541
- })(module.exports);
@@ -1,17 +0,0 @@
1
- import { CoreTypes } from '../../core-types';
2
- import { Color } from '../../color';
3
- import { LinearGradient as LinearGradientDefinition } from '../../css/parser';
4
-
5
- export class LinearGradient {
6
- public angle: number;
7
- public colorStops: ColorStop[];
8
-
9
- public static parse(value: LinearGradientDefinition): LinearGradientDefinition;
10
-
11
- public static equals(first: LinearGradientDefinition, second: LinearGradientDefinition): boolean;
12
- }
13
-
14
- export interface ColorStop {
15
- color: Color;
16
- offset?: CoreTypes.LengthPercentUnit;
17
- }