2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
2015-10-05 10:10:07 -07:00
|
|
|
/**
|
2016-07-07 23:02:35 -07:00
|
|
|
* Defines template and style encapsulation options available for Component's {@link Component}.
|
2015-10-05 10:10:07 -07:00
|
|
|
*
|
2017-04-25 02:15:33 +02:00
|
|
|
* See {@link Component#encapsulation}.
|
2016-05-25 15:00:05 -07:00
|
|
|
* @stable
|
2015-10-05 10:10:07 -07:00
|
|
|
*/
|
|
|
|
|
export enum ViewEncapsulation {
|
|
|
|
|
/**
|
|
|
|
|
* Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
|
|
|
|
|
* Element and pre-processing the style rules provided via
|
2017-04-25 02:15:33 +02:00
|
|
|
* {@link Component#styles} or {@link Component#styleUrls}, and adding the new Host Element
|
2015-10-05 10:10:07 -07:00
|
|
|
* attribute to all selectors.
|
|
|
|
|
*
|
|
|
|
|
* This is the default option.
|
|
|
|
|
*/
|
|
|
|
|
Emulated,
|
|
|
|
|
/**
|
|
|
|
|
* Use the native encapsulation mechanism of the renderer.
|
|
|
|
|
*
|
|
|
|
|
* For the DOM this means using [Shadow DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
|
|
|
|
|
* creating a ShadowRoot for Component's Host Element.
|
|
|
|
|
*/
|
|
|
|
|
Native,
|
|
|
|
|
/**
|
|
|
|
|
* Don't provide any template or style encapsulation.
|
|
|
|
|
*/
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-17 19:22:13 +00:00
|
|
|
/**
|
2015-09-28 19:58:38 -07:00
|
|
|
* Metadata properties available for configuring Views.
|
2015-03-30 17:19:27 -07:00
|
|
|
*
|
2016-09-12 19:14:17 -07:00
|
|
|
* For details on the `@Component` annotation, see {@link Component}.
|
2015-03-30 17:19:27 -07:00
|
|
|
*
|
2015-10-19 15:37:32 +01:00
|
|
|
* ### Example
|
2015-03-30 17:19:27 -07:00
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
* @Component({
|
2015-10-11 07:41:19 -07:00
|
|
|
* selector: 'greet',
|
2015-04-10 11:15:01 -07:00
|
|
|
* template: 'Hello {{name}}!',
|
2015-03-30 17:19:27 -07:00
|
|
|
* })
|
|
|
|
|
* class Greet {
|
|
|
|
|
* name: string;
|
|
|
|
|
*
|
|
|
|
|
* constructor() {
|
|
|
|
|
* this.name = 'World';
|
|
|
|
|
* }
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
2016-06-27 12:27:23 -07:00
|
|
|
*
|
2016-09-12 19:14:17 -07:00
|
|
|
* @deprecated Use Component instead.
|
2016-09-20 14:14:57 -07:00
|
|
|
*
|
|
|
|
|
* {@link Component}
|
2015-03-17 19:22:13 +00:00
|
|
|
*/
|
2015-08-14 10:03:45 -07:00
|
|
|
export class ViewMetadata {
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#templateUrl} */
|
2017-03-29 09:34:45 -07:00
|
|
|
templateUrl: string|undefined;
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#template} */
|
2017-03-29 09:34:45 -07:00
|
|
|
template: string|undefined;
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#stylesUrl} */
|
2017-03-29 09:34:45 -07:00
|
|
|
styleUrls: string[]|undefined;
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#styles} */
|
2017-03-29 09:34:45 -07:00
|
|
|
styles: string[]|undefined;
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#encapsulation} */
|
2017-03-29 09:34:45 -07:00
|
|
|
encapsulation: ViewEncapsulation|undefined;
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#animation} */
|
2017-03-29 09:34:45 -07:00
|
|
|
animations: any[]|undefined;
|
2017-05-09 23:51:37 +01:00
|
|
|
/** {@link Component#interpolation} */
|
2017-03-29 09:34:45 -07:00
|
|
|
interpolation: [string, string]|undefined;
|
2016-06-20 09:52:41 -07:00
|
|
|
|
2017-06-12 10:59:29 -07:00
|
|
|
constructor(opts: {
|
|
|
|
|
templateUrl?: string,
|
|
|
|
|
template?: string,
|
|
|
|
|
encapsulation?: ViewEncapsulation,
|
|
|
|
|
styles?: string[],
|
|
|
|
|
styleUrls?: string[],
|
|
|
|
|
animations?: any[],
|
|
|
|
|
interpolation?: [string, string]
|
|
|
|
|
} = {}) {
|
|
|
|
|
this.templateUrl = opts.templateUrl;
|
|
|
|
|
this.template = opts.template;
|
|
|
|
|
this.styleUrls = opts.styleUrls;
|
|
|
|
|
this.styles = opts.styles;
|
|
|
|
|
this.encapsulation = opts.encapsulation;
|
|
|
|
|
this.animations = opts.animations;
|
|
|
|
|
this.interpolation = opts.interpolation;
|
2015-07-07 22:09:19 +02:00
|
|
|
}
|
2015-06-12 23:51:42 -07:00
|
|
|
}
|