@@ -149,46 +149,5 @@ module.exports = function transformNativeComponent(root, options) {
149
149
150
150
let newSource = root . toSource ( ) ;
151
151
152
- // wrap existing template with root element
153
- let classNodes = [ ] ;
154
- if ( options . hasComponentCSS ) {
155
- classNodes . push ( b . mustache ( 'styleNamespace' ) ) ;
156
- }
157
-
158
- for ( let className of classNames ) {
159
- classNodes . push ( b . text ( className ) ) ;
160
- }
161
- classNameBindings . forEach ( ( [ truthy , falsy ] , property ) => {
162
- if ( ! truthy ) {
163
- classNodes . push ( b . mustache ( `unless this.${ property } "${ falsy } "` ) ) ;
164
- } else {
165
- classNodes . push ( b . mustache ( `if this.${ property } "${ truthy } "${ falsy ? ` "${ falsy } "` : '' } ` ) ) ;
166
- }
167
- } ) ;
168
-
169
- let attrs = [ ] ;
170
-
171
- if ( elementId ) {
172
- attrs . push ( b . attr ( 'id' , b . text ( elementId ) ) ) ;
173
- }
174
-
175
- attributeBindings . forEach ( ( value , key ) => {
176
- attrs . push ( b . attr ( key , b . mustache ( `this.${ value } ` ) ) ) ;
177
- } ) ;
178
-
179
- if ( classNodes . length === 1 ) {
180
- attrs . push ( b . attr ( 'class' , classNodes [ 0 ] ) ) ;
181
- } else if ( classNodes . length !== 0 ) {
182
- let parts = [ ] ;
183
- classNodes . forEach ( ( node , i ) => {
184
- if ( i !== 0 ) parts . push ( b . text ( ' ' ) ) ;
185
- parts . push ( node ) ;
186
- } ) ;
187
-
188
- attrs . push ( b . attr ( 'class' , b . concat ( parts ) ) ) ;
189
- }
190
-
191
- attrs . push ( b . attr ( '...attributes' , b . text ( '' ) ) ) ;
192
-
193
- return { newSource, attrs, tagName } ;
152
+ return { newSource, tagName, elementId, classNames, classNameBindings, attributeBindings } ;
194
153
} ;
0 commit comments