OLD | NEW |
(Empty) | |
| 1 dart_library.library('dart/html_common', null, /* Imports */[ |
| 2 "dart/_runtime", |
| 3 'dart/_metadata', |
| 4 'dart/core', |
| 5 'dart/html', |
| 6 'dart/typed_data', |
| 7 'dart/_js_helper', |
| 8 'dart/_native_typed_data', |
| 9 'dart/async', |
| 10 'dart/collection', |
| 11 'dart/_internal' |
| 12 ], /* Lazy imports */[ |
| 13 ], function(exports, dart, _metadata, core, html, typed_data, _js_helper, _nativ
e_typed_data, async, collection, _internal) { |
| 14 'use strict'; |
| 15 let dartx = dart.dartx; |
| 16 dart.export_(exports, _metadata); |
| 17 const _validateToken = Symbol('_validateToken'); |
| 18 class CssClassSetImpl extends core.Object { |
| 19 [_validateToken](value) { |
| 20 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) |
| 21 return value; |
| 22 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class
token')); |
| 23 } |
| 24 toString() { |
| 25 return this.readClasses().join(' '); |
| 26 } |
| 27 toggle(value, shouldAdd) { |
| 28 if (shouldAdd === void 0) |
| 29 shouldAdd = null; |
| 30 this[_validateToken](value); |
| 31 let s = this.readClasses(); |
| 32 let result = false; |
| 33 if (shouldAdd == null) |
| 34 shouldAdd = !dart.notNull(s.contains(value)); |
| 35 if (dart.notNull(shouldAdd)) { |
| 36 s.add(value); |
| 37 result = true; |
| 38 } else { |
| 39 s.remove(value); |
| 40 } |
| 41 this.writeClasses(s); |
| 42 return result; |
| 43 } |
| 44 get frozen() { |
| 45 return false; |
| 46 } |
| 47 get iterator() { |
| 48 return this.readClasses().iterator; |
| 49 } |
| 50 [Symbol.iterator]() { |
| 51 return new dart.JsIterator(this.iterator); |
| 52 } |
| 53 forEach(f) { |
| 54 this.readClasses().forEach(f); |
| 55 } |
| 56 join(separator) { |
| 57 if (separator === void 0) |
| 58 separator = ""; |
| 59 return this.readClasses().join(separator); |
| 60 } |
| 61 map(f) { |
| 62 return this.readClasses().map(f); |
| 63 } |
| 64 where(f) { |
| 65 return this.readClasses().where(f); |
| 66 } |
| 67 expand(f) { |
| 68 return this.readClasses().expand(f); |
| 69 } |
| 70 every(f) { |
| 71 return this.readClasses().every(f); |
| 72 } |
| 73 any(f) { |
| 74 return this.readClasses().any(f); |
| 75 } |
| 76 get isEmpty() { |
| 77 return this.readClasses().isEmpty; |
| 78 } |
| 79 get isNotEmpty() { |
| 80 return this.readClasses().isNotEmpty; |
| 81 } |
| 82 get length() { |
| 83 return this.readClasses().length; |
| 84 } |
| 85 reduce(combine) { |
| 86 return this.readClasses().reduce(combine); |
| 87 } |
| 88 fold(initialValue, combine) { |
| 89 return this.readClasses().fold(initialValue, combine); |
| 90 } |
| 91 contains(value) { |
| 92 if (!(typeof value == 'string')) |
| 93 return false; |
| 94 this[_validateToken](dart.as(value, core.String)); |
| 95 return this.readClasses().contains(value); |
| 96 } |
| 97 lookup(value) { |
| 98 return dart.as(dart.notNull(this.contains(value)) ? value : null, core.Str
ing); |
| 99 } |
| 100 add(value) { |
| 101 this[_validateToken](value); |
| 102 return dart.as(this.modify(dart.fn(s => dart.dsend(s, 'add', value))), cor
e.bool); |
| 103 } |
| 104 remove(value) { |
| 105 this[_validateToken](dart.as(value, core.String)); |
| 106 if (!(typeof value == 'string')) |
| 107 return false; |
| 108 let s = this.readClasses(); |
| 109 let result = s.remove(value); |
| 110 this.writeClasses(s); |
| 111 return result; |
| 112 } |
| 113 addAll(iterable) { |
| 114 this.modify(dart.fn((s => dart.dsend(s, 'addAll', iterable[dartx.map](dart
.bind(this, _validateToken)))).bind(this))); |
| 115 } |
| 116 removeAll(iterable) { |
| 117 this.modify(dart.fn((s => dart.dsend(s, 'removeAll', iterable[dartx.map](d
art.as(dart.bind(this, _validateToken), __CastType0)))).bind(this))); |
| 118 } |
| 119 toggleAll(iterable, shouldAdd) { |
| 120 if (shouldAdd === void 0) |
| 121 shouldAdd = null; |
| 122 iterable[dartx.forEach](dart.fn((e => this.toggle(dart.as(e, core.String),
shouldAdd)).bind(this), core.bool, [dart.dynamic])); |
| 123 } |
| 124 retainAll(iterable) { |
| 125 this.modify(dart.fn(s => dart.dsend(s, 'retainAll', iterable))); |
| 126 } |
| 127 removeWhere(test) { |
| 128 this.modify(dart.fn(s => dart.dsend(s, 'removeWhere', test))); |
| 129 } |
| 130 retainWhere(test) { |
| 131 this.modify(dart.fn(s => dart.dsend(s, 'retainWhere', test))); |
| 132 } |
| 133 containsAll(collection) { |
| 134 return this.readClasses().containsAll(collection); |
| 135 } |
| 136 intersection(other) { |
| 137 return this.readClasses().intersection(other); |
| 138 } |
| 139 union(other) { |
| 140 return this.readClasses().union(other); |
| 141 } |
| 142 difference(other) { |
| 143 return this.readClasses().difference(other); |
| 144 } |
| 145 get first() { |
| 146 return this.readClasses().first; |
| 147 } |
| 148 get last() { |
| 149 return this.readClasses().last; |
| 150 } |
| 151 get single() { |
| 152 return this.readClasses().single; |
| 153 } |
| 154 toList(opts) { |
| 155 let growable = opts && 'growable' in opts ? opts.growable : true; |
| 156 return this.readClasses().toList({growable: growable}); |
| 157 } |
| 158 toSet() { |
| 159 return this.readClasses().toSet(); |
| 160 } |
| 161 take(n) { |
| 162 return this.readClasses().take(n); |
| 163 } |
| 164 takeWhile(test) { |
| 165 return this.readClasses().takeWhile(test); |
| 166 } |
| 167 skip(n) { |
| 168 return this.readClasses().skip(n); |
| 169 } |
| 170 skipWhile(test) { |
| 171 return this.readClasses().skipWhile(test); |
| 172 } |
| 173 firstWhere(test, opts) { |
| 174 let orElse = opts && 'orElse' in opts ? opts.orElse : null; |
| 175 return this.readClasses().firstWhere(test, {orElse: orElse}); |
| 176 } |
| 177 lastWhere(test, opts) { |
| 178 let orElse = opts && 'orElse' in opts ? opts.orElse : null; |
| 179 return this.readClasses().lastWhere(test, {orElse: orElse}); |
| 180 } |
| 181 singleWhere(test) { |
| 182 return this.readClasses().singleWhere(test); |
| 183 } |
| 184 elementAt(index) { |
| 185 return this.readClasses().elementAt(index); |
| 186 } |
| 187 clear() { |
| 188 this.modify(dart.fn(s => dart.dsend(s, 'clear'))); |
| 189 } |
| 190 modify(f) { |
| 191 let s = this.readClasses(); |
| 192 let ret = f(s); |
| 193 this.writeClasses(s); |
| 194 return ret; |
| 195 } |
| 196 } |
| 197 CssClassSetImpl[dart.implements] = () => [html.CssClassSet]; |
| 198 dart.setSignature(CssClassSetImpl, { |
| 199 methods: () => ({ |
| 200 [_validateToken]: [core.String, [core.String]], |
| 201 toggle: [core.bool, [core.String], [core.bool]], |
| 202 forEach: [dart.void, [dart.functionType(dart.void, [core.String])]], |
| 203 join: [core.String, [], [core.String]], |
| 204 map: [core.Iterable, [dart.functionType(dart.dynamic, [core.String])]], |
| 205 where: [core.Iterable$(core.String), [dart.functionType(core.bool, [core.S
tring])]], |
| 206 expand: [core.Iterable, [dart.functionType(core.Iterable, [core.String])]]
, |
| 207 every: [core.bool, [dart.functionType(core.bool, [core.String])]], |
| 208 any: [core.bool, [dart.functionType(core.bool, [core.String])]], |
| 209 reduce: [core.String, [dart.functionType(core.String, [core.String, core.S
tring])]], |
| 210 fold: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic, [dart.
dynamic, core.String])]], |
| 211 contains: [core.bool, [core.Object]], |
| 212 lookup: [core.String, [core.Object]], |
| 213 add: [core.bool, [core.String]], |
| 214 remove: [core.bool, [core.Object]], |
| 215 addAll: [dart.void, [core.Iterable$(core.String)]], |
| 216 removeAll: [dart.void, [core.Iterable$(core.Object)]], |
| 217 toggleAll: [dart.void, [core.Iterable$(core.String)], [core.bool]], |
| 218 retainAll: [dart.void, [core.Iterable$(core.Object)]], |
| 219 removeWhere: [dart.void, [dart.functionType(core.bool, [core.String])]], |
| 220 retainWhere: [dart.void, [dart.functionType(core.bool, [core.String])]], |
| 221 containsAll: [core.bool, [core.Iterable$(core.Object)]], |
| 222 intersection: [core.Set$(core.String), [core.Set$(core.Object)]], |
| 223 union: [core.Set$(core.String), [core.Set$(core.String)]], |
| 224 difference: [core.Set$(core.String), [core.Set$(core.String)]], |
| 225 toList: [core.List$(core.String), [], {growable: core.bool}], |
| 226 toSet: [core.Set$(core.String), []], |
| 227 take: [core.Iterable$(core.String), [core.int]], |
| 228 takeWhile: [core.Iterable$(core.String), [dart.functionType(core.bool, [co
re.String])]], |
| 229 skip: [core.Iterable$(core.String), [core.int]], |
| 230 skipWhile: [core.Iterable$(core.String), [dart.functionType(core.bool, [co
re.String])]], |
| 231 firstWhere: [core.String, [dart.functionType(core.bool, [core.String])], {
orElse: dart.functionType(core.String, [])}], |
| 232 lastWhere: [core.String, [dart.functionType(core.bool, [core.String])], {o
rElse: dart.functionType(core.String, [])}], |
| 233 singleWhere: [core.String, [dart.functionType(core.bool, [core.String])]], |
| 234 elementAt: [core.String, [core.int]], |
| 235 clear: [dart.void, []], |
| 236 modify: [dart.dynamic, [dart.functionType(dart.dynamic, [core.Set$(core.St
ring)])]] |
| 237 }) |
| 238 }); |
| 239 dart.defineExtensionMembers(CssClassSetImpl, [ |
| 240 'forEach', |
| 241 'join', |
| 242 'map', |
| 243 'where', |
| 244 'expand', |
| 245 'every', |
| 246 'any', |
| 247 'reduce', |
| 248 'fold', |
| 249 'contains', |
| 250 'toList', |
| 251 'toSet', |
| 252 'take', |
| 253 'takeWhile', |
| 254 'skip', |
| 255 'skipWhile', |
| 256 'firstWhere', |
| 257 'lastWhere', |
| 258 'singleWhere', |
| 259 'elementAt', |
| 260 'iterator', |
| 261 'isEmpty', |
| 262 'isNotEmpty', |
| 263 'length', |
| 264 'first', |
| 265 'last', |
| 266 'single' |
| 267 ]); |
| 268 dart.defineLazyProperties(CssClassSetImpl, { |
| 269 get _validTokenRE() { |
| 270 return core.RegExp.new('^\\S+$'); |
| 271 } |
| 272 }); |
| 273 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d
ynamic, [core.Object])); |
| 274 function convertDartToNative_SerializedScriptValue(value) { |
| 275 return convertDartToNative_PrepareForStructuredClone(value); |
| 276 } |
| 277 dart.fn(convertDartToNative_SerializedScriptValue); |
| 278 function convertNativeToDart_SerializedScriptValue(object) { |
| 279 return convertNativeToDart_AcceptStructuredClone(object, {mustCopy: true}); |
| 280 } |
| 281 dart.fn(convertNativeToDart_SerializedScriptValue); |
| 282 class _StructuredClone extends core.Object { |
| 283 _StructuredClone() { |
| 284 this.values = []; |
| 285 this.copies = []; |
| 286 } |
| 287 findSlot(value) { |
| 288 let length = this.values[dartx.length]; |
| 289 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 290 if (dart.notNull(core.identical(this.values[dartx.get](i), value))) |
| 291 return i; |
| 292 } |
| 293 this.values[dartx.add](value); |
| 294 this.copies[dartx.add](null); |
| 295 return length; |
| 296 } |
| 297 readSlot(i) { |
| 298 return this.copies[dartx.get](i); |
| 299 } |
| 300 writeSlot(i, x) { |
| 301 this.copies[dartx.set](i, x); |
| 302 } |
| 303 cleanupSlots() {} |
| 304 walk(e) { |
| 305 if (e == null) |
| 306 return e; |
| 307 if (typeof e == 'boolean') |
| 308 return e; |
| 309 if (typeof e == 'number') |
| 310 return e; |
| 311 if (typeof e == 'string') |
| 312 return e; |
| 313 if (dart.is(e, core.DateTime)) { |
| 314 return convertDartToNative_DateTime(dart.as(e, core.DateTime)); |
| 315 } |
| 316 if (dart.is(e, core.RegExp)) { |
| 317 dart.throw(new core.UnimplementedError('structured clone of RegExp')); |
| 318 } |
| 319 if (dart.is(e, dart.dynamic)) |
| 320 return e; |
| 321 if (dart.is(e, dart.dynamic)) |
| 322 return e; |
| 323 if (dart.is(e, dart.dynamic)) |
| 324 return e; |
| 325 if (dart.is(e, dart.dynamic)) |
| 326 return e; |
| 327 if (dart.notNull(this.cloneNotRequired(e))) |
| 328 return e; |
| 329 if (dart.is(e, core.Map)) { |
| 330 let slot = this.findSlot(e); |
| 331 let copy = this.readSlot(slot); |
| 332 if (copy != null) |
| 333 return copy; |
| 334 copy = this.newJsMap(); |
| 335 this.writeSlot(slot, copy); |
| 336 dart.dsend(e, 'forEach', dart.fn(((key, value) => { |
| 337 this.putIntoMap(copy, key, this.walk(value)); |
| 338 }).bind(this))); |
| 339 return copy; |
| 340 } |
| 341 if (dart.is(e, core.List)) { |
| 342 let slot = this.findSlot(e); |
| 343 let copy = this.readSlot(slot); |
| 344 if (copy != null) |
| 345 return copy; |
| 346 copy = this.copyList(dart.as(e, core.List), slot); |
| 347 return copy; |
| 348 } |
| 349 dart.throw(new core.UnimplementedError('structured clone of other type')); |
| 350 } |
| 351 copyList(e, slot) { |
| 352 let i = 0; |
| 353 let length = e[dartx.length]; |
| 354 let copy = this.newJsList(length); |
| 355 this.writeSlot(slot, copy); |
| 356 for (; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) { |
| 357 dart.dsetindex(copy, i, this.walk(e[dartx.get](i))); |
| 358 } |
| 359 return copy; |
| 360 } |
| 361 convertDartToNative_PrepareForStructuredClone(value) { |
| 362 let copy = this.walk(value); |
| 363 this.cleanupSlots(); |
| 364 return copy; |
| 365 } |
| 366 } |
| 367 dart.setSignature(_StructuredClone, { |
| 368 methods: () => ({ |
| 369 findSlot: [core.int, [dart.dynamic]], |
| 370 readSlot: [dart.dynamic, [core.int]], |
| 371 writeSlot: [dart.dynamic, [core.int, dart.dynamic]], |
| 372 cleanupSlots: [dart.dynamic, []], |
| 373 walk: [dart.dynamic, [dart.dynamic]], |
| 374 copyList: [dart.dynamic, [core.List, core.int]], |
| 375 convertDartToNative_PrepareForStructuredClone: [dart.dynamic, [dart.dynami
c]] |
| 376 }) |
| 377 }); |
| 378 class _AcceptStructuredClone extends core.Object { |
| 379 _AcceptStructuredClone() { |
| 380 this.values = []; |
| 381 this.copies = []; |
| 382 this.mustCopy = false; |
| 383 } |
| 384 findSlot(value) { |
| 385 let length = this.values[dartx.length]; |
| 386 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 387 if (dart.notNull(this.identicalInJs(this.values[dartx.get](i), value))) |
| 388 return i; |
| 389 } |
| 390 this.values[dartx.add](value); |
| 391 this.copies[dartx.add](null); |
| 392 return length; |
| 393 } |
| 394 readSlot(i) { |
| 395 return this.copies[dartx.get](i); |
| 396 } |
| 397 writeSlot(i, x) { |
| 398 this.copies[dartx.set](i, x); |
| 399 } |
| 400 walk(e) { |
| 401 if (e == null) |
| 402 return e; |
| 403 if (typeof e == 'boolean') |
| 404 return e; |
| 405 if (typeof e == 'number') |
| 406 return e; |
| 407 if (typeof e == 'string') |
| 408 return e; |
| 409 if (dart.notNull(isJavaScriptDate(e))) { |
| 410 return convertNativeToDart_DateTime(e); |
| 411 } |
| 412 if (dart.notNull(isJavaScriptRegExp(e))) { |
| 413 dart.throw(new core.UnimplementedError('structured clone of RegExp')); |
| 414 } |
| 415 if (dart.notNull(isJavaScriptPromise(e))) { |
| 416 return convertNativePromiseToDartFuture(e); |
| 417 } |
| 418 if (dart.notNull(isJavaScriptSimpleObject(e))) { |
| 419 let slot = this.findSlot(e); |
| 420 let copy = this.readSlot(slot); |
| 421 if (copy != null) |
| 422 return copy; |
| 423 copy = dart.map(); |
| 424 this.writeSlot(slot, copy); |
| 425 this.forEachJsField(e, dart.fn(((key, value) => dart.dsetindex(copy, key
, this.walk(value))).bind(this))); |
| 426 return copy; |
| 427 } |
| 428 if (dart.notNull(isJavaScriptArray(e))) { |
| 429 let slot = this.findSlot(e); |
| 430 let copy = this.readSlot(slot); |
| 431 if (copy != null) |
| 432 return copy; |
| 433 let length = dart.as(dart.dload(e, 'length'), core.int); |
| 434 copy = dart.notNull(this.mustCopy) ? this.newDartList(length) : e; |
| 435 this.writeSlot(slot, copy); |
| 436 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { |
| 437 dart.dsetindex(copy, i, this.walk(dart.dindex(e, i))); |
| 438 } |
| 439 return copy; |
| 440 } |
| 441 return e; |
| 442 } |
| 443 convertNativeToDart_AcceptStructuredClone(object, opts) { |
| 444 let mustCopy = opts && 'mustCopy' in opts ? opts.mustCopy : false; |
| 445 this.mustCopy = dart.as(mustCopy, core.bool); |
| 446 let copy = this.walk(object); |
| 447 return copy; |
| 448 } |
| 449 } |
| 450 dart.setSignature(_AcceptStructuredClone, { |
| 451 methods: () => ({ |
| 452 findSlot: [core.int, [dart.dynamic]], |
| 453 readSlot: [dart.dynamic, [core.int]], |
| 454 writeSlot: [dart.dynamic, [core.int, dart.dynamic]], |
| 455 walk: [dart.dynamic, [dart.dynamic]], |
| 456 convertNativeToDart_AcceptStructuredClone: [dart.dynamic, [dart.dynamic],
{mustCopy: dart.dynamic}] |
| 457 }) |
| 458 }); |
| 459 class _TypedContextAttributes extends core.Object { |
| 460 _TypedContextAttributes(alpha, antialias, depth, failIfMajorPerformanceCavea
t, premultipliedAlpha, preserveDrawingBuffer, stencil) { |
| 461 this.alpha = alpha; |
| 462 this.antialias = antialias; |
| 463 this.depth = depth; |
| 464 this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; |
| 465 this.premultipliedAlpha = premultipliedAlpha; |
| 466 this.preserveDrawingBuffer = preserveDrawingBuffer; |
| 467 this.stencil = stencil; |
| 468 } |
| 469 } |
| 470 dart.setSignature(_TypedContextAttributes, { |
| 471 constructors: () => ({_TypedContextAttributes: [_TypedContextAttributes, [co
re.bool, core.bool, core.bool, core.bool, core.bool, core.bool, core.bool]]}) |
| 472 }); |
| 473 function convertNativeToDart_ContextAttributes(nativeContextAttributes) { |
| 474 if (dart.is(nativeContextAttributes, dart.dynamic)) { |
| 475 return nativeContextAttributes; |
| 476 } |
| 477 return new _TypedContextAttributes(dart.as(nativeContextAttributes.alpha, co
re.bool), dart.as(nativeContextAttributes.antialias, core.bool), dart.as(nativeC
ontextAttributes.depth, core.bool), dart.as(nativeContextAttributes.failIfMajorP
erformanceCaveat, core.bool), dart.as(nativeContextAttributes.premultipliedAlpha
, core.bool), dart.as(nativeContextAttributes.preserveDrawingBuffer, core.bool),
dart.as(nativeContextAttributes.stencil, core.bool)); |
| 478 } |
| 479 dart.fn(convertNativeToDart_ContextAttributes); |
| 480 class _TypedImageData extends core.Object { |
| 481 _TypedImageData(data, height, width) { |
| 482 this.data = data; |
| 483 this.height = height; |
| 484 this.width = width; |
| 485 } |
| 486 } |
| 487 dart.setSignature(_TypedImageData, { |
| 488 constructors: () => ({_TypedImageData: [_TypedImageData, [typed_data.Uint8Cl
ampedList, core.int, core.int]]}) |
| 489 }); |
| 490 function convertNativeToDart_ImageData(nativeImageData) { |
| 491 0; |
| 492 if (dart.is(nativeImageData, dart.dynamic)) { |
| 493 let data = dart.dload(nativeImageData, 'data'); |
| 494 if (data.constructor === Array) { |
| 495 if (typeof CanvasPixelArray !== "undefined") { |
| 496 data.constructor = CanvasPixelArray; |
| 497 data.BYTES_PER_ELEMENT = 1; |
| 498 } |
| 499 } |
| 500 return nativeImageData; |
| 501 } |
| 502 return new _TypedImageData(dart.as(nativeImageData.data, typed_data.Uint8Cla
mpedList), dart.as(nativeImageData.height, core.int), dart.as(nativeImageData.wi
dth, core.int)); |
| 503 } |
| 504 dart.fn(convertNativeToDart_ImageData); |
| 505 function convertDartToNative_ImageData(imageData) { |
| 506 if (dart.is(imageData, _TypedImageData)) { |
| 507 return {data: dart.dload(imageData, 'data'), height: dart.dload(imageData,
'height'), width: dart.dload(imageData, 'width')}; |
| 508 } |
| 509 return imageData; |
| 510 } |
| 511 dart.fn(convertDartToNative_ImageData); |
| 512 const _serializedScriptValue = 'num|String|bool|' + 'JSExtendableArray|=Object
|' + 'Blob|File|NativeByteBuffer|NativeTypedData'; |
| 513 const annotation_Creates_SerializedScriptValue = dart.const(new _js_helper.Cre
ates(_serializedScriptValue)); |
| 514 const annotation_Returns_SerializedScriptValue = dart.const(new _js_helper.Ret
urns(_serializedScriptValue)); |
| 515 function convertNativeToDart_Dictionary(object) { |
| 516 if (object == null) |
| 517 return null; |
| 518 let dict = dart.map(); |
| 519 let keys = Object.getOwnPropertyNames(object); |
| 520 for (let key of dart.as(keys, core.Iterable)) { |
| 521 dict.set(key, object[key]); |
| 522 } |
| 523 return dict; |
| 524 } |
| 525 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]); |
| 526 function convertDartToNative_Dictionary(dict, postCreate) { |
| 527 if (postCreate === void 0) |
| 528 postCreate = null; |
| 529 if (dict == null) |
| 530 return null; |
| 531 let object = {}; |
| 532 if (postCreate != null) { |
| 533 dart.dcall(postCreate, object); |
| 534 } |
| 535 dict.forEach(dart.fn((key, value) => { |
| 536 object[key] = value; |
| 537 }, dart.dynamic, [core.String, dart.dynamic])); |
| 538 return object; |
| 539 } |
| 540 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi
onType(dart.void, [dart.dynamic])]); |
| 541 function convertDartToNative_StringArray(input) { |
| 542 return input; |
| 543 } |
| 544 dart.fn(convertDartToNative_StringArray, core.List, [core.List$(core.String)])
; |
| 545 function convertNativeToDart_DateTime(date) { |
| 546 let millisSinceEpoch = date.getTime(); |
| 547 return new core.DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, {isUtc
: true}); |
| 548 } |
| 549 dart.fn(convertNativeToDart_DateTime, core.DateTime, [dart.dynamic]); |
| 550 function convertDartToNative_DateTime(date) { |
| 551 return new Date(date.millisecondsSinceEpoch); |
| 552 } |
| 553 dart.fn(convertDartToNative_DateTime, dart.dynamic, [core.DateTime]); |
| 554 function convertDartToNative_PrepareForStructuredClone(value) { |
| 555 return new _StructuredCloneDart2Js().convertDartToNative_PrepareForStructure
dClone(value); |
| 556 } |
| 557 dart.fn(convertDartToNative_PrepareForStructuredClone); |
| 558 function convertNativeToDart_AcceptStructuredClone(object, opts) { |
| 559 let mustCopy = opts && 'mustCopy' in opts ? opts.mustCopy : false; |
| 560 return new _AcceptStructuredCloneDart2Js().convertNativeToDart_AcceptStructu
redClone(object, {mustCopy: mustCopy}); |
| 561 } |
| 562 dart.fn(convertNativeToDart_AcceptStructuredClone, dart.dynamic, [dart.dynamic
], {mustCopy: dart.dynamic}); |
| 563 class _StructuredCloneDart2Js extends _StructuredClone { |
| 564 _StructuredCloneDart2Js() { |
| 565 super._StructuredClone(); |
| 566 } |
| 567 newJsMap() { |
| 568 return {}; |
| 569 } |
| 570 putIntoMap(map, key, value) { |
| 571 return map[key] = value; |
| 572 } |
| 573 newJsList(length) { |
| 574 return new Array(length); |
| 575 } |
| 576 cloneNotRequired(e) { |
| 577 return dart.is(e, _native_typed_data.NativeByteBuffer) || dart.is(e, _nati
ve_typed_data.NativeTypedData); |
| 578 } |
| 579 } |
| 580 dart.setSignature(_StructuredCloneDart2Js, { |
| 581 methods: () => ({ |
| 582 newJsMap: [dart.dynamic, []], |
| 583 putIntoMap: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]], |
| 584 newJsList: [dart.dynamic, [dart.dynamic]], |
| 585 cloneNotRequired: [core.bool, [dart.dynamic]] |
| 586 }) |
| 587 }); |
| 588 class _AcceptStructuredCloneDart2Js extends _AcceptStructuredClone { |
| 589 _AcceptStructuredCloneDart2Js() { |
| 590 super._AcceptStructuredClone(); |
| 591 } |
| 592 newJsList(length) { |
| 593 return new Array(length); |
| 594 } |
| 595 newDartList(length) { |
| 596 return this.newJsList(length); |
| 597 } |
| 598 identicalInJs(a, b) { |
| 599 return core.identical(a, b); |
| 600 } |
| 601 forEachJsField(object, action) { |
| 602 for (let key of dart.as(Object.keys(object), core.Iterable)) { |
| 603 dart.dcall(action, key, object[key]); |
| 604 } |
| 605 } |
| 606 } |
| 607 dart.setSignature(_AcceptStructuredCloneDart2Js, { |
| 608 methods: () => ({ |
| 609 newJsList: [dart.dynamic, [dart.dynamic]], |
| 610 newDartList: [dart.dynamic, [dart.dynamic]], |
| 611 identicalInJs: [core.bool, [dart.dynamic, dart.dynamic]], |
| 612 forEachJsField: [dart.void, [dart.dynamic, dart.dynamic]] |
| 613 }) |
| 614 }); |
| 615 function isJavaScriptDate(value) { |
| 616 return value instanceof Date; |
| 617 } |
| 618 dart.fn(isJavaScriptDate, core.bool, [dart.dynamic]); |
| 619 function isJavaScriptRegExp(value) { |
| 620 return value instanceof RegExp; |
| 621 } |
| 622 dart.fn(isJavaScriptRegExp, core.bool, [dart.dynamic]); |
| 623 function isJavaScriptArray(value) { |
| 624 return value instanceof Array; |
| 625 } |
| 626 dart.fn(isJavaScriptArray, core.bool, [dart.dynamic]); |
| 627 function isJavaScriptSimpleObject(value) { |
| 628 let proto = Object.getPrototypeOf(value); |
| 629 return proto === Object.prototype || proto === null; |
| 630 } |
| 631 dart.fn(isJavaScriptSimpleObject, core.bool, [dart.dynamic]); |
| 632 function isImmutableJavaScriptArray(value) { |
| 633 return !!value.immutable$list; |
| 634 } |
| 635 dart.fn(isImmutableJavaScriptArray, core.bool, [dart.dynamic]); |
| 636 function isJavaScriptPromise(value) { |
| 637 return typeof Promise != "undefined" && value instanceof Promise; |
| 638 } |
| 639 dart.fn(isJavaScriptPromise, core.bool, [dart.dynamic]); |
| 640 function convertNativePromiseToDartFuture(promise) { |
| 641 let completer = async.Completer.new(); |
| 642 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS
, dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1); |
| 643 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ
S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic])
, 1); |
| 644 let newPromise = promise.then(then).catch(error); |
| 645 return completer.future; |
| 646 } |
| 647 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]); |
| 648 class Device extends core.Object { |
| 649 static get userAgent() { |
| 650 return dart.as(html.window.navigator.userAgent, core.String); |
| 651 } |
| 652 static get isOpera() { |
| 653 if (Device._isOpera == null) { |
| 654 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0); |
| 655 } |
| 656 return Device._isOpera; |
| 657 } |
| 658 static get isIE() { |
| 659 if (Device._isIE == null) { |
| 660 Device._isIE = !dart.notNull(Device.isOpera) && dart.notNull(Device.user
Agent[dartx.contains]("Trident/", 0)); |
| 661 } |
| 662 return Device._isIE; |
| 663 } |
| 664 static get isFirefox() { |
| 665 if (Device._isFirefox == null) { |
| 666 Device._isFirefox = Device.userAgent[dartx.contains]("Firefox", 0); |
| 667 } |
| 668 return Device._isFirefox; |
| 669 } |
| 670 static get isWebKit() { |
| 671 if (Device._isWebKit == null) { |
| 672 Device._isWebKit = !dart.notNull(Device.isOpera) && dart.notNull(Device.
userAgent[dartx.contains]("WebKit", 0)); |
| 673 } |
| 674 return Device._isWebKit; |
| 675 } |
| 676 static get cssPrefix() { |
| 677 let prefix = Device._cachedCssPrefix; |
| 678 if (prefix != null) |
| 679 return prefix; |
| 680 if (dart.notNull(Device.isFirefox)) { |
| 681 prefix = '-moz-'; |
| 682 } else if (dart.notNull(Device.isIE)) { |
| 683 prefix = '-ms-'; |
| 684 } else if (dart.notNull(Device.isOpera)) { |
| 685 prefix = '-o-'; |
| 686 } else { |
| 687 prefix = '-webkit-'; |
| 688 } |
| 689 return Device._cachedCssPrefix = prefix; |
| 690 } |
| 691 static get propertyPrefix() { |
| 692 let prefix = Device._cachedPropertyPrefix; |
| 693 if (prefix != null) |
| 694 return prefix; |
| 695 if (dart.notNull(Device.isFirefox)) { |
| 696 prefix = 'moz'; |
| 697 } else if (dart.notNull(Device.isIE)) { |
| 698 prefix = 'ms'; |
| 699 } else if (dart.notNull(Device.isOpera)) { |
| 700 prefix = 'o'; |
| 701 } else { |
| 702 prefix = 'webkit'; |
| 703 } |
| 704 return Device._cachedPropertyPrefix = prefix; |
| 705 } |
| 706 static isEventTypeSupported(eventType) { |
| 707 try { |
| 708 let e = html.Event.eventType(eventType, ''); |
| 709 return dart.is(e, html.Event); |
| 710 } catch (_) { |
| 711 } |
| 712 |
| 713 return false; |
| 714 } |
| 715 } |
| 716 dart.setSignature(Device, { |
| 717 statics: () => ({isEventTypeSupported: [core.bool, [core.String]]}), |
| 718 names: ['isEventTypeSupported'] |
| 719 }); |
| 720 Device._isOpera = null; |
| 721 Device._isIE = null; |
| 722 Device._isFirefox = null; |
| 723 Device._isWebKit = null; |
| 724 Device._cachedCssPrefix = null; |
| 725 Device._cachedPropertyPrefix = null; |
| 726 const _childNodes = Symbol('_childNodes'); |
| 727 const _node = Symbol('_node'); |
| 728 const _iterable = Symbol('_iterable'); |
| 729 const _filtered = Symbol('_filtered'); |
| 730 class FilteredElementList extends collection.ListBase$(html.Element) { |
| 731 FilteredElementList(node) { |
| 732 this[_childNodes] = node.nodes; |
| 733 this[_node] = node; |
| 734 } |
| 735 get [_iterable]() { |
| 736 return new _internal.WhereIterable(this[_childNodes], dart.fn(n => dart.is
(n, html.Element), core.bool, [dart.dynamic])); |
| 737 } |
| 738 get [_filtered]() { |
| 739 return core.List$(html.Element).from(this[_iterable], {growable: false}); |
| 740 } |
| 741 forEach(f) { |
| 742 this[_filtered][dartx.forEach](f); |
| 743 } |
| 744 set(index, value) { |
| 745 this.get(index).replaceWith(value); |
| 746 return value; |
| 747 } |
| 748 set length(newLength) { |
| 749 let len = this.length; |
| 750 if (dart.notNull(newLength) >= dart.notNull(len)) { |
| 751 return; |
| 752 } else if (dart.notNull(newLength) < 0) { |
| 753 dart.throw(new core.ArgumentError("Invalid list length")); |
| 754 } |
| 755 this.removeRange(newLength, len); |
| 756 } |
| 757 add(value) { |
| 758 this[_childNodes][dartx.add](value); |
| 759 } |
| 760 addAll(iterable) { |
| 761 for (let element of iterable) { |
| 762 this.add(element); |
| 763 } |
| 764 } |
| 765 contains(needle) { |
| 766 if (!dart.is(needle, html.Element)) |
| 767 return false; |
| 768 let element = dart.as(needle, html.Element); |
| 769 return dart.equals(element.parentNode, this[_node]); |
| 770 } |
| 771 get reversed() { |
| 772 return this[_filtered][dartx.reversed]; |
| 773 } |
| 774 sort(compare) { |
| 775 if (compare === void 0) |
| 776 compare = null; |
| 777 dart.throw(new core.UnsupportedError('Cannot sort filtered list')); |
| 778 } |
| 779 setRange(start, end, iterable, skipCount) { |
| 780 if (skipCount === void 0) |
| 781 skipCount = 0; |
| 782 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list')); |
| 783 } |
| 784 fillRange(start, end, fillValue) { |
| 785 if (fillValue === void 0) |
| 786 fillValue = null; |
| 787 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list'))
; |
| 788 } |
| 789 replaceRange(start, end, iterable) { |
| 790 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list
')); |
| 791 } |
| 792 removeRange(start, end) { |
| 793 core.List.from(this[_iterable][dartx.skip](start)[dartx.take](dart.notNull
(end) - dart.notNull(start)))[dartx.forEach](dart.fn(el => dart.dsend(el, 'remov
e'))); |
| 794 } |
| 795 clear() { |
| 796 this[_childNodes][dartx.clear](); |
| 797 } |
| 798 removeLast() { |
| 799 let result = this[_iterable][dartx.last]; |
| 800 if (result != null) { |
| 801 result.remove(); |
| 802 } |
| 803 return result; |
| 804 } |
| 805 insert(index, value) { |
| 806 if (index == this.length) { |
| 807 this.add(value); |
| 808 } else { |
| 809 let element = this[_iterable][dartx.elementAt](index); |
| 810 element.parentNode.insertBefore(value, element); |
| 811 } |
| 812 } |
| 813 insertAll(index, iterable) { |
| 814 if (index == this.length) { |
| 815 this.addAll(iterable); |
| 816 } else { |
| 817 let element = this[_iterable][dartx.elementAt](index); |
| 818 element.parentNode.insertAllBefore(iterable, element); |
| 819 } |
| 820 } |
| 821 removeAt(index) { |
| 822 let result = this.get(index); |
| 823 result.remove(); |
| 824 return result; |
| 825 } |
| 826 remove(element) { |
| 827 if (!dart.is(element, html.Element)) |
| 828 return false; |
| 829 if (dart.notNull(this.contains(element))) { |
| 830 dart.as(element, html.Element).remove(); |
| 831 return true; |
| 832 } else { |
| 833 return false; |
| 834 } |
| 835 } |
| 836 get length() { |
| 837 return this[_iterable][dartx.length]; |
| 838 } |
| 839 get(index) { |
| 840 return this[_iterable][dartx.elementAt](index); |
| 841 } |
| 842 get iterator() { |
| 843 return this[_filtered][dartx.iterator]; |
| 844 } |
| 845 get rawList() { |
| 846 return this[_node].childNodes; |
| 847 } |
| 848 } |
| 849 FilteredElementList[dart.implements] = () => [NodeListWrapper]; |
| 850 dart.setSignature(FilteredElementList, { |
| 851 constructors: () => ({FilteredElementList: [FilteredElementList, [html.Node]
]}), |
| 852 methods: () => ({ |
| 853 forEach: [dart.void, [dart.functionType(dart.void, [html.Element])]], |
| 854 set: [dart.void, [core.int, html.Element]], |
| 855 add: [dart.void, [html.Element]], |
| 856 addAll: [dart.void, [core.Iterable$(html.Element)]], |
| 857 sort: [dart.void, [], [dart.functionType(core.int, [html.Element, html.Ele
ment])]], |
| 858 setRange: [dart.void, [core.int, core.int, core.Iterable$(html.Element)],
[core.int]], |
| 859 fillRange: [dart.void, [core.int, core.int], [html.Element]], |
| 860 replaceRange: [dart.void, [core.int, core.int, core.Iterable$(html.Element
)]], |
| 861 removeLast: [html.Element, []], |
| 862 insert: [dart.void, [core.int, html.Element]], |
| 863 insertAll: [dart.void, [core.int, core.Iterable$(html.Element)]], |
| 864 removeAt: [html.Element, [core.int]], |
| 865 get: [html.Element, [core.int]] |
| 866 }) |
| 867 }); |
| 868 dart.defineExtensionMembers(FilteredElementList, [ |
| 869 'forEach', |
| 870 'set', |
| 871 'add', |
| 872 'addAll', |
| 873 'contains', |
| 874 'sort', |
| 875 'setRange', |
| 876 'fillRange', |
| 877 'replaceRange', |
| 878 'removeRange', |
| 879 'clear', |
| 880 'removeLast', |
| 881 'insert', |
| 882 'insertAll', |
| 883 'removeAt', |
| 884 'remove', |
| 885 'get', |
| 886 'length', |
| 887 'reversed', |
| 888 'length', |
| 889 'iterator' |
| 890 ]); |
| 891 class Lists extends core.Object { |
| 892 static indexOf(a, element, startIndex, endIndex) { |
| 893 if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) { |
| 894 return -1; |
| 895 } |
| 896 if (dart.notNull(startIndex) < 0) { |
| 897 startIndex = 0; |
| 898 } |
| 899 for (let i = startIndex; dart.notNull(i) < dart.notNull(endIndex); i = dar
t.notNull(i) + 1) { |
| 900 if (dart.equals(a[dartx.get](i), element)) { |
| 901 return i; |
| 902 } |
| 903 } |
| 904 return -1; |
| 905 } |
| 906 static lastIndexOf(a, element, startIndex) { |
| 907 if (dart.notNull(startIndex) < 0) { |
| 908 return -1; |
| 909 } |
| 910 if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) { |
| 911 startIndex = dart.notNull(a[dartx.length]) - 1; |
| 912 } |
| 913 for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { |
| 914 if (dart.equals(a[dartx.get](i), element)) { |
| 915 return i; |
| 916 } |
| 917 } |
| 918 return -1; |
| 919 } |
| 920 static getRange(a, start, end, accumulator) { |
| 921 if (dart.notNull(start) < 0) |
| 922 dart.throw(new core.RangeError.value(start)); |
| 923 if (dart.notNull(end) < dart.notNull(start)) |
| 924 dart.throw(new core.RangeError.value(end)); |
| 925 if (dart.notNull(end) > dart.notNull(a[dartx.length])) |
| 926 dart.throw(new core.RangeError.value(end)); |
| 927 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 928 accumulator[dartx.add](a[dartx.get](i)); |
| 929 } |
| 930 return accumulator; |
| 931 } |
| 932 } |
| 933 dart.setSignature(Lists, { |
| 934 statics: () => ({ |
| 935 indexOf: [core.int, [core.List, core.Object, core.int, core.int]], |
| 936 lastIndexOf: [core.int, [core.List, core.Object, core.int]], |
| 937 getRange: [core.List, [core.List, core.int, core.int, core.List]] |
| 938 }), |
| 939 names: ['indexOf', 'lastIndexOf', 'getRange'] |
| 940 }); |
| 941 class NodeListWrapper extends core.Object {} |
| 942 // Exports: |
| 943 exports.CssClassSetImpl = CssClassSetImpl; |
| 944 exports.convertDartToNative_SerializedScriptValue = convertDartToNative_Serial
izedScriptValue; |
| 945 exports.convertNativeToDart_SerializedScriptValue = convertNativeToDart_Serial
izedScriptValue; |
| 946 exports.convertNativeToDart_ContextAttributes = convertNativeToDart_ContextAtt
ributes; |
| 947 exports.convertNativeToDart_ImageData = convertNativeToDart_ImageData; |
| 948 exports.convertDartToNative_ImageData = convertDartToNative_ImageData; |
| 949 exports.annotation_Creates_SerializedScriptValue = annotation_Creates_Serializ
edScriptValue; |
| 950 exports.annotation_Returns_SerializedScriptValue = annotation_Returns_Serializ
edScriptValue; |
| 951 exports.convertNativeToDart_Dictionary = convertNativeToDart_Dictionary; |
| 952 exports.convertDartToNative_Dictionary = convertDartToNative_Dictionary; |
| 953 exports.convertDartToNative_StringArray = convertDartToNative_StringArray; |
| 954 exports.convertNativeToDart_DateTime = convertNativeToDart_DateTime; |
| 955 exports.convertDartToNative_DateTime = convertDartToNative_DateTime; |
| 956 exports.convertDartToNative_PrepareForStructuredClone = convertDartToNative_Pr
epareForStructuredClone; |
| 957 exports.convertNativeToDart_AcceptStructuredClone = convertNativeToDart_Accept
StructuredClone; |
| 958 exports.isJavaScriptDate = isJavaScriptDate; |
| 959 exports.isJavaScriptRegExp = isJavaScriptRegExp; |
| 960 exports.isJavaScriptArray = isJavaScriptArray; |
| 961 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject; |
| 962 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray; |
| 963 exports.isJavaScriptPromise = isJavaScriptPromise; |
| 964 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture; |
| 965 exports.Device = Device; |
| 966 exports.FilteredElementList = FilteredElementList; |
| 967 exports.Lists = Lists; |
| 968 exports.NodeListWrapper = NodeListWrapper; |
| 969 }); |
OLD | NEW |