| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** Collects common snippets of generated code. */ | 5 /** Collects common snippets of generated code. */ |
| 6 library codegen; | 6 library codegen; |
| 7 | 7 |
| 8 import 'file_system/path.dart'; | 8 import 'file_system/path.dart'; |
| 9 import 'info.dart'; | 9 import 'info.dart'; |
| 10 import 'utils.dart'; | 10 import 'utils.dart'; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 library $libraryName; | 21 library $libraryName; |
| 22 | 22 |
| 23 $imports | 23 $imports |
| 24 """; | 24 """; |
| 25 | 25 |
| 26 // TODO(sigmund): include only those imports that are used by the code. | 26 // TODO(sigmund): include only those imports that are used by the code. |
| 27 String get imports => """ | 27 String get imports => """ |
| 28 import 'dart:html' as autogenerated_html; | 28 import 'dart:html' as autogenerated_html; |
| 29 import 'dart:web_audio' as autogenerated_audio; | 29 import 'dart:web_audio' as autogenerated_audio; |
| 30 import 'dart:svg' as autogenerated_svg; | 30 import 'dart:svg' as autogenerated_svg; |
| 31 import 'package:web_components/web_components.dart' as autogenerated; | 31 import 'package:web_ui/web_ui.dart' as autogenerated; |
| 32 """; | 32 """; |
| 33 | 33 |
| 34 /** The code in .dart files generated for a web component. */ | 34 /** The code in .dart files generated for a web component. */ |
| 35 // TODO(sigmund): omit [_root] if the user already defined it. | 35 // TODO(sigmund): omit [_root] if the user already defined it. |
| 36 String componentCode( | 36 String componentCode( |
| 37 String className, | 37 String className, |
| 38 String extraFields, | 38 String extraFields, |
| 39 String createdBody, | 39 String createdBody, |
| 40 String insertedBody, | 40 String insertedBody, |
| 41 String removedBody) => """ | 41 String removedBody) => """ |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 buff.add(' show ') | 154 buff.add(' show ') |
| 155 .add(Strings.join(directive.show, ',')); | 155 .add(Strings.join(directive.show, ',')); |
| 156 } | 156 } |
| 157 if (directive.hide != null) { | 157 if (directive.hide != null) { |
| 158 buff.add(' hide ') | 158 buff.add(' hide ') |
| 159 .add(Strings.join(directive.hide, ',')); | 159 .add(Strings.join(directive.hide, ',')); |
| 160 } | 160 } |
| 161 buff.add(';'); | 161 buff.add(';'); |
| 162 return buff.toString(); | 162 return buff.toString(); |
| 163 } | 163 } |
| OLD | NEW |