UNPKG

3.55 kBTypeScriptView Raw
1declare module '@ember/component' {
2 /**
3 @module @ember/component
4 @public
5 */
6 export { setComponentTemplate, getComponentTemplate } from '@glimmer/manager';
7 export { Component as default, Input, Textarea } from '@ember/-internals/glimmer';
8 export {
9 componentCapabilities as capabilities,
10 setComponentManager,
11 } from '@ember/-internals/glimmer';
12 /**
13 * Assigns a TemplateFactory to a component class.
14 *
15 * @method setComponentTemplate
16 * @static
17 * @for @ember/component
18 * @public
19 *
20 * ```js
21 * import Component from '@glimmer/component';
22 * import { hbs } from 'ember-cli-htmlbars';
23 * import { setComponentTemplate } from '@ember/component';
24 *
25 * export default class Demo extends Component {
26 * // ...
27 * }
28 *
29 * setComponentTemplate(hbs`
30 * <div>my template</div>
31 * `, Demo);
32 * ```
33 *
34 * @param {TemplateFactory} templateFactory
35 * @param {object} componentDefinition
36 */
37 /**
38 * Returns the TemplateFactory associated with a component
39 *
40 * @method getComponentTemplate
41 * @static
42 * @for @ember/component
43 * @public
44 *
45 * ```js
46 * import Component from '@glimmer/component';
47 * import { hbs } from 'ember-cli-htmlbars';
48 * import { getComponentTemplate } from '@ember/component';
49 *
50 * export default class Demo extends Component {
51 * // ...
52 * }
53 *
54 * let theTemplateFactory = getTemplateFactory(Demo)
55 * ```
56 *
57 * @param {object} componentDefinition
58 * @returns {TemplateFactory}
59 */
60 /**
61 * Tell the VM how manage a type of object / class when encountered
62 * via component-invocation.
63 *
64 * A Component Manager, must implement this interface:
65 * - static create()
66 * - createComponent()
67 * - updateComponent()
68 * - destroyComponent()
69 * - getContext()
70 *
71 * @method setComponentManager
72 * @static
73 * @for @ember/component
74 * @public
75 *
76 *
77 * After a component manager is registered via `setComponentManager`,
78 *
79 * ```js
80 * import { StateNode } from 'xstate';
81 * import ComponentManager from './-private/statechart-manager';
82 *
83 * setComponentManager((owner) => ComponentManager.create(owner), StateNode.prototype);
84 * ```
85 *
86 * Instances of the class can be used as component.
87 * No need to extend from `@glimmer/component`.
88 *
89 * ```js
90 * // app/components/my-component.js
91 * import { createMachine } from 'xstate';
92 *
93 * export default createMachine({ ... });
94 * ```
95 * ```hbs
96 * {{!-- app/templates/application.hbs}}
97 * <MyComponent />
98 * ```
99 *
100 * @param {(owner: Owner) => import('@glimmer/interfaces').ComponentManager} managerFactory
101 * @param {object} object that will be managed by the return value of `managerFactory`
102 *
103 */
104 /**
105 * Tells Glimmer what capabilities a Component Manager will have
106 *
107 * ```js
108 * import { capabilities } from '@ember/component';
109 *
110 * export class MyComponentManager {
111 * capabilities = capabilities('3.13', {
112 * // capabilities listed here
113 * })
114 * }
115 * ```
116 *
117 *
118 * For a full list of capabilities, their defaults, and how they are used, see [@glimmer/manager](https://github.com/glimmerjs/glimmer-vm/blob/4f1bef0d9a8a3c3ebd934c5b6e09de4c5f6e4468/packages/%40glimmer/manager/lib/public/component.ts#L26)
119 *
120 *
121 * @method capabilities
122 * @static
123 * @for @ember/component
124 * @public
125 * @param {'3.13'} managerApiVersion
126 * @param {Parameters<import('@ember/-internals/glimmer').componentCapabilities>[1]} options
127 *
128 */
129}