1
1
/**
2
- * @license Angular v20.0.0-next.1+sha-8be6e38
2
+ * @license Angular v20.0.0-next.1+sha-4fa5d18
3
3
* (c) 2010-2025 Google LLC. https://angular.io/
4
4
* License: MIT
5
5
*/
6
6
7
-
8
- import { Injector } from '@angular/core' ;
9
- import { Observable } from 'rxjs' ;
10
- import { Subscription } from 'rxjs' ;
11
- import { Type } from '@angular/core' ;
12
- import { Version } from '@angular/core' ;
7
+ import { Injector , Type , Version } from '@angular/core' ;
8
+ import { Observable , Subscription } from 'rxjs' ;
13
9
14
10
/**
15
- * @description Creates a custom element class based on an Angular component .
11
+ * Interface for the events emitted through the NgElementStrategy .
16
12
*
17
- * Builds a class that encapsulates the functionality of the provided component and
18
- * uses the configuration information to provide more context to the class.
19
- * Takes the component factory's inputs and outputs to convert them to the proper
20
- * custom element API and add hooks to input changes.
13
+ * @publicApi
14
+ */
15
+ interface NgElementStrategyEvent {
16
+ name : string ;
17
+ value : any ;
18
+ }
19
+ /**
20
+ * Underlying strategy used by the NgElement to create/destroy the component and react to input
21
+ * changes.
21
22
*
22
- * The configuration's injector is the initial injector set on the class,
23
- * and used by default for each created instance.This behavior can be overridden with the
24
- * static property to affect all newly created instances, or as a constructor argument for
25
- * one-off creations.
23
+ * @publicApi
24
+ */
25
+ interface NgElementStrategy {
26
+ events : Observable < NgElementStrategyEvent > ;
27
+ connect ( element : HTMLElement ) : void ;
28
+ disconnect ( ) : void ;
29
+ getInputValue ( propName : string ) : any ;
30
+ setInputValue ( propName : string , value : string , transform ?: ( value : any ) => any ) : void ;
31
+ }
32
+ /**
33
+ * Factory used to create new strategies for each NgElement instance.
26
34
*
27
- * @see [Angular Elements Overview](guide/elements "Turning Angular components into custom elements")
35
+ * @publicApi
36
+ */
37
+ interface NgElementStrategyFactory {
38
+ /** Creates a new instance to be used for an NgElement. */
39
+ create ( injector : Injector ) : NgElementStrategy ;
40
+ }
41
+
42
+ /**
43
+ * Prototype for a class constructor based on an Angular component
44
+ * that can be used for custom element registration. Implemented and returned
45
+ * by the {@link createCustomElement createCustomElement() function}.
28
46
*
29
- * @param component The component to transform.
30
- * @param config A configuration that provides initialization information to the created class.
31
- * @returns The custom-element construction class, which can be registered with
32
- * a browser's `CustomElementRegistry`.
47
+ * @see [Angular Elements Overview](guide/elements "Turning Angular components into custom elements")
33
48
*
34
49
* @publicApi
35
50
*/
36
- export declare function createCustomElement < P > ( component : Type < any > , config : NgElementConfig ) : NgElementConstructor < P > ;
37
-
51
+ interface NgElementConstructor < P > {
52
+ /**
53
+ * An array of observed attribute names for the custom element,
54
+ * derived by transforming input property names from the source component.
55
+ */
56
+ readonly observedAttributes : string [ ] ;
57
+ /**
58
+ * Initializes a constructor instance.
59
+ * @param injector If provided, overrides the configured injector.
60
+ */
61
+ new ( injector ?: Injector ) : NgElement & WithProperties < P > ;
62
+ }
38
63
/**
39
64
* Implements the functionality needed for a custom element.
40
65
*
41
66
* @publicApi
42
67
*/
43
- export declare abstract class NgElement extends HTMLElement {
68
+ declare abstract class NgElement extends HTMLElement {
44
69
/**
45
70
* The strategy that controls how a component is transformed in a custom element.
46
71
*/
@@ -69,15 +94,24 @@ export declare abstract class NgElement extends HTMLElement {
69
94
*/
70
95
abstract disconnectedCallback ( ) : void ;
71
96
}
72
-
97
+ /**
98
+ * Additional type information that can be added to the NgElement class,
99
+ * for properties that are added based
100
+ * on the inputs and methods of the underlying component.
101
+ *
102
+ * @publicApi
103
+ */
104
+ type WithProperties < P > = {
105
+ [ property in keyof P ] : P [ property ] ;
106
+ } ;
73
107
/**
74
108
* A configuration that initializes an NgElementConstructor with the
75
109
* dependencies and strategy it needs to transform a component into
76
110
* a custom element class.
77
111
*
78
112
* @publicApi
79
113
*/
80
- export declare interface NgElementConfig {
114
+ interface NgElementConfig {
81
115
/**
82
116
* The injector to use for retrieving the component's factory.
83
117
*/
@@ -88,77 +122,33 @@ export declare interface NgElementConfig {
88
122
*/
89
123
strategyFactory ?: NgElementStrategyFactory ;
90
124
}
91
-
92
125
/**
93
- * Prototype for a class constructor based on an Angular component
94
- * that can be used for custom element registration. Implemented and returned
95
- * by the {@link createCustomElement createCustomElement() function}.
126
+ * @description Creates a custom element class based on an Angular component.
96
127
*
97
- * @see [Angular Elements Overview](guide/elements "Turning Angular components into custom elements")
128
+ * Builds a class that encapsulates the functionality of the provided component and
129
+ * uses the configuration information to provide more context to the class.
130
+ * Takes the component factory's inputs and outputs to convert them to the proper
131
+ * custom element API and add hooks to input changes.
98
132
*
99
- * @publicApi
100
- */
101
- export declare interface NgElementConstructor < P > {
102
- /**
103
- * An array of observed attribute names for the custom element,
104
- * derived by transforming input property names from the source component.
105
- */
106
- readonly observedAttributes : string [ ] ;
107
- /**
108
- * Initializes a constructor instance.
109
- * @param injector If provided, overrides the configured injector.
110
- */
111
- new ( injector ?: Injector ) : NgElement & WithProperties < P > ;
112
- }
113
-
114
- /**
115
- * Underlying strategy used by the NgElement to create/destroy the component and react to input
116
- * changes.
133
+ * The configuration's injector is the initial injector set on the class,
134
+ * and used by default for each created instance.This behavior can be overridden with the
135
+ * static property to affect all newly created instances, or as a constructor argument for
136
+ * one-off creations.
117
137
*
118
- * @publicApi
119
- */
120
- export declare interface NgElementStrategy {
121
- events : Observable < NgElementStrategyEvent > ;
122
- connect ( element : HTMLElement ) : void ;
123
- disconnect ( ) : void ;
124
- getInputValue ( propName : string ) : any ;
125
- setInputValue ( propName : string , value : string , transform ?: ( value : any ) => any ) : void ;
126
- }
127
-
128
- /**
129
- * Interface for the events emitted through the NgElementStrategy.
138
+ * @see [Angular Elements Overview](guide/elements "Turning Angular components into custom elements")
130
139
*
131
- * @publicApi
132
- */
133
- export declare interface NgElementStrategyEvent {
134
- name : string ;
135
- value : any ;
136
- }
137
-
138
- /**
139
- * Factory used to create new strategies for each NgElement instance.
140
+ * @param component The component to transform.
141
+ * @param config A configuration that provides initialization information to the created class.
142
+ * @returns The custom-element construction class, which can be registered with
143
+ * a browser's `CustomElementRegistry`.
140
144
*
141
145
* @publicApi
142
146
*/
143
- export declare interface NgElementStrategyFactory {
144
- /** Creates a new instance to be used for an NgElement. */
145
- create ( injector : Injector ) : NgElementStrategy ;
146
- }
147
-
148
- /**
149
- * @publicApi
150
- */
151
- export declare const VERSION : Version ;
147
+ declare function createCustomElement < P > ( component : Type < any > , config : NgElementConfig ) : NgElementConstructor < P > ;
152
148
153
149
/**
154
- * Additional type information that can be added to the NgElement class,
155
- * for properties that are added based
156
- * on the inputs and methods of the underlying component.
157
- *
158
150
* @publicApi
159
151
*/
160
- export declare type WithProperties < P > = {
161
- [ property in keyof P ] : P [ property ] ;
162
- } ;
152
+ declare const VERSION : Version ;
163
153
164
- export { }
154
+ export { NgElement , type NgElementConfig , type NgElementConstructor , type NgElementStrategy , type NgElementStrategyEvent , type NgElementStrategyFactory , VERSION , type WithProperties , createCustomElement } ;
0 commit comments