refactor(core): clean up circular dependencies (#39722)
Clean up circular dependencies in core by pulling symbols out to their respective files. PR Close #39722
This commit is contained in:
parent
6fbe21941d
commit
3b2e5be6cb
|
@ -108,12 +108,6 @@
|
|||
"packages/compiler/src/render3/view/styling_builder.ts",
|
||||
"packages/compiler/src/render3/view/template.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/application_ref.ts",
|
||||
"packages/core/src/linker/compiler.ts",
|
||||
"packages/core/src/metadata.ts",
|
||||
"packages/core/src/metadata/do_boostrap.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/change_detection/change_detection.ts",
|
||||
"packages/core/src/change_detection/change_detector_ref.ts",
|
||||
|
@ -182,64 +176,6 @@
|
|||
"packages/core/src/change_detection/differs/default_keyvalue_differ.ts",
|
||||
"packages/core/src/change_detection/differs/keyvalue_differs.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/core.ts",
|
||||
"packages/core/src/metadata.ts",
|
||||
"packages/core/src/di.ts",
|
||||
"packages/core/src/di/index.ts",
|
||||
"packages/core/src/di/injectable.ts",
|
||||
"packages/core/src/di/jit/injectable.ts",
|
||||
"packages/core/src/di/jit/environment.ts",
|
||||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/r3_injector.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/core.ts",
|
||||
"packages/core/src/metadata.ts",
|
||||
"packages/core/src/metadata/directives.ts",
|
||||
"packages/core/src/render3/jit/directive.ts",
|
||||
"packages/core/src/render3/jit/environment.ts",
|
||||
"packages/core/src/render3/index.ts",
|
||||
"packages/core/src/render3/component.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/debug/debug_node.ts",
|
||||
"packages/core/src/view/index.ts",
|
||||
"packages/core/src/view/entrypoint.ts",
|
||||
"packages/core/src/view/services.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di.ts",
|
||||
"packages/core/src/di/index.ts",
|
||||
"packages/core/src/di/injectable.ts",
|
||||
"packages/core/src/di/jit/injectable.ts",
|
||||
"packages/core/src/di/jit/environment.ts",
|
||||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/null_injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di.ts",
|
||||
"packages/core/src/di/index.ts",
|
||||
"packages/core/src/di/injectable.ts",
|
||||
"packages/core/src/di/jit/injectable.ts",
|
||||
"packages/core/src/di/jit/environment.ts",
|
||||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/r3_injector.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts",
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts",
|
||||
"packages/core/src/metadata.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injectable.ts",
|
||||
"packages/core/src/di/jit/injectable.ts"
|
||||
|
@ -248,35 +184,17 @@
|
|||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/null_injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/r3_injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injector_token.ts",
|
||||
"packages/core/src/di/injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/r3_injector.ts"
|
||||
"packages/core/src/di/null_injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injector.ts",
|
||||
"packages/core/src/di/r3_injector.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts",
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts"
|
||||
"packages/core/src/di/r3_injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/reflective_errors.ts",
|
||||
|
@ -323,142 +241,28 @@
|
|||
"packages/core/src/render3/jit/module.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts",
|
||||
"packages/core/src/render3/interfaces/query.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/interfaces/type_checks.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/assert.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/assert.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/assert.ts",
|
||||
"packages/core/src/render3/interfaces/injector.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/assert.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/util/view_utils.ts",
|
||||
"packages/core/src/render3/interfaces/context.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/util/view_utils.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render/api.ts",
|
||||
"packages/core/src/render3/state.ts",
|
||||
"packages/core/src/render3/util/view_utils.ts",
|
||||
"packages/core/src/render3/interfaces/renderer.ts"
|
||||
"packages/core/src/render3/interfaces/view.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render3/interfaces/node.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts",
|
||||
"packages/core/src/render3/interfaces/query.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/render3/interfaces/query.ts",
|
||||
"packages/core/src/render3/interfaces/view.ts"
|
||||
|
|
|
@ -13,11 +13,11 @@ import {TElementNode, TNode, TNodeFlags, TNodeType} from '../render3/interfaces/
|
|||
import {isComponentHost, isLContainer} from '../render3/interfaces/type_checks';
|
||||
import {DECLARATION_COMPONENT_VIEW, LView, PARENT, T_HOST, TData, TVIEW} from '../render3/interfaces/view';
|
||||
import {getComponent, getContext, getInjectionTokens, getInjector, getListeners, getLocalRefs, getOwningComponent, loadLContext} from '../render3/util/discovery_utils';
|
||||
import {INTERPOLATION_DELIMITER, renderStringify} from '../render3/util/misc_utils';
|
||||
import {INTERPOLATION_DELIMITER} from '../render3/util/misc_utils';
|
||||
import {renderStringify} from '../render3/util/stringify_utils';
|
||||
import {getComponentLViewByIndex, getNativeByTNodeOrNull} from '../render3/util/view_utils';
|
||||
import {assertDomNode} from '../util/assert';
|
||||
import {DebugContext} from '../view/index';
|
||||
|
||||
import {DebugContext} from '../view/types';
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
import '../util/ng_dev_mode';
|
||||
|
||||
import {Type} from '../interface/type';
|
||||
import {assertNotEqual} from '../util/assert';
|
||||
import {getClosureSafeProperty} from '../util/property';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
import {getInjectImplementation, injectRootLimpMode} from './inject_switch';
|
||||
import {InjectionToken} from './injection_token';
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
*/
|
||||
|
||||
import {stringify} from '../util/stringify';
|
||||
import {Injector} from '.';
|
||||
import {Injector} from './injector';
|
||||
import {THROW_IF_NOT_FOUND} from './injector_compatibility';
|
||||
|
||||
|
||||
export class NullInjector implements Injector {
|
||||
get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any {
|
||||
if (notFoundValue === THROW_IF_NOT_FOUND) {
|
||||
|
|
|
@ -10,9 +10,8 @@ import '../util/ng_dev_mode';
|
|||
|
||||
import {OnDestroy} from '../interface/lifecycle_hooks';
|
||||
import {Type} from '../interface/type';
|
||||
import {getFactoryDef} from '../render3/definition';
|
||||
import {throwCyclicDependencyError, throwInvalidProviderError, throwMixedMultiProviderError} from '../render3/errors';
|
||||
import {FactoryFn} from '../render3/interfaces/definition';
|
||||
import {FactoryFn, getFactoryDef} from '../render3/definition_factory';
|
||||
import {throwCyclicDependencyError, throwInvalidProviderError, throwMixedMultiProviderError} from '../render3/errors_di';
|
||||
import {deepForEach, newArray} from '../util/array_utils';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import {InjectionToken} from '../di/injection_token';
|
|||
import {StaticProvider} from '../di/interface/provider';
|
||||
import {MissingTranslationStrategy} from '../i18n/tokens';
|
||||
import {Type} from '../interface/type';
|
||||
import {ViewEncapsulation} from '../metadata';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {ComponentFactory as ComponentFactoryR3} from '../render3/component_ref';
|
||||
import {getComponentDef, getNgModuleDef} from '../render3/definition';
|
||||
import {NgModuleFactory as NgModuleFactoryR3} from '../render3/ng_module_ref';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {TNode} from '../render3/interfaces/node';
|
||||
import {RElement} from '../render3/interfaces/renderer';
|
||||
import {RElement} from '../render3/interfaces/renderer_dom';
|
||||
import {LView} from '../render3/interfaces/view';
|
||||
import {getCurrentTNode, getLView} from '../render3/state';
|
||||
import {getNativeByTNode} from '../render3/util/view_utils';
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
import {Injector} from '../di/injector';
|
||||
import {assertNodeInjector} from '../render3/assert';
|
||||
import {getParentInjectorLocation, NodeInjector} from '../render3/di';
|
||||
import {addToViewTree, createLContainer, createTNode} from '../render3/instructions/shared';
|
||||
import {addToViewTree, createLContainer} from '../render3/instructions/shared';
|
||||
import {CONTAINER_HEADER_OFFSET, LContainer, NATIVE, VIEW_REFS} from '../render3/interfaces/container';
|
||||
import {NodeInjectorOffset} from '../render3/interfaces/injector';
|
||||
import {TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNodeType} from '../render3/interfaces/node';
|
||||
import {RComment, RElement} from '../render3/interfaces/renderer';
|
||||
import {isLContainer, isRootView} from '../render3/interfaces/type_checks';
|
||||
import {RComment, RElement} from '../render3/interfaces/renderer_dom';
|
||||
import {isLContainer} from '../render3/interfaces/type_checks';
|
||||
import {LView, PARENT, RENDERER, T_HOST, TVIEW} from '../render3/interfaces/view';
|
||||
import {assertTNodeType} from '../render3/node_assert';
|
||||
import {addViewToContainer, appendChild, destroyLView, detachView, getBeforeNodeForView, insertView, nativeInsertBefore, nativeNextSibling, nativeParentNode} from '../render3/node_manipulation';
|
||||
import {addViewToContainer, destroyLView, detachView, getBeforeNodeForView, insertView, nativeInsertBefore, nativeNextSibling, nativeParentNode} from '../render3/node_manipulation';
|
||||
import {getCurrentTNode, getLView} from '../render3/state';
|
||||
import {getParentInjectorIndex, getParentInjectorView, hasParentInjector} from '../render3/util/injector_utils';
|
||||
import {getNativeByTNode, unwrapRNode, viewAttachedToContainer} from '../render3/util/view_utils';
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
|
||||
export {Attribute} from './di';
|
||||
export {Attribute} from './di/metadata';
|
||||
export {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from './interface/lifecycle_hooks';
|
||||
export {ANALYZE_FOR_ENTRY_COMPONENTS, ContentChild, ContentChildDecorator, ContentChildren, ContentChildrenDecorator, Query, ViewChild, ViewChildDecorator, ViewChildren, ViewChildrenDecorator} from './metadata/di';
|
||||
export {Component, ComponentDecorator, Directive, DirectiveDecorator, HostBinding, HostBindingDecorator, HostListener, HostListenerDecorator, Input, InputDecorator, Output, OutputDecorator, Pipe, PipeDecorator} from './metadata/directives';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {Provider} from '../di';
|
||||
import {Provider} from '../di/interface/provider';
|
||||
import {Type} from '../interface/type';
|
||||
import {compileComponent as render3CompileComponent, compileDirective as render3CompileDirective} from '../render3/jit/directive';
|
||||
import {compilePipe as render3CompilePipe} from '../render3/jit/pipe';
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
*/
|
||||
|
||||
// Public API for render
|
||||
export {Renderer2, RendererFactory2, RendererStyleFlags2, RendererType2} from './render/api';
|
||||
export {Renderer2, RendererFactory2} from './render/api';
|
||||
export {RendererStyleFlags2, RendererType2} from './render/api_flags';
|
||||
|
|
|
@ -7,49 +7,17 @@
|
|||
*/
|
||||
|
||||
import {InjectionToken} from '../di/injection_token';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {isProceduralRenderer} from '../render3/interfaces/renderer';
|
||||
import {isLView} from '../render3/interfaces/type_checks';
|
||||
import {LView, RENDERER} from '../render3/interfaces/view';
|
||||
import {getCurrentTNode, getLView} from '../render3/state';
|
||||
import {getComponentLViewByIndex} from '../render3/util/view_utils';
|
||||
import {noop} from '../util/noop';
|
||||
import {RendererStyleFlags2, RendererType2} from './api_flags';
|
||||
|
||||
|
||||
export const Renderer2Interceptor = new InjectionToken<Renderer2[]>('Renderer2Interceptor');
|
||||
|
||||
/**
|
||||
* Used by `RendererFactory2` to associate custom rendering data and styles
|
||||
* with a rendering implementation.
|
||||
* @publicApi
|
||||
*/
|
||||
export interface RendererType2 {
|
||||
/**
|
||||
* A unique identifying string for the new renderer, used when creating
|
||||
* unique styles for encapsulation.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The view encapsulation type, which determines how styles are applied to
|
||||
* DOM elements. One of
|
||||
* - `Emulated` (default): Emulate native scoping of styles.
|
||||
* - `Native`: Use the native encapsulation mechanism of the renderer.
|
||||
* - `ShadowDom`: Use modern [Shadow
|
||||
* DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
|
||||
* create a ShadowRoot for component's host element.
|
||||
* - `None`: Do not provide any template or style encapsulation.
|
||||
*/
|
||||
encapsulation: ViewEncapsulation;
|
||||
/**
|
||||
* Defines CSS styles to be stored on a renderer instance.
|
||||
*/
|
||||
styles: (string|any[])[];
|
||||
/**
|
||||
* Defines arbitrary developer-defined data to be stored on a renderer instance.
|
||||
* This is useful for renderers that delegate to other renderers.
|
||||
*/
|
||||
data: {[kind: string]: any};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and initializes a custom renderer that implements the `Renderer2` base class.
|
||||
|
@ -79,23 +47,6 @@ export abstract class RendererFactory2 {
|
|||
abstract whenRenderingDone?(): Promise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags for renderer-specific style modifiers.
|
||||
* @publicApi
|
||||
*/
|
||||
export enum RendererStyleFlags2 {
|
||||
// TODO(misko): This needs to be refactored into a separate file so that it can be imported from
|
||||
// `node_manipulation.ts` Currently doing the import cause resolution order to change and fails
|
||||
// the tests. The work around is to have hard coded value in `node_manipulation.ts` for now.
|
||||
/**
|
||||
* Marks a style as important.
|
||||
*/
|
||||
Important = 1 << 0,
|
||||
/**
|
||||
* Marks a style as using dash case naming (this-is-dash-case).
|
||||
*/
|
||||
DashCase = 1 << 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend this base class to implement custom rendering. By default, Angular
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC 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
|
||||
*/
|
||||
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
|
||||
|
||||
/**
|
||||
* Used by `RendererFactory2` to associate custom rendering data and styles
|
||||
* with a rendering implementation.
|
||||
* @publicApi
|
||||
*/
|
||||
export interface RendererType2 {
|
||||
/**
|
||||
* A unique identifying string for the new renderer, used when creating
|
||||
* unique styles for encapsulation.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The view encapsulation type, which determines how styles are applied to
|
||||
* DOM elements. One of
|
||||
* - `Emulated` (default): Emulate native scoping of styles.
|
||||
* - `Native`: Use the native encapsulation mechanism of the renderer.
|
||||
* - `ShadowDom`: Use modern [Shadow
|
||||
* DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
|
||||
* create a ShadowRoot for component's host element.
|
||||
* - `None`: Do not provide any template or style encapsulation.
|
||||
*/
|
||||
encapsulation: ViewEncapsulation;
|
||||
/**
|
||||
* Defines CSS styles to be stored on a renderer instance.
|
||||
*/
|
||||
styles: (string|any[])[];
|
||||
/**
|
||||
* Defines arbitrary developer-defined data to be stored on a renderer instance.
|
||||
* This is useful for renderers that delegate to other renderers.
|
||||
*/
|
||||
data: {[kind: string]: any};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flags for renderer-specific style modifiers.
|
||||
* @publicApi
|
||||
*/
|
||||
export enum RendererStyleFlags2 {
|
||||
// TODO(misko): This needs to be refactored into a separate file so that it can be imported from
|
||||
// `node_manipulation.ts` Currently doing the import cause resolution order to change and fails
|
||||
// the tests. The work around is to have hard coded value in `node_manipulation.ts` for now.
|
||||
/**
|
||||
* Marks a style as important.
|
||||
*/
|
||||
Important = 1 << 0,
|
||||
/**
|
||||
* Marks a style as using dash case naming (this-is-dash-case).
|
||||
*/
|
||||
DashCase = 1 << 1
|
||||
}
|
|
@ -11,7 +11,7 @@ import {assertDefined} from '../util/assert';
|
|||
import {icuContainerIterate} from './i18n/i18n_tree_shaking';
|
||||
import {CONTAINER_HEADER_OFFSET} from './interfaces/container';
|
||||
import {TElementNode, TIcuContainerNode, TNode, TNodeType} from './interfaces/node';
|
||||
import {RNode} from './interfaces/renderer';
|
||||
import {RNode} from './interfaces/renderer_dom';
|
||||
import {isLContainer} from './interfaces/type_checks';
|
||||
import {DECLARATION_COMPONENT_VIEW, LView, T_HOST, TVIEW, TView} from './interfaces/view';
|
||||
import {assertTNodeType} from './node_assert';
|
||||
|
|
|
@ -8,27 +8,28 @@
|
|||
|
||||
// We are temporarily importing the existing viewEngine from core so we can be sure we are
|
||||
// correctly implementing its interfaces for backwards compatibility.
|
||||
import {Type} from '../core';
|
||||
import {Injector} from '../di/injector';
|
||||
import {Type} from '../interface/type';
|
||||
import {Sanitizer} from '../sanitization/sanitizer';
|
||||
import {assertDefined, assertIndexInRange} from '../util/assert';
|
||||
import {assertComponentType} from './assert';
|
||||
import {getComponentDef} from './definition';
|
||||
import {diPublicInInjector, getOrCreateNodeInjectorForNode} from './di';
|
||||
import {throwProviderNotFoundError} from './errors';
|
||||
import {throwProviderNotFoundError} from './errors_di';
|
||||
import {registerPostOrderHooks} from './hooks';
|
||||
import {addToViewTree, CLEAN_PROMISE, createLView, createTView, getOrCreateTComponentView, getOrCreateTNode, initTNodeFlags, instantiateRootComponent, invokeHostBindingsInCreationMode, locateHostElement, markAsComponentHost, refreshView, registerHostBindingOpCodes, renderView} from './instructions/shared';
|
||||
import {ComponentDef, ComponentType, RenderFlags} from './interfaces/definition';
|
||||
import {TElementNode, TNodeType} from './interfaces/node';
|
||||
import {PlayerHandler} from './interfaces/player';
|
||||
import {domRendererFactory3, RElement, Renderer3, RendererFactory3} from './interfaces/renderer';
|
||||
import {domRendererFactory3, Renderer3, RendererFactory3} from './interfaces/renderer';
|
||||
import {RElement} from './interfaces/renderer_dom';
|
||||
import {CONTEXT, HEADER_OFFSET, LView, LViewFlags, RootContext, RootContextFlags, TVIEW, TViewType} from './interfaces/view';
|
||||
import {writeDirectClass, writeDirectStyle} from './node_manipulation';
|
||||
import {enterView, getCurrentTNode, leaveView, setSelectedIndex} from './state';
|
||||
import {computeStaticStyling} from './styling/static_styling';
|
||||
import {setUpAttributes} from './util/attrs_utils';
|
||||
import {publishDefaultGlobalUtils} from './util/global_utils';
|
||||
import {defaultScheduler, stringifyForError} from './util/misc_utils';
|
||||
import {defaultScheduler} from './util/misc_utils';
|
||||
import {getRootContext} from './util/view_traversal_utils';
|
||||
import {readPatchedLView} from './util/view_utils';
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ import {NodeInjector} from './di';
|
|||
import {createLView, createTView, locateHostElement, renderView} from './instructions/shared';
|
||||
import {ComponentDef} from './interfaces/definition';
|
||||
import {TContainerNode, TElementContainerNode, TElementNode, TNode} from './interfaces/node';
|
||||
import {domRendererFactory3, RendererFactory3, RNode} from './interfaces/renderer';
|
||||
import {domRendererFactory3, RendererFactory3} from './interfaces/renderer';
|
||||
import {RNode} from './interfaces/renderer_dom';
|
||||
import {HEADER_OFFSET, LView, LViewFlags, TViewType} from './interfaces/view';
|
||||
import {MATH_ML_NAMESPACE, SVG_NAMESPACE} from './namespaces';
|
||||
import {createElementNode, writeDirectClass} from './node_manipulation';
|
||||
|
|
|
@ -12,7 +12,7 @@ import {assertDomNode} from '../util/assert';
|
|||
import {EMPTY_ARRAY} from './empty';
|
||||
import {LContext, MONKEY_PATCH_KEY_NAME} from './interfaces/context';
|
||||
import {TNode, TNodeFlags} from './interfaces/node';
|
||||
import {RElement, RNode} from './interfaces/renderer';
|
||||
import {RElement, RNode} from './interfaces/renderer_dom';
|
||||
import {CONTEXT, HEADER_OFFSET, HOST, LView, TVIEW} from './interfaces/view';
|
||||
import {getComponentLViewByIndex, readPatchedData, unwrapRNode} from './util/view_utils';
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@ import {ViewEncapsulation} from '../metadata/view';
|
|||
import {noSideEffects} from '../util/closure';
|
||||
import {initNgDevMode} from '../util/ng_dev_mode';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from './empty';
|
||||
import {NG_COMP_DEF, NG_DIR_DEF, NG_FACTORY_DEF, NG_LOC_ID_DEF, NG_MOD_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {ComponentDef, ComponentDefFeature, ComponentTemplate, ComponentType, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, DirectiveTypesOrFactory, FactoryFn, HostBindingsFunction, PipeDef, PipeType, PipeTypesOrFactory, ViewQueriesFunction} from './interfaces/definition';
|
||||
import {NG_COMP_DEF, NG_DIR_DEF, NG_LOC_ID_DEF, NG_MOD_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {ComponentDef, ComponentDefFeature, ComponentTemplate, ComponentType, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, DirectiveTypesOrFactory, HostBindingsFunction, PipeDef, PipeTypesOrFactory, ViewQueriesFunction} from './interfaces/definition';
|
||||
import {AttributeMarker, TAttributes, TConstantsOrFactory} from './interfaces/node';
|
||||
import {CssSelectorList, SelectorFlags} from './interfaces/projection';
|
||||
|
||||
|
||||
let _renderCompCount = 0;
|
||||
|
||||
// While these types are unused here, they are required so that types don't
|
||||
|
@ -745,16 +745,6 @@ export function getPipeDef<T>(type: any): PipeDef<T>|null {
|
|||
return type[NG_PIPE_DEF] || null;
|
||||
}
|
||||
|
||||
export function getFactoryDef<T>(type: any, throwNotFound: true): FactoryFn<T>;
|
||||
export function getFactoryDef<T>(type: any): FactoryFn<T>|null;
|
||||
export function getFactoryDef<T>(type: any, throwNotFound?: boolean): FactoryFn<T>|null {
|
||||
const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
|
||||
if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
|
||||
throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
|
||||
}
|
||||
return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
|
||||
}
|
||||
|
||||
export function getNgModuleDef<T>(type: any, throwNotFound: true): NgModuleDef<T>;
|
||||
export function getNgModuleDef<T>(type: any): NgModuleDef<T>|null;
|
||||
export function getNgModuleDef<T>(type: any, throwNotFound?: boolean): NgModuleDef<T>|null {
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC 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
|
||||
*/
|
||||
|
||||
import {Type} from '../interface/type';
|
||||
import {stringify} from '../util/stringify';
|
||||
import {NG_FACTORY_DEF} from './fields';
|
||||
|
||||
|
||||
/**
|
||||
* Definition of what a factory function should look like.
|
||||
*/
|
||||
export type FactoryFn<T> = {
|
||||
/**
|
||||
* Subclasses without an explicit constructor call through to the factory of their base
|
||||
* definition, providing it with their own constructor to instantiate.
|
||||
*/
|
||||
<U extends T>(t: Type<U>): U;
|
||||
|
||||
/**
|
||||
* If no constructor to instantiate is provided, an instance of type T itself is created.
|
||||
*/
|
||||
(t?: undefined): T;
|
||||
};
|
||||
|
||||
|
||||
export function getFactoryDef<T>(type: any, throwNotFound: true): FactoryFn<T>;
|
||||
export function getFactoryDef<T>(type: any): FactoryFn<T>|null;
|
||||
export function getFactoryDef<T>(type: any, throwNotFound?: boolean): FactoryFn<T>|null {
|
||||
const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
|
||||
if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
|
||||
throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
|
||||
}
|
||||
return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
|
||||
}
|
|
@ -18,11 +18,11 @@ import {assertDefined, assertEqual, assertIndexInRange} from '../util/assert';
|
|||
import {noSideEffects} from '../util/closure';
|
||||
|
||||
import {assertDirectiveDef, assertNodeInjector, assertTNodeForLView} from './assert';
|
||||
import {getFactoryDef} from './definition';
|
||||
import {throwCyclicDependencyError, throwProviderNotFoundError} from './errors';
|
||||
import {FactoryFn, getFactoryDef} from './definition_factory';
|
||||
import {throwCyclicDependencyError, throwProviderNotFoundError} from './errors_di';
|
||||
import {NG_ELEMENT_ID, NG_FACTORY_DEF} from './fields';
|
||||
import {registerPreOrderHooks} from './hooks';
|
||||
import {DirectiveDef, FactoryFn} from './interfaces/definition';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
import {isFactory, NO_PARENT_INJECTOR, NodeInjectorFactory, NodeInjectorOffset, RelativeInjectorLocation, RelativeInjectorLocationFlags} from './interfaces/injector';
|
||||
import {AttributeMarker, TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNode, TNodeProviderIndexes, TNodeType} from './interfaces/node';
|
||||
import {isComponentDef, isComponentHost} from './interfaces/type_checks';
|
||||
|
@ -31,7 +31,7 @@ import {assertTNodeType} from './node_assert';
|
|||
import {enterDI, getCurrentTNode, getLView, leaveDI} from './state';
|
||||
import {isNameOnlyAttributeMarker} from './util/attrs_utils';
|
||||
import {getParentInjectorIndex, getParentInjectorView, hasParentInjector} from './util/injector_utils';
|
||||
import {stringifyForError} from './util/misc_utils';
|
||||
import {stringifyForError} from './util/stringify_utils';
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,24 +6,13 @@
|
|||
* 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
|
||||
*/
|
||||
import {InjectorType} from '../di/interface/defs';
|
||||
import {stringify} from '../util/stringify';
|
||||
import {RuntimeError, RuntimeErrorCode} from './error_code';
|
||||
|
||||
import {TNode} from './interfaces/node';
|
||||
import {LView, TVIEW} from './interfaces/view';
|
||||
import {INTERPOLATION_DELIMITER, stringifyForError} from './util/misc_utils';
|
||||
import {INTERPOLATION_DELIMITER} from './util/misc_utils';
|
||||
|
||||
|
||||
|
||||
/** Called when directives inject each other (creating a circular dependency) */
|
||||
export function throwCyclicDependencyError(token: string, path?: string[]): never {
|
||||
const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
|
||||
throw new RuntimeError(
|
||||
RuntimeErrorCode.CYCLIC_DI_DEPENDENCY,
|
||||
`Circular dependency in DI detected for ${token}${depPath}`);
|
||||
}
|
||||
|
||||
/** Called when there are multiple component selectors that match a given node */
|
||||
export function throwMultipleComponentError(tNode: TNode): never {
|
||||
throw new RuntimeError(
|
||||
|
@ -31,23 +20,6 @@ export function throwMultipleComponentError(tNode: TNode): never {
|
|||
`Multiple components match node with tagname ${tNode.value}`);
|
||||
}
|
||||
|
||||
export function throwMixedMultiProviderError() {
|
||||
throw new Error(`Cannot mix multi providers and regular providers`);
|
||||
}
|
||||
|
||||
export function throwInvalidProviderError(
|
||||
ngModuleType?: InjectorType<any>, providers?: any[], provider?: any) {
|
||||
let ngModuleDetail = '';
|
||||
if (ngModuleType && providers) {
|
||||
const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
|
||||
ngModuleDetail =
|
||||
` - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Invalid provider for the NgModule '${stringify(ngModuleType)}'` + ngModuleDetail);
|
||||
}
|
||||
|
||||
/** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
|
||||
export function throwErrorIfNoChangesMode(
|
||||
creationMode: boolean, oldValue: any, currValue: any, propName?: string): never|void {
|
||||
|
@ -122,11 +94,3 @@ export function getExpressionChangedErrorDetails(
|
|||
}
|
||||
return {propName: undefined, oldValue, newValue};
|
||||
}
|
||||
|
||||
/** Throws an error when a token is not found in DI. */
|
||||
export function throwProviderNotFoundError(token: any, injectorName?: string): never {
|
||||
const injectorDetails = injectorName ? ` in ${injectorName}` : '';
|
||||
throw new RuntimeError(
|
||||
RuntimeErrorCode.PROVIDER_NOT_FOUND,
|
||||
`No provider for ${stringifyForError(token)} found${injectorDetails}`);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC 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
|
||||
*/
|
||||
import {InjectorType} from '../di/interface/defs';
|
||||
import {stringify} from '../util/stringify';
|
||||
import {RuntimeError, RuntimeErrorCode} from './error_code';
|
||||
import {stringifyForError} from './util/stringify_utils';
|
||||
|
||||
|
||||
/** Called when directives inject each other (creating a circular dependency) */
|
||||
export function throwCyclicDependencyError(token: string, path?: string[]): never {
|
||||
const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
|
||||
throw new RuntimeError(
|
||||
RuntimeErrorCode.CYCLIC_DI_DEPENDENCY,
|
||||
`Circular dependency in DI detected for ${token}${depPath}`);
|
||||
}
|
||||
|
||||
export function throwMixedMultiProviderError() {
|
||||
throw new Error(`Cannot mix multi providers and regular providers`);
|
||||
}
|
||||
|
||||
export function throwInvalidProviderError(
|
||||
ngModuleType?: InjectorType<any>, providers?: any[], provider?: any) {
|
||||
let ngModuleDetail = '';
|
||||
if (ngModuleType && providers) {
|
||||
const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
|
||||
ngModuleDetail =
|
||||
` - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Invalid provider for the NgModule '${stringify(ngModuleType)}'` + ngModuleDetail);
|
||||
}
|
||||
|
||||
|
||||
/** Throws an error when a token is not found in DI. */
|
||||
export function throwProviderNotFoundError(token: any, injectorName?: string): never {
|
||||
const injectorDetails = injectorName ? ` in ${injectorName}` : '';
|
||||
throw new RuntimeError(
|
||||
RuntimeErrorCode.PROVIDER_NOT_FOUND,
|
||||
`No provider for ${stringifyForError(token)} found${injectorDetails}`);
|
||||
}
|
|
@ -13,12 +13,12 @@ import {attachPatchData} from '../context_discovery';
|
|||
import {elementPropertyInternal, setElementAttribute} from '../instructions/shared';
|
||||
import {ELEMENT_MARKER, I18nCreateOpCode, I18nCreateOpCodes, I18nUpdateOpCode, I18nUpdateOpCodes, ICU_MARKER, IcuCreateOpCode, IcuCreateOpCodes, IcuType, TI18n, TIcu} from '../interfaces/i18n';
|
||||
import {TNode} from '../interfaces/node';
|
||||
import {RElement, RNode, RText} from '../interfaces/renderer';
|
||||
import {RElement, RNode, RText} from '../interfaces/renderer_dom';
|
||||
import {SanitizerFn} from '../interfaces/sanitization';
|
||||
import {HEADER_OFFSET, LView, RENDERER, TView} from '../interfaces/view';
|
||||
import {createCommentNode, createElementNode, createTextNode, nativeInsertBefore, nativeParentNode, nativeRemoveNode, updateTextNode} from '../node_manipulation';
|
||||
import {getBindingIndex} from '../state';
|
||||
import {renderStringify} from '../util/misc_utils';
|
||||
import {renderStringify} from '../util/stringify_utils';
|
||||
import {getNativeByIndex, unwrapRNode} from '../util/view_utils';
|
||||
import {getLocaleId} from './i18n_locale_id';
|
||||
import {getCurrentICUCaseIndex, getParentFromIcuCreateOpCode, getRefFromIcuCreateOpCode, getTIcu} from './i18n_util';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
import {TIcuContainerNode} from '../interfaces/node';
|
||||
import {RNode} from '../interfaces/renderer';
|
||||
import {RNode} from '../interfaces/renderer_dom';
|
||||
import {LView} from '../interfaces/view';
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {attachPatchData} from '../context_discovery';
|
|||
import {formatRuntimeError, RuntimeErrorCode} from '../error_code';
|
||||
import {registerPostOrderHooks} from '../hooks';
|
||||
import {hasClassInput, hasStyleInput, TAttributes, TElementNode, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
|
||||
import {RElement} from '../interfaces/renderer';
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
import {isContentQueryHost, isDirectiveHost} from '../interfaces/type_checks';
|
||||
import {HEADER_OFFSET, LView, RENDERER, TView} from '../interfaces/view';
|
||||
import {assertTNodeType} from '../node_assert';
|
||||
|
|
|
@ -12,7 +12,7 @@ import {EMPTY_ARRAY} from '../empty';
|
|||
import {getCurrentICUCaseIndex} from '../i18n/i18n_util';
|
||||
import {I18nRemoveOpCodes, TIcu} from '../interfaces/i18n';
|
||||
import {TIcuContainerNode} from '../interfaces/node';
|
||||
import {RNode} from '../interfaces/renderer';
|
||||
import {RNode} from '../interfaces/renderer_dom';
|
||||
import {LView, TVIEW} from '../interfaces/view';
|
||||
|
||||
export function loadIcuContainerVisitor() {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {bindingUpdated, bindingUpdated2, bindingUpdated3, bindingUpdated4} from
|
|||
import {LView} from '../interfaces/view';
|
||||
import {getBindingIndex, incrementBindingIndex, nextBindingIndex, setBindingIndex} from '../state';
|
||||
import {NO_CHANGE} from '../tokens';
|
||||
import {renderStringify} from '../util/misc_utils';
|
||||
import {renderStringify} from '../util/stringify_utils';
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ import {assertIndexInRange} from '../../util/assert';
|
|||
import {isObservable} from '../../util/lang';
|
||||
import {EMPTY_OBJ} from '../empty';
|
||||
import {PropertyAliasValue, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
|
||||
import {GlobalTargetResolver, isProceduralRenderer, RElement, Renderer3} from '../interfaces/renderer';
|
||||
import {GlobalTargetResolver, isProceduralRenderer, Renderer3} from '../interfaces/renderer';
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
import {isDirectiveHost} from '../interfaces/type_checks';
|
||||
import {CLEANUP, FLAGS, LView, LViewFlags, RENDERER, TView} from '../interfaces/view';
|
||||
import {assertTNodeType} from '../node_assert';
|
||||
|
|
|
@ -22,7 +22,8 @@ import {NO_PARENT_INJECTOR, NodeInjectorOffset} from '../interfaces/injector';
|
|||
import {AttributeMarker, InsertBeforeIndex, PropertyAliases, TConstants, TContainerNode, TElementNode, TNode as ITNode, TNodeFlags, TNodeProviderIndexes, TNodeType, toTNodeTypeAsString} from '../interfaces/node';
|
||||
import {SelectorFlags} from '../interfaces/projection';
|
||||
import {LQueries, TQueries} from '../interfaces/query';
|
||||
import {RComment, RElement, Renderer3, RendererFactory3, RNode} from '../interfaces/renderer';
|
||||
import {Renderer3, RendererFactory3} from '../interfaces/renderer';
|
||||
import {RComment, RElement, RNode} from '../interfaces/renderer_dom';
|
||||
import {getTStylingRangeNext, getTStylingRangeNextDuplicate, getTStylingRangePrev, getTStylingRangePrevDuplicate, TStylingKey, TStylingRange} from '../interfaces/styling';
|
||||
import {CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTEXT, DebugNode, DECLARATION_VIEW, DestroyHookData, FLAGS, HEADER_OFFSET, HookData, HOST, HostBindingOpCodes, INJECTOR, LContainerDebug as ILContainerDebug, LView, LViewDebug as ILViewDebug, LViewDebugRange, LViewDebugRangeContent, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, RENDERER_FACTORY, SANITIZER, T_HOST, TData, TView as ITView, TVIEW, TView, TViewType, TViewTypeAsString} from '../interfaces/view';
|
||||
import {attachDebugObject} from '../util/debug_utils';
|
||||
|
|
|
@ -19,7 +19,7 @@ import {normalizeDebugBindingName, normalizeDebugBindingValue} from '../../util/
|
|||
import {stringify} from '../../util/stringify';
|
||||
import {assertFirstCreatePass, assertFirstUpdatePass, assertLContainer, assertLView, assertTNodeForLView, assertTNodeForTView} from '../assert';
|
||||
import {attachPatchData} from '../context_discovery';
|
||||
import {getFactoryDef} from '../definition';
|
||||
import {getFactoryDef} from '../definition_factory';
|
||||
import {diPublicInInjector, getNodeInjectable, getOrCreateNodeInjectorForNode} from '../di';
|
||||
import {formatRuntimeError, RuntimeError, RuntimeErrorCode} from '../error_code';
|
||||
import {throwMultipleComponentError} from '../errors';
|
||||
|
@ -28,7 +28,8 @@ import {CONTAINER_HEADER_OFFSET, HAS_TRANSPLANTED_VIEWS, LContainer, MOVED_VIEWS
|
|||
import {ComponentDef, ComponentTemplate, DirectiveDef, DirectiveDefListOrFactory, HostBindingsFunction, PipeDefListOrFactory, RenderFlags, ViewQueriesFunction} from '../interfaces/definition';
|
||||
import {NodeInjectorFactory} from '../interfaces/injector';
|
||||
import {AttributeMarker, InitialInputData, InitialInputs, LocalRefExtractor, PropertyAliases, PropertyAliasValue, TAttributes, TConstantsOrFactory, TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TIcuContainerNode, TNode, TNodeFlags, TNodeType, TProjectionNode} from '../interfaces/node';
|
||||
import {isProceduralRenderer, RComment, RElement, Renderer3, RendererFactory3, RNode, RText} from '../interfaces/renderer';
|
||||
import {isProceduralRenderer, Renderer3, RendererFactory3} from '../interfaces/renderer';
|
||||
import {RComment, RElement, RNode, RText} from '../interfaces/renderer_dom';
|
||||
import {SanitizerFn} from '../interfaces/sanitization';
|
||||
import {isComponentDef, isComponentHost, isContentQueryHost, isRootView} from '../interfaces/type_checks';
|
||||
import {CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTEXT, DECLARATION_COMPONENT_VIEW, DECLARATION_VIEW, FLAGS, HEADER_OFFSET, HOST, HostBindingOpCodes, InitPhaseState, INJECTOR, LView, LViewFlags, NEXT, PARENT, RENDERER, RENDERER_FACTORY, RootContext, RootContextFlags, SANITIZER, T_HOST, TData, TRANSPLANTED_VIEWS_TO_REFRESH, TVIEW, TView, TViewType} from '../interfaces/view';
|
||||
|
@ -38,7 +39,8 @@ import {isInlineTemplate, isNodeMatchingSelectorList} from '../node_selector_mat
|
|||
import {enterView, getBindingsEnabled, getCurrentDirectiveIndex, getCurrentParentTNode, getCurrentTNode, getCurrentTNodePlaceholderOk, getSelectedIndex, isCurrentTNodeParent, isInCheckNoChangesMode, isInI18nBlock, leaveView, setBindingIndex, setBindingRootForHostBindings, setCurrentDirectiveIndex, setCurrentQueryIndex, setCurrentTNode, setIsInCheckNoChangesMode, setSelectedIndex} from '../state';
|
||||
import {NO_CHANGE} from '../tokens';
|
||||
import {isAnimationProp, mergeHostAttrs} from '../util/attrs_utils';
|
||||
import {INTERPOLATION_DELIMITER, renderStringify, stringifyForError} from '../util/misc_utils';
|
||||
import {INTERPOLATION_DELIMITER} from '../util/misc_utils';
|
||||
import {renderStringify, stringifyForError} from '../util/stringify_utils';
|
||||
import {getFirstLContainer, getLViewParent, getNextLContainer} from '../util/view_traversal_utils';
|
||||
import {getComponentLViewByIndex, getNativeByIndex, getNativeByTNode, isCreationMode, readPatchedLView, resetPreOrderHookFlags, unwrapLView, updateTransplantedViewCount, viewAttachedToChangeDetector} from '../util/view_utils';
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ import {assertFirstUpdatePass} from '../assert';
|
|||
import {bindingUpdated} from '../bindings';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
import {AttributeMarker, TAttributes, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
|
||||
import {RElement, Renderer3} from '../interfaces/renderer';
|
||||
import {Renderer3} from '../interfaces/renderer';
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
import {getTStylingRangeNext, getTStylingRangeNextDuplicate, getTStylingRangePrev, getTStylingRangePrevDuplicate, TStylingKey, TStylingRange} from '../interfaces/styling';
|
||||
import {LView, RENDERER, TData, TView} from '../interfaces/view';
|
||||
import {applyStyling} from '../node_manipulation';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {TNode} from './node';
|
||||
import {RComment, RElement} from './renderer';
|
||||
import {RComment, RElement} from './renderer_dom';
|
||||
import {HOST, LView, NEXT, PARENT, T_HOST, TRANSPLANTED_VIEWS_TO_REFRESH} from './view';
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import {RNode} from './renderer';
|
||||
import {RNode} from './renderer_dom';
|
||||
import {LView} from './view';
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {SchemaMetadata, ViewEncapsulation} from '../../core';
|
||||
import {ProcessProvidersFunction} from '../../di/interface/provider';
|
||||
import {Type} from '../../interface/type';
|
||||
import {SchemaMetadata} from '../../metadata/schema';
|
||||
import {ViewEncapsulation} from '../../metadata/view';
|
||||
import {FactoryFn} from '../definition_factory';
|
||||
|
||||
import {TAttributes, TConstantsOrFactory} from './node';
|
||||
import {CssSelectorList} from './projection';
|
||||
|
@ -36,22 +38,6 @@ export type ViewQueriesFunction<T> = <U extends T>(rf: RenderFlags, ctx: U) => v
|
|||
export type ContentQueriesFunction<T> =
|
||||
<U extends T>(rf: RenderFlags, ctx: U, directiveIndex: number) => void;
|
||||
|
||||
/**
|
||||
* Definition of what a factory function should look like.
|
||||
*/
|
||||
export type FactoryFn<T> = {
|
||||
/**
|
||||
* Subclasses without an explicit constructor call through to the factory of their base
|
||||
* definition, providing it with their own constructor to instantiate.
|
||||
*/
|
||||
<U extends T>(t: Type<U>): U;
|
||||
|
||||
/**
|
||||
* If no constructor to instantiate is provided, an instance of type T itself is created.
|
||||
*/
|
||||
(t?: undefined): T;
|
||||
};
|
||||
|
||||
/**
|
||||
* Flags passed into template functions to determine which blocks (i.e. creation, update)
|
||||
* should be executed.
|
||||
|
|
|
@ -9,7 +9,7 @@ import {KeyValueArray} from '../../util/array_utils';
|
|||
import {TStylingRange} from '../interfaces/styling';
|
||||
import {TIcu} from './i18n';
|
||||
import {CssSelector} from './projection';
|
||||
import {RNode} from './renderer';
|
||||
import {RNode} from './renderer_dom';
|
||||
import {LView, TView} from './view';
|
||||
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
* it will be easy to implement such API.
|
||||
*/
|
||||
|
||||
import {RendererStyleFlags2, RendererType2} from '../../render/api';
|
||||
import {RendererStyleFlags2, RendererType2} from '../../render/api_flags';
|
||||
import {TrustedHTML, TrustedScript, TrustedScriptURL} from '../../util/security/trusted_type_defs';
|
||||
import {getDocument} from './document';
|
||||
import {RComment, RElement, RNode, RText} from './renderer_dom';
|
||||
|
||||
// TODO: cleanup once the code is merged in angular/angular
|
||||
export enum RendererStyleFlags3 {
|
||||
|
@ -112,82 +113,6 @@ export const domRendererFactory3: RendererFactory3 = {
|
|||
}
|
||||
};
|
||||
|
||||
/** Subset of API needed for appending elements and text nodes. */
|
||||
export interface RNode {
|
||||
/**
|
||||
* Returns the parent Element, Document, or DocumentFragment
|
||||
*/
|
||||
parentNode: RNode|null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the parent Element if there is one
|
||||
*/
|
||||
parentElement: RElement|null;
|
||||
|
||||
/**
|
||||
* Gets the Node immediately following this one in the parent's childNodes
|
||||
*/
|
||||
nextSibling: RNode|null;
|
||||
|
||||
/**
|
||||
* Removes a child from the current node and returns the removed node
|
||||
* @param oldChild the child node to remove
|
||||
*/
|
||||
removeChild(oldChild: RNode): RNode;
|
||||
|
||||
/**
|
||||
* Insert a child node.
|
||||
*
|
||||
* Used exclusively for adding View root nodes into ViewAnchor location.
|
||||
*/
|
||||
insertBefore(newChild: RNode, refChild: RNode|null, isViewRoot: boolean): void;
|
||||
|
||||
/**
|
||||
* Append a child node.
|
||||
*
|
||||
* Used exclusively for building up DOM which are static (ie not View roots)
|
||||
*/
|
||||
appendChild(newChild: RNode): RNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subset of API needed for writing attributes, properties, and setting up
|
||||
* listeners on Element.
|
||||
*/
|
||||
export interface RElement extends RNode {
|
||||
style: RCssStyleDeclaration;
|
||||
classList: RDomTokenList;
|
||||
className: string;
|
||||
textContent: string|null;
|
||||
setAttribute(name: string, value: string|TrustedHTML|TrustedScript|TrustedScriptURL): void;
|
||||
removeAttribute(name: string): void;
|
||||
setAttributeNS(
|
||||
namespaceURI: string, qualifiedName: string,
|
||||
value: string|TrustedHTML|TrustedScript|TrustedScriptURL): void;
|
||||
addEventListener(type: string, listener: EventListener, useCapture?: boolean): void;
|
||||
removeEventListener(type: string, listener?: EventListener, options?: boolean): void;
|
||||
|
||||
setProperty?(name: string, value: any): void;
|
||||
}
|
||||
|
||||
export interface RCssStyleDeclaration {
|
||||
removeProperty(propertyName: string): string;
|
||||
setProperty(propertyName: string, value: string|null, priority?: string): void;
|
||||
}
|
||||
|
||||
export interface RDomTokenList {
|
||||
add(token: string): void;
|
||||
remove(token: string): void;
|
||||
}
|
||||
|
||||
export interface RText extends RNode {
|
||||
textContent: string|null;
|
||||
}
|
||||
|
||||
export interface RComment extends RNode {
|
||||
textContent: string|null;
|
||||
}
|
||||
|
||||
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
||||
// failure based on types.
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC 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
|
||||
*/
|
||||
|
||||
import {TrustedHTML, TrustedScript, TrustedScriptURL} from '../../util/security/trusted_type_defs';
|
||||
|
||||
/**
|
||||
* The goal here is to make sure that the browser DOM API is the Renderer.
|
||||
* We do this by defining a subset of DOM API to be the renderer and then
|
||||
* use that at runtime for rendering.
|
||||
*
|
||||
* At runtime we can then use the DOM api directly, in server or web-worker
|
||||
* it will be easy to implement such API.
|
||||
*/
|
||||
|
||||
/** Subset of API needed for appending elements and text nodes. */
|
||||
export interface RNode {
|
||||
/**
|
||||
* Returns the parent Element, Document, or DocumentFragment
|
||||
*/
|
||||
parentNode: RNode|null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the parent Element if there is one
|
||||
*/
|
||||
parentElement: RElement|null;
|
||||
|
||||
/**
|
||||
* Gets the Node immediately following this one in the parent's childNodes
|
||||
*/
|
||||
nextSibling: RNode|null;
|
||||
|
||||
/**
|
||||
* Removes a child from the current node and returns the removed node
|
||||
* @param oldChild the child node to remove
|
||||
*/
|
||||
removeChild(oldChild: RNode): RNode;
|
||||
|
||||
/**
|
||||
* Insert a child node.
|
||||
*
|
||||
* Used exclusively for adding View root nodes into ViewAnchor location.
|
||||
*/
|
||||
insertBefore(newChild: RNode, refChild: RNode|null, isViewRoot: boolean): void;
|
||||
|
||||
/**
|
||||
* Append a child node.
|
||||
*
|
||||
* Used exclusively for building up DOM which are static (ie not View roots)
|
||||
*/
|
||||
appendChild(newChild: RNode): RNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subset of API needed for writing attributes, properties, and setting up
|
||||
* listeners on Element.
|
||||
*/
|
||||
export interface RElement extends RNode {
|
||||
style: RCssStyleDeclaration;
|
||||
classList: RDomTokenList;
|
||||
className: string;
|
||||
textContent: string|null;
|
||||
setAttribute(name: string, value: string|TrustedHTML|TrustedScript|TrustedScriptURL): void;
|
||||
removeAttribute(name: string): void;
|
||||
setAttributeNS(
|
||||
namespaceURI: string, qualifiedName: string,
|
||||
value: string|TrustedHTML|TrustedScript|TrustedScriptURL): void;
|
||||
addEventListener(type: string, listener: EventListener, useCapture?: boolean): void;
|
||||
removeEventListener(type: string, listener?: EventListener, options?: boolean): void;
|
||||
|
||||
setProperty?(name: string, value: any): void;
|
||||
}
|
||||
|
||||
export interface RCssStyleDeclaration {
|
||||
removeProperty(propertyName: string): string;
|
||||
setProperty(propertyName: string, value: string|null, priority?: string): void;
|
||||
}
|
||||
|
||||
export interface RDomTokenList {
|
||||
add(token: string): void;
|
||||
remove(token: string): void;
|
||||
}
|
||||
|
||||
export interface RText extends RNode {
|
||||
textContent: string|null;
|
||||
}
|
||||
|
||||
export interface RComment extends RNode {
|
||||
textContent: string|null;
|
||||
}
|
||||
|
||||
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
||||
// failure based on types.
|
||||
export const unusedValueExportToPlacateAjd = 1;
|
|
@ -9,7 +9,7 @@
|
|||
import {LContainer, TYPE} from './container';
|
||||
import {ComponentDef, DirectiveDef} from './definition';
|
||||
import {TNode, TNodeFlags} from './node';
|
||||
import {RNode} from './renderer';
|
||||
import {RNode} from './renderer_dom';
|
||||
import {FLAGS, LView, LViewFlags} from './view';
|
||||
|
||||
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
import {InjectionToken} from '../../di/injection_token';
|
||||
import {Injector} from '../../di/injector';
|
||||
import {Type} from '../../interface/type';
|
||||
import {SchemaMetadata} from '../../metadata';
|
||||
import {SchemaMetadata} from '../../metadata/schema';
|
||||
import {Sanitizer} from '../../sanitization/sanitizer';
|
||||
|
||||
import {LContainer} from './container';
|
||||
import {ComponentDef, ComponentTemplate, DirectiveDef, DirectiveDefList, HostBindingsFunction, PipeDef, PipeDefList, ViewQueriesFunction} from './definition';
|
||||
import {I18nUpdateOpCodes, TI18n, TIcu} from './i18n';
|
||||
import {TConstants, TNode} from './node';
|
||||
import {PlayerHandler} from './player';
|
||||
import {LQueries, TQueries} from './query';
|
||||
import {RComment, RElement, Renderer3, RendererFactory3} from './renderer';
|
||||
import {Renderer3, RendererFactory3} from './renderer';
|
||||
import {RComment, RElement} from './renderer_dom';
|
||||
import {TStylingKey, TStylingRange} from './styling';
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import {getComponentDef, getDirectiveDef} from '../definition';
|
|||
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
||||
import {NG_COMP_DEF, NG_DIR_DEF, NG_FACTORY_DEF} from '../fields';
|
||||
import {ComponentType} from '../interfaces/definition';
|
||||
import {stringifyForError} from '../util/misc_utils';
|
||||
import {stringifyForError} from '../util/stringify_utils';
|
||||
|
||||
import {angularCoreEnv} from './environment';
|
||||
import {getJitOptions} from './jit_options';
|
||||
|
|
|
@ -19,7 +19,8 @@ import {assertDefined} from '../../util/assert';
|
|||
import {getComponentDef, getDirectiveDef, getNgModuleDef, getPipeDef} from '../definition';
|
||||
import {NG_COMP_DEF, NG_DIR_DEF, NG_MOD_DEF, NG_PIPE_DEF} from '../fields';
|
||||
import {ComponentDef} from '../interfaces/definition';
|
||||
import {maybeUnwrapFn, stringifyForError} from '../util/misc_utils';
|
||||
import {maybeUnwrapFn} from '../util/misc_utils';
|
||||
import {stringifyForError} from '../util/stringify_utils';
|
||||
|
||||
import {angularCoreEnv} from './environment';
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Renderer2} from '../render/api';
|
||||
import {RendererStyleFlags2} from '../render/api_flags';
|
||||
import {addToArray, removeFromArray} from '../util/array_utils';
|
||||
import {assertDefined, assertDomNode, assertEqual, assertIndexInRange, assertString} from '../util/assert';
|
||||
|
||||
import {assertDefined, assertDomNode, assertEqual, assertString} from '../util/assert';
|
||||
import {assertLContainer, assertLView, assertTNodeForLView} from './assert';
|
||||
import {attachPatchData} from './context_discovery';
|
||||
import {icuContainerIterate} from './i18n/i18n_tree_shaking';
|
||||
|
@ -19,7 +19,8 @@ import {ComponentDef} from './interfaces/definition';
|
|||
import {NodeInjectorFactory} from './interfaces/injector';
|
||||
import {TElementNode, TIcuContainerNode, TNode, TNodeFlags, TNodeType, TProjectionNode, unusedValueExportToPlacateAjd as unused2} from './interfaces/node';
|
||||
import {unusedValueExportToPlacateAjd as unused3} from './interfaces/projection';
|
||||
import {isProceduralRenderer, ProceduralRenderer3, RComment, RElement, Renderer3, RNode, RText, unusedValueExportToPlacateAjd as unused4} from './interfaces/renderer';
|
||||
import {isProceduralRenderer, ProceduralRenderer3, Renderer3, unusedValueExportToPlacateAjd as unused4} from './interfaces/renderer';
|
||||
import {RComment, RElement, RNode, RText} from './interfaces/renderer_dom';
|
||||
import {isLContainer, isLView} from './interfaces/type_checks';
|
||||
import {CHILD_HEAD, CLEANUP, DECLARATION_COMPONENT_VIEW, DECLARATION_LCONTAINER, DestroyHookData, FLAGS, HookData, HookFn, HOST, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, T_HOST, TVIEW, TView, TViewType, unusedValueExportToPlacateAjd as unused5} from './interfaces/view';
|
||||
import {assertTNodeType} from './node_assert';
|
||||
|
@ -986,13 +987,6 @@ function applyContainer(
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(misko): Can't import RendererStyleFlags2.DashCase as it causes imports to be resolved
|
||||
// in different order which causes failures. Duplicating for now.
|
||||
const enum TempRendererStyleFlags2 {
|
||||
Important = 1 << 0,
|
||||
DashCase = 1 << 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes class/style to element.
|
||||
*
|
||||
|
@ -1025,7 +1019,7 @@ export function applyStyling(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
let flags = prop.indexOf('-') === -1 ? undefined : TempRendererStyleFlags2.DashCase as number;
|
||||
let flags = prop.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase as number;
|
||||
if (value == null /** || value === undefined */) {
|
||||
ngDevMode && ngDevMode.rendererRemoveStyle++;
|
||||
if (isProcedural) {
|
||||
|
@ -1041,7 +1035,7 @@ export function applyStyling(
|
|||
if (isImportant) {
|
||||
// !important has to be stripped from the value for it to be valid.
|
||||
value = value.slice(0, -10);
|
||||
flags! |= TempRendererStyleFlags2.Important;
|
||||
flags! |= RendererStyleFlags2.Important;
|
||||
}
|
||||
|
||||
ngDevMode && ngDevMode.rendererSetStyle++;
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
*/
|
||||
|
||||
import {assertDomNode, assertIndexInRange} from '../util/assert';
|
||||
|
||||
import {TNode, TNodeFlags, TNodeType} from './interfaces/node';
|
||||
import {RElement, Renderer3, RNode} from './interfaces/renderer';
|
||||
import {Renderer3} from './interfaces/renderer';
|
||||
import {RElement, RNode} from './interfaces/renderer_dom';
|
||||
import {LView} from './interfaces/view';
|
||||
import {getInsertInFrontOfRNodeWithNoI18n, nativeInsertBefore} from './node_manipulation';
|
||||
import {unwrapRNode} from './util/view_utils';
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import {WrappedValue} from '../change_detection/change_detection_util';
|
||||
import {PipeTransform} from '../change_detection/pipe_transform';
|
||||
import {setInjectImplementation} from '../di/inject_switch';
|
||||
import {getFactoryDef} from './definition';
|
||||
import {getFactoryDef} from './definition_factory';
|
||||
import {setIncludeViewProviders} from './di';
|
||||
import {RuntimeError, RuntimeErrorCode} from './error_code';
|
||||
import {store, ɵɵdirectiveInject} from './instructions/all';
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
import {CharCode} from '../../util/char_code';
|
||||
import {AttributeMarker, TAttributes} from '../interfaces/node';
|
||||
import {CssSelector} from '../interfaces/projection';
|
||||
import {isProceduralRenderer, ProceduralRenderer3, RElement, Renderer3} from '../interfaces/renderer';
|
||||
import {isProceduralRenderer, ProceduralRenderer3, Renderer3} from '../interfaces/renderer';
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ import {DirectiveDef} from '../interfaces/definition';
|
|||
import {TElementNode, TNode, TNodeProviderIndexes} from '../interfaces/node';
|
||||
import {isLView} from '../interfaces/type_checks';
|
||||
import {CLEANUP, CONTEXT, DebugNode, FLAGS, LView, LViewFlags, T_HOST, TVIEW, TViewType} from '../interfaces/view';
|
||||
|
||||
import {stringifyForError} from './misc_utils';
|
||||
import {stringifyForError} from './stringify_utils';
|
||||
import {getLViewParent, getRootContext} from './view_traversal_utils';
|
||||
import {getTNode, unwrapRNode} from './view_utils';
|
||||
|
||||
|
|
|
@ -7,33 +7,7 @@
|
|||
*/
|
||||
|
||||
import {global} from '../../util/global';
|
||||
import {RElement} from '../interfaces/renderer';
|
||||
|
||||
/**
|
||||
* Used for stringify render output in Ivy.
|
||||
* Important! This function is very performance-sensitive and we should
|
||||
* be extra careful not to introduce megamorphic reads in it.
|
||||
*/
|
||||
export function renderStringify(value: any): string {
|
||||
if (typeof value === 'string') return value;
|
||||
if (value == null) return '';
|
||||
return '' + value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to stringify a value so that it can be displayed in an error message.
|
||||
* Important! This function contains a megamorphic read and should only be
|
||||
* used for error messages.
|
||||
*/
|
||||
export function stringifyForError(value: any): string {
|
||||
if (typeof value === 'function') return value.name || value.toString();
|
||||
if (typeof value === 'object' && value != null && typeof value.type === 'function') {
|
||||
return value.type.name || value.type.toString();
|
||||
}
|
||||
|
||||
return renderStringify(value);
|
||||
}
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
|
||||
|
||||
export const defaultScheduler =
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used for stringify render output in Ivy.
|
||||
* Important! This function is very performance-sensitive and we should
|
||||
* be extra careful not to introduce megamorphic reads in it.
|
||||
*/
|
||||
export function renderStringify(value: any): string {
|
||||
if (typeof value === 'string') return value;
|
||||
if (value == null) return '';
|
||||
return '' + value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to stringify a value so that it can be displayed in an error message.
|
||||
* Important! This function contains a megamorphic read and should only be
|
||||
* used for error messages.
|
||||
*/
|
||||
export function stringifyForError(value: any): string {
|
||||
if (typeof value === 'function') return value.name || value.toString();
|
||||
if (typeof value === 'object' && value != null && typeof value.type === 'function') {
|
||||
return value.type.name || value.type.toString();
|
||||
}
|
||||
|
||||
return renderStringify(value);
|
||||
}
|
|
@ -11,7 +11,8 @@ import {assertTNode, assertTNodeForLView} from '../assert';
|
|||
import {LContainer, TYPE} from '../interfaces/container';
|
||||
import {LContext, MONKEY_PATCH_KEY_NAME} from '../interfaces/context';
|
||||
import {TConstants, TNode} from '../interfaces/node';
|
||||
import {isProceduralRenderer, RNode} from '../interfaces/renderer';
|
||||
import {isProceduralRenderer} from '../interfaces/renderer';
|
||||
import {RNode} from '../interfaces/renderer_dom';
|
||||
import {isLContainer, isLView} from '../interfaces/type_checks';
|
||||
import {FLAGS, HEADER_OFFSET, HOST, LView, LViewFlags, PARENT, PREORDER_HOOK_FLAGS, RENDERER, TData, TRANSPLANTED_VIEWS_TO_REFRESH, TView} from '../interfaces/view';
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
import {ChangeDetectorRef, injectChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||
import {InjectFlags} from '../di/interface/injector';
|
||||
import {createTemplateRef, TemplateRef} from '../linker/template_ref';
|
||||
import {throwProviderNotFoundError} from './errors';
|
||||
import {throwProviderNotFoundError} from './errors_di';
|
||||
import {TNode} from './interfaces/node';
|
||||
import {LView} from './interfaces/view';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import {getDocument} from '../render3/interfaces/document';
|
||||
import {SANITIZER} from '../render3/interfaces/view';
|
||||
import {getLView} from '../render3/state';
|
||||
import {renderStringify} from '../render3/util/misc_utils';
|
||||
import {renderStringify} from '../render3/util/stringify_utils';
|
||||
import {TrustedHTML, TrustedScript, TrustedScriptURL} from '../util/security/trusted_type_defs';
|
||||
import {trustedHTMLFromString, trustedScriptFromString, trustedScriptURLFromString} from '../util/security/trusted_types';
|
||||
import {trustedHTMLFromStringBypass, trustedScriptFromStringBypass, trustedScriptURLFromStringBypass} from '../util/security/trusted_types_bypass';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {RendererType2} from '../render/api';
|
||||
import {RendererType2} from '../render/api_flags';
|
||||
import {SecurityContext} from '../sanitization/security';
|
||||
|
||||
import {asElementData, BindingDef, BindingFlags, ElementData, ElementHandleEventFn, NodeDef, NodeFlags, OutputDef, OutputType, QueryValueType, ViewData, ViewDefinitionFactory} from './types';
|
||||
|
|
|
@ -13,7 +13,8 @@ import {ErrorHandler} from '../error_handler';
|
|||
import {Type} from '../interface/type';
|
||||
import {ComponentFactory} from '../linker/component_factory';
|
||||
import {NgModuleRef} from '../linker/ng_module_factory';
|
||||
import {Renderer2, RendererFactory2, RendererStyleFlags2, RendererType2} from '../render/api';
|
||||
import {Renderer2, RendererFactory2} from '../render/api';
|
||||
import {RendererStyleFlags2, RendererType2} from '../render/api_flags';
|
||||
import {Sanitizer} from '../sanitization/sanitizer';
|
||||
import {isDevMode} from '../util/is_dev_mode';
|
||||
import {normalizeDebugBindingName, normalizeDebugBindingValue} from '../util/ng_reflect';
|
||||
|
|
|
@ -14,7 +14,8 @@ import {NgModuleRef} from '../linker/ng_module_factory';
|
|||
import {QueryList} from '../linker/query_list';
|
||||
import {TemplateRef} from '../linker/template_ref';
|
||||
import {ViewContainerRef} from '../linker/view_container_ref';
|
||||
import {Renderer2, RendererFactory2, RendererType2} from '../render/api';
|
||||
import {Renderer2, RendererFactory2} from '../render/api';
|
||||
import {RendererType2} from '../render/api_flags';
|
||||
import {Sanitizer} from '../sanitization/sanitizer';
|
||||
import {SecurityContext} from '../sanitization/security';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import {devModeEqual, WrappedValue} from '../change_detection/change_detection';
|
||||
import {SOURCE} from '../di/injector_compatibility';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {RendererType2} from '../render/api';
|
||||
import {RendererType2} from '../render/api_flags';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {expressionChangedAfterItHasBeenCheckedError} from './errors';
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injector, NgModuleRef, ViewEncapsulation} from '../../src/core';
|
||||
import {RElement} from '@angular/core/src/render3/interfaces/renderer_dom';
|
||||
import {Injector, NgModuleRef, RendererType2, ViewEncapsulation} from '../../src/core';
|
||||
import {ComponentFactory} from '../../src/linker/component_factory';
|
||||
import {RendererFactory2, RendererType2} from '../../src/render/api';
|
||||
import {RendererFactory2} from '../../src/render/api';
|
||||
import {injectComponentFactoryResolver} from '../../src/render3/component_ref';
|
||||
import {AttributeMarker, ɵɵdefineComponent} from '../../src/render3/index';
|
||||
import {domRendererFactory3, RElement, Renderer3, RendererFactory3} from '../../src/render3/interfaces/renderer';
|
||||
import {domRendererFactory3, Renderer3, RendererFactory3} from '../../src/render3/interfaces/renderer';
|
||||
import {Sanitizer} from '../../src/sanitization/sanitizer';
|
||||
|
||||
describe('ComponentFactory', () => {
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {RendererType2} from '../../src/render/api';
|
||||
import {RElement} from '@angular/core/src/render3/interfaces/renderer_dom';
|
||||
import {RendererType2} from '../../src/render/api_flags';
|
||||
import {getLContext} from '../../src/render3/context_discovery';
|
||||
import {AttributeMarker, ɵɵadvance, ɵɵattribute, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵhostProperty, ɵɵproperty} from '../../src/render3/index';
|
||||
import {ɵɵelement, ɵɵelementEnd, ɵɵelementStart, ɵɵprojection, ɵɵprojectionDef, ɵɵtemplate, ɵɵtext} from '../../src/render3/instructions/all';
|
||||
import {MONKEY_PATCH_KEY_NAME} from '../../src/render3/interfaces/context';
|
||||
import {RenderFlags} from '../../src/render3/interfaces/definition';
|
||||
import {domRendererFactory3, RElement, Renderer3, RendererFactory3} from '../../src/render3/interfaces/renderer';
|
||||
import {domRendererFactory3, Renderer3, RendererFactory3} from '../../src/render3/interfaces/renderer';
|
||||
import {CONTEXT, HEADER_OFFSET} from '../../src/render3/interfaces/view';
|
||||
import {ɵɵsanitizeUrl} from '../../src/sanitization/sanitization';
|
||||
import {Sanitizer} from '../../src/sanitization/sanitizer';
|
||||
|
|
|
@ -16,7 +16,8 @@ import {ContentChild, ContentChildren, ViewChild, ViewChildren} from '@angular/c
|
|||
import {Component, Directive, HostBinding, HostListener, Input, Pipe} from '@angular/core/src/metadata/directives';
|
||||
import {NgModule} from '@angular/core/src/metadata/ng_module';
|
||||
import {NgModuleDef} from '@angular/core/src/metadata/ng_module_def';
|
||||
import {ComponentDef, FactoryFn, PipeDef} from '@angular/core/src/render3/interfaces/definition';
|
||||
import {FactoryFn} from '@angular/core/src/render3/definition_factory';
|
||||
import {ComponentDef, PipeDef} from '@angular/core/src/render3/interfaces/definition';
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 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
|
||||
*/
|
||||
import {ProceduralRenderer3, RComment, RElement, Renderer3, RendererFactory3, RendererStyleFlags3, RNode, RText} from '../../../src/render3/interfaces/renderer';
|
||||
import {RComment, RElement, RNode, RText} from '@angular/core/src/render3/interfaces/renderer_dom';
|
||||
import {ProceduralRenderer3, Renderer3, RendererFactory3, RendererStyleFlags3} from '../../../src/render3/interfaces/renderer';
|
||||
|
||||
export class MicroBenchmarkRenderNode implements RNode, RComment, RText {
|
||||
tagName?: string;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {RendererStyleFlags2, RendererType2} from '@angular/core';
|
||||
import {ChangeDetectorRef} from '@angular/core/src/change_detection/change_detector_ref';
|
||||
import {Provider} from '@angular/core/src/di/interface/provider';
|
||||
import {ElementRef} from '@angular/core/src/linker/element_ref';
|
||||
|
@ -14,16 +15,18 @@ import {ViewContainerRef} from '@angular/core/src/linker/view_container_ref';
|
|||
import {Renderer2} from '@angular/core/src/render/api';
|
||||
import {createLView, createTView, getOrCreateTComponentView, getOrCreateTNode, renderComponentOrTemplate} from '@angular/core/src/render3/instructions/shared';
|
||||
import {TConstants, TNodeType} from '@angular/core/src/render3/interfaces/node';
|
||||
import {RComment, RElement, RNode, RText} from '@angular/core/src/render3/interfaces/renderer_dom';
|
||||
import {enterView, getLView} from '@angular/core/src/render3/state';
|
||||
import {EMPTY_ARRAY} from '@angular/core/src/util/empty';
|
||||
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
|
||||
|
||||
import {SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ as R3_CHANGE_DETECTOR_REF_FACTORY} from '../../src/change_detection/change_detector_ref';
|
||||
import {Injector} from '../../src/di/injector';
|
||||
import {Type} from '../../src/interface/type';
|
||||
import {SWITCH_ELEMENT_REF_FACTORY__POST_R3__ as R3_ELEMENT_REF_FACTORY} from '../../src/linker/element_ref';
|
||||
import {SWITCH_TEMPLATE_REF_FACTORY__POST_R3__ as R3_TEMPLATE_REF_FACTORY} from '../../src/linker/template_ref';
|
||||
import {SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__ as R3_VIEW_CONTAINER_REF_FACTORY} from '../../src/linker/view_container_ref';
|
||||
import {RendererStyleFlags2, RendererType2, SWITCH_RENDERER2_FACTORY__POST_R3__ as R3_RENDERER2_FACTORY} from '../../src/render/api';
|
||||
import {SWITCH_RENDERER2_FACTORY__POST_R3__ as R3_RENDERER2_FACTORY} from '../../src/render/api';
|
||||
import {CreateComponentOptions} from '../../src/render3/component';
|
||||
import {getDirectivesAtNodeIndex, getLContext, isComponentInstance} from '../../src/render3/context_discovery';
|
||||
import {extractDirectiveDef, extractPipeDef} from '../../src/render3/definition';
|
||||
|
@ -31,11 +34,12 @@ import {NG_ELEMENT_ID} from '../../src/render3/fields';
|
|||
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType, renderComponent as _renderComponent, RenderFlags, tick, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵProvidersFeature} from '../../src/render3/index';
|
||||
import {DirectiveDefList, DirectiveDefListOrFactory, DirectiveTypesOrFactory, HostBindingsFunction, PipeDef, PipeDefList, PipeDefListOrFactory, PipeTypesOrFactory} from '../../src/render3/interfaces/definition';
|
||||
import {PlayerHandler} from '../../src/render3/interfaces/player';
|
||||
import {domRendererFactory3, ProceduralRenderer3, RComment, RElement, Renderer3, RendererFactory3, RendererStyleFlags3, RNode, RText} from '../../src/render3/interfaces/renderer';
|
||||
import {domRendererFactory3, ProceduralRenderer3, Renderer3, RendererFactory3, RendererStyleFlags3} from '../../src/render3/interfaces/renderer';
|
||||
import {LView, LViewFlags, TVIEW, TViewType} from '../../src/render3/interfaces/view';
|
||||
import {destroyLView} from '../../src/render3/node_manipulation';
|
||||
import {getRootView} from '../../src/render3/util/view_traversal_utils';
|
||||
import {Sanitizer} from '../../src/sanitization/sanitizer';
|
||||
|
||||
import {getRendererFactory2} from './imported_renderer2';
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {ViewEncapsulation} from '../../src/metadata';
|
|||
import {injectComponentFactoryResolver, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵlistener, ɵɵloadQuery, ɵɵqueryRefresh, ɵɵviewQuery} from '../../src/render3/index';
|
||||
import {ɵɵdirectiveInject, ɵɵelement, ɵɵelementEnd, ɵɵelementStart, ɵɵtemplate, ɵɵtext} from '../../src/render3/instructions/all';
|
||||
import {RenderFlags} from '../../src/render3/interfaces/definition';
|
||||
import {RElement} from '../../src/render3/interfaces/renderer';
|
||||
import {RElement} from '../../src/render3/interfaces/renderer_dom';
|
||||
import {getLView} from '../../src/render3/state';
|
||||
import {getNativeByIndex} from '../../src/render3/util/view_utils';
|
||||
import {ComponentFixture, createComponent, TemplateFixture} from './render_util';
|
||||
|
|
Loading…
Reference in New Issue