File tree Expand file tree Collapse file tree 4 files changed +66
-52
lines changed Expand file tree Collapse file tree 4 files changed +66
-52
lines changed Original file line number Diff line number Diff line change 1
- import Ember from 'ember' ;
2
- import podNames from 'ember-component-css/pod-names' ;
3
-
4
- const {
5
- Component,
6
- ComponentLookup,
7
- computed,
8
- getOwner
9
- } = Ember ;
10
-
11
- ComponentLookup . reopen ( {
12
- componentFor ( name , owner ) {
13
- owner = owner . hasRegistration ? owner : getOwner ( this ) ;
14
-
15
- if ( podNames [ name ] && ! owner . hasRegistration ( `component:${ name } ` ) ) {
16
- owner . register ( `component:${ name } ` , Component ) ;
17
- }
18
- return this . _super ( ...arguments ) ;
19
- }
20
- } ) ;
21
-
22
- Component . reopen ( {
23
- _componentIdentifier : computed ( {
24
- get ( ) {
25
- return ( this . _debugContainerKey || '' ) . replace ( 'component:' , '' ) ;
26
- }
27
- } ) ,
28
-
29
- componentCssClassName : computed ( {
30
- get ( ) {
31
- return podNames [ this . get ( '_componentIdentifier' ) ] || '' ;
32
- }
33
- } ) ,
34
-
35
- init ( ) {
36
- this . _super ( ...arguments ) ;
37
-
38
- let name = this . get ( 'componentCssClassName' ) ;
39
-
40
- if ( this . get ( 'tagName' ) !== '' && name ) {
41
- this . classNames = this . classNames . concat ( name ) ;
42
- }
43
- }
44
- } ) ;
45
-
46
- export function initialize ( ) { }
47
-
48
- export default {
49
- name : 'component-styles' ,
50
- initialize
51
- } ;
Original file line number Diff line number Diff line change
1
+ import Ember from 'ember' ;
2
+
3
+ const {
4
+ Component,
5
+ computed,
6
+ Mixin,
7
+ } = Ember ;
8
+
9
+ export default Mixin . create ( {
10
+ _componentIdentifier : computed ( {
11
+ get ( ) {
12
+ return ( this . _debugContainerKey || '' ) . replace ( 'component:' , '' ) ;
13
+ }
14
+ } ) ,
15
+
16
+ _shouldAddNamespacedClassName : computed ( {
17
+ get ( ) {
18
+ return this . get ( 'tagName' ) !== '' && this . get ( 'componentCssClassName' ) ;
19
+ }
20
+ } ) ,
21
+ } ) ;
Original file line number Diff line number Diff line change 1
- export { default , initialize } from 'ember-component-css/initializers/component-styles' ;
1
+ import Ember from 'ember' ;
2
+ import podNames from 'ember-component-css/pod-names' ;
3
+ import StyleNamespacingExtras from '../mixins/style-namespacing-extras' ;
4
+
5
+ const {
6
+ Component,
7
+ ComponentLookup,
8
+ computed,
9
+ getOwner
10
+ } = Ember ;
11
+
12
+ ComponentLookup . reopen ( {
13
+ componentFor ( name , owner ) {
14
+ owner = owner . hasRegistration ? owner : getOwner ( this ) ;
15
+
16
+ if ( podNames [ name ] && ! owner . hasRegistration ( `component:${ name } ` ) ) {
17
+ owner . register ( `component:${ name } ` , Component ) ;
18
+ }
19
+ return this . _super ( ...arguments ) ;
20
+ }
21
+ } ) ;
22
+
23
+ Component . reopen ( StyleNamespacingExtras , {
24
+ componentCssClassName : computed ( {
25
+ get ( ) {
26
+ return podNames [ this . get ( '_componentIdentifier' ) ] || '' ;
27
+ }
28
+ } ) ,
29
+
30
+ init ( ) {
31
+ this . _super ( ...arguments ) ;
32
+
33
+ if ( this . get ( '_shouldAddNamespacedClassName' ) ) {
34
+ this . classNames = this . classNames . concat ( this . get ( 'componentCssClassName' ) ) ;
35
+ }
36
+ }
37
+ } ) ;
38
+
39
+ export function initialize ( ) { }
40
+
41
+ export default {
42
+ name : 'component-styles' ,
43
+ initialize
44
+ } ;
Original file line number Diff line number Diff line change
1
+ export { default } from 'ember-component-css/mixins/style-namespacing-extras' ;
You can’t perform that action at this time.
0 commit comments