UNPKG

2.63 kBTypeScriptView Raw
1declare module '@ember/-internals/glimmer/lib/utils/outlet' {
2 import type { InternalOwner } from '@ember/-internals/owner';
3 import type { Template } from '@glimmer/interfaces';
4 export interface RenderState {
5 /**
6 * This is usually inherited from the parent (all the way up to the app
7 * instance). However, engines uses this to swap out the owner when crossing
8 * a mount point.
9 */
10 owner: InternalOwner;
11 /**
12 * @deprecated This used to specify "which parent route to render into",
13 * which is not a thing anymore.
14 */
15 into: undefined;
16 /**
17 * @deprecated This used to specify "which named outlet in the parent
18 * template to render into", which is not a thing anymore.
19 */
20 outlet: 'main';
21 /**
22 * The name of the route/template
23 */
24 name: string;
25 /**
26 * The controller (the self of the outlet component)
27 */
28 controller: unknown;
29 /**
30 * The model (the resolved value of the model hook)
31 */
32 model: unknown;
33 /**
34 * template (the layout of the outlet component)
35 */
36 template: Template | undefined;
37 }
38 export interface OutletState {
39 /**
40 * Represents what was rendered into this outlet.
41 */
42 render: RenderState | undefined;
43 /**
44 * Represents what, if any, should be rendered into the next {{outlet}} found
45 * at this level.
46 *
47 * This used to be a dictionary of children outlets, including the {{outlet}}
48 * "main" outlet any {{outlet "named"}} named outlets. Since named outlets
49 * are not a thing anymore, this can now just be a single`child`.
50 */
51 outlets: {
52 main: OutletState | undefined;
53 };
54 /**
55 * @deprecated
56 *
57 * This tracks whether this outlet state actually made it onto the page
58 * somewhere. This was more of a problem when you can declare named outlets
59 * left and right, and anything can render into anywhere else. We want to
60 * warn users when you tried to render into somewhere that does not exist,
61 * but we don't know what named outlets exists until after we have rendered
62 * everything, so this was used to track these orphan renders.
63 *
64 * This can still happen, if, according to the router, a route is active and
65 * so its template should be rendered, but the parent template is missing the
66 * `{{outlet}}` keyword, or that it was hidden by an `{{#if}}` or something.
67 * I guess that is considered valid, because nothing checks for this anymore.
68 * seems valid for the parent to decide not to render a child template?
69 */
70 wasUsed?: undefined;
71 }
72}