@@ -34,7 +34,7 @@ interface T$$ {
34
34
on_mount : any [ ] ;
35
35
on_destroy : any [ ] ;
36
36
skip_bound : boolean ;
37
- customStyleTag : HTMLElement ;
37
+ customStyleTag ? : HTMLElement ;
38
38
}
39
39
40
40
export function bind ( component , name , callback ) {
@@ -97,18 +97,26 @@ function make_dirty(component, i) {
97
97
component . $$ . dirty [ ( i / 31 ) | 0 ] |= ( 1 << ( i % 31 ) ) ;
98
98
}
99
99
100
- export function init ( component , options , instance , create_fragment , not_equal , props , add_css , dirty = [ - 1 ] ) {
100
+
101
+ export function addCssToComponent ( that , add_css , options ) {
102
+ that . $$ = {
103
+ customStyleTag : options . customStyleTag || current_component && current_component . $$ . customStyleTag
104
+ } ;
105
+ add_css ( that . $$ . customStyleTag ) ;
106
+ }
107
+
108
+ export function init ( component , options , instance , create_fragment , not_equal , props , dirty = [ - 1 ] ) {
101
109
const parent_component = current_component ;
102
110
set_current_component ( component ) ;
103
111
104
112
const prop_values = options . props || { } ;
105
113
106
114
const $$ : T$$ = component . $$ = {
115
+ ...component . $$ ,
116
+
107
117
fragment : null ,
108
118
ctx : null ,
109
119
110
- customStyleTag : options . customStyleTag || parent_component && parent_component . $$ . customStyleTag ,
111
-
112
120
// state
113
121
props,
114
122
update : noop ,
@@ -130,8 +138,6 @@ export function init(component, options, instance, create_fragment, not_equal, p
130
138
131
139
let ready = false ;
132
140
133
- add_css ( $$ . customStyleTag ) ;
134
-
135
141
$$ . ctx = instance
136
142
? instance ( component , prop_values , ( i , ret , ...rest ) => {
137
143
const value = rest . length ? rest [ 0 ] : ret ;
0 commit comments