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