@@ -61,150 +61,6 @@ function matches(el: Element, selector: string): boolean {
61
61
@module @ember /component
62
62
*/
63
63
64
- interface ComponentMethods {
65
- // Overrideable methods are defined here since you can't `declare` a method in a class
66
-
67
- /**
68
- Called when the attributes passed into the component have been updated.
69
- Called both during the initial render of a container and during a rerender.
70
- Can be used in place of an observer; code placed here will be executed
71
- every time any attribute updates.
72
- @method didReceiveAttrs
73
- @public
74
- @since 1.13.0
75
- */
76
- didReceiveAttrs ( ) : void ;
77
-
78
- /**
79
- Called when the attributes passed into the component have been updated.
80
- Called both during the initial render of a container and during a rerender.
81
- Can be used in place of an observer; code placed here will be executed
82
- every time any attribute updates.
83
- @event didReceiveAttrs
84
- @public
85
- @since 1.13.0
86
- */
87
-
88
- /**
89
- Called after a component has been rendered, both on initial render and
90
- in subsequent rerenders.
91
- @method didRender
92
- @public
93
- @since 1.13.0
94
- */
95
- didRender ( ) : void ;
96
-
97
- /**
98
- Called after a component has been rendered, both on initial render and
99
- in subsequent rerenders.
100
- @event didRender
101
- @public
102
- @since 1.13.0
103
- */
104
-
105
- /**
106
- Called before a component has been rendered, both on initial render and
107
- in subsequent rerenders.
108
- @method willRender
109
- @public
110
- @since 1.13.0
111
- */
112
- willRender ( ) : void ;
113
-
114
- /**
115
- Called before a component has been rendered, both on initial render and
116
- in subsequent rerenders.
117
- @event willRender
118
- @public
119
- @since 1.13.0
120
- */
121
-
122
- /**
123
- Called when the attributes passed into the component have been changed.
124
- Called only during a rerender, not during an initial render.
125
- @method didUpdateAttrs
126
- @public
127
- @since 1.13.0
128
- */
129
- didUpdateAttrs ( ) : void ;
130
-
131
- /**
132
- Called when the attributes passed into the component have been changed.
133
- Called only during a rerender, not during an initial render.
134
- @event didUpdateAttrs
135
- @public
136
- @since 1.13.0
137
- */
138
-
139
- /**
140
- Called when the component is about to update and rerender itself.
141
- Called only during a rerender, not during an initial render.
142
- @method willUpdate
143
- @public
144
- @since 1.13.0
145
- */
146
- willUpdate ( ) : void ;
147
-
148
- /**
149
- Called when the component is about to update and rerender itself.
150
- Called only during a rerender, not during an initial render.
151
- @event willUpdate
152
- @public
153
- @since 1.13.0
154
- */
155
-
156
- /**
157
- Called when the component has updated and rerendered itself.
158
- Called only during a rerender, not during an initial render.
159
- @method didUpdate
160
- @public
161
- @since 1.13.0
162
- */
163
- didUpdate ( ) : void ;
164
-
165
- /**
166
- Called when the component has updated and rerendered itself.
167
- Called only during a rerender, not during an initial render.
168
- @event didUpdate
169
- @public
170
- @since 1.13.0
171
- */
172
-
173
- /**
174
- The HTML `id` of the component's element in the DOM. You can provide this
175
- value yourself but it must be unique (just as in HTML):
176
-
177
- ```handlebars
178
- {{my-component elementId="a-really-cool-id"}}
179
- ```
180
-
181
- ```handlebars
182
- <MyComponent @elementId="a-really-cool-id" />
183
- ```
184
- If not manually set a default value will be provided by the framework.
185
- Once rendered an element's `elementId` is considered immutable and you
186
- should never change it. If you need to compute a dynamic value for the
187
- `elementId`, you should do this when the component or element is being
188
- instantiated:
189
-
190
- ```javascript
191
- export default class extends Component {
192
- init() {
193
- super.init(...arguments);
194
-
195
- var index = this.get('index');
196
- this.set('elementId', `component-id${index}`);
197
- }
198
- }
199
- ```
200
-
201
- @property elementId
202
- @type String
203
- @public
204
- */
205
- layoutName ?: string ;
206
- }
207
-
208
64
// A zero-runtime-overhead private symbol to use in branding the component to
209
65
// preserve its type parameter.
210
66
declare const SIGNATURE : unique symbol ;
@@ -793,34 +649,12 @@ declare const SIGNATURE: unique symbol;
793
649
@uses Ember.ActionSupport
794
650
@public
795
651
*/
796
- // This type param is used in the class, so must appear here.
797
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
798
- interface Component < S = unknown >
799
- extends CoreView ,
800
- TargetActionSupport ,
801
- ActionSupport ,
802
- ComponentMethods { }
803
-
804
652
class Component < S = unknown >
805
- extends CoreView . extend (
806
- TargetActionSupport ,
807
- ActionSupport ,
808
- {
809
- // These need to be overridable via extend/create but should still
810
- // have a default. Defining them here is the best way to achieve that.
811
- didReceiveAttrs ( ) { } ,
812
- didRender ( ) { } ,
813
- didUpdate ( ) { } ,
814
- didUpdateAttrs ( ) { } ,
815
- willRender ( ) { } ,
816
- willUpdate ( ) { } ,
817
- } as ComponentMethods ,
818
- {
819
- concatenatedProperties : [ 'attributeBindings' , 'classNames' , 'classNameBindings' ] ,
820
- classNames : EMPTY_ARRAY ,
821
- classNameBindings : EMPTY_ARRAY ,
822
- }
823
- )
653
+ extends CoreView . extend ( {
654
+ concatenatedProperties : [ 'attributeBindings' , 'classNames' , 'classNameBindings' ] ,
655
+ classNames : EMPTY_ARRAY ,
656
+ classNameBindings : EMPTY_ARRAY ,
657
+ } )
824
658
implements PropertyDidChange
825
659
{
826
660
isComponent = true ;
@@ -1681,6 +1515,98 @@ class Component<S = unknown>
1681
1515
1682
1516
// End ViewMixin
1683
1517
1518
+ // Begin lifecycle hooks
1519
+
1520
+ /**
1521
+ Called when the attributes passed into the component have been updated.
1522
+ Called both during the initial render of a container and during a rerender.
1523
+ Can be used in place of an observer; code placed here will be executed
1524
+ every time any attribute updates.
1525
+ @method didReceiveAttrs
1526
+ @public
1527
+ @since 1.13.0
1528
+ */
1529
+ didReceiveAttrs ( ) : void { }
1530
+
1531
+ /**
1532
+ Called after a component has been rendered, both on initial render and
1533
+ in subsequent rerenders.
1534
+ @method didRender
1535
+ @public
1536
+ @since 1.13.0
1537
+ */
1538
+ didRender ( ) : void { }
1539
+
1540
+ /**
1541
+ Called after a component has been rendered, both on initial render and
1542
+ in subsequent rerenders.
1543
+ @event didRender
1544
+ @public
1545
+ @since 1.13.0
1546
+ */
1547
+
1548
+ /**
1549
+ Called before a component has been rendered, both on initial render and
1550
+ in subsequent rerenders.
1551
+ @method willRender
1552
+ @public
1553
+ @since 1.13.0
1554
+ */
1555
+ willRender ( ) : void { }
1556
+
1557
+ /**
1558
+ Called before a component has been rendered, both on initial render and
1559
+ in subsequent rerenders.
1560
+ @event willRender
1561
+ @public
1562
+ @since 1.13.0
1563
+ */
1564
+
1565
+ /**
1566
+ Called when the attributes passed into the component have been changed.
1567
+ Called only during a rerender, not during an initial render.
1568
+ @method didUpdateAttrs
1569
+ @public
1570
+ @since 1.13.0
1571
+ */
1572
+ didUpdateAttrs ( ) : void { }
1573
+
1574
+ /**
1575
+ Called when the attributes passed into the component have been changed.
1576
+ Called only during a rerender, not during an initial render.
1577
+ @event didUpdateAttrs
1578
+ @public
1579
+ @since 1.13.0
1580
+ */
1581
+
1582
+ /**
1583
+ Called when the component is about to update and rerender itself.
1584
+ Called only during a rerender, not during an initial render.
1585
+ @method willUpdate
1586
+ @public
1587
+ @since 1.13.0
1588
+ */
1589
+ willUpdate ( ) : void { }
1590
+
1591
+ /**
1592
+ Called when the component is about to update and rerender itself.
1593
+ Called only during a rerender, not during an initial render.
1594
+ @event willUpdate
1595
+ @public
1596
+ @since 1.13.0
1597
+ */
1598
+
1599
+ /**
1600
+ Called when the component has updated and rerendered itself.
1601
+ Called only during a rerender, not during an initial render.
1602
+ @method didUpdate
1603
+ @public
1604
+ @since 1.13.0
1605
+ */
1606
+ didUpdate ( ) : void { }
1607
+
1608
+ // End lifecycle hooks
1609
+
1684
1610
static isComponentFactory = true ;
1685
1611
1686
1612
static toString ( ) {
0 commit comments