mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): break circular dependencies in preparation for queries as signals (#54103)
Break circular dependencies by using type imports and code moves. PR Close #54103
This commit is contained in:
parent
84d1fa7c56
commit
99bfbabe50
31 changed files with 205 additions and 250 deletions
|
|
@ -33,64 +33,10 @@
|
|||
"packages/core/src/change_detection/differs/default_keyvalue_differ.ts",
|
||||
"packages/core/src/change_detection/differs/keyvalue_differs.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/create_injector.ts",
|
||||
"packages/core/src/di/injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/create_injector.ts",
|
||||
"packages/core/src/di/provider_collection.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/di/r3_injector.ts",
|
||||
"packages/core/src/di/injector_compatibility.ts",
|
||||
"packages/core/src/di/injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/create_injector.ts",
|
||||
"packages/core/src/di/provider_collection.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.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/create_injector.ts",
|
||||
"packages/core/src/di/provider_collection.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/di/r3_injector.ts",
|
||||
"packages/core/src/di/injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/create_injector.ts",
|
||||
"packages/core/src/di/provider_collection.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.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/create_injector.ts",
|
||||
"packages/core/src/di/provider_collection.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/view.ts",
|
||||
"packages/core/src/di/injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/injectable.ts",
|
||||
"packages/core/src/di/jit/injectable.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/di/provider_collection.ts",
|
||||
"packages/core/src/render3/definition.ts",
|
||||
"packages/core/src/render3/interfaces/definition.ts",
|
||||
"packages/core/src/di/r3_injector.ts"
|
||||
],
|
||||
[
|
||||
"packages/core/src/linker/component_factory_resolver.ts",
|
||||
"packages/core/src/linker/component_factory.ts",
|
||||
|
|
@ -120,27 +66,8 @@
|
|||
],
|
||||
[
|
||||
"packages/core/src/render3/interfaces/container.ts",
|
||||
"packages/core/src/render3/interfaces/node.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"
|
||||
|
|
|
|||
|
|
@ -322,6 +322,6 @@ export { AfterRenderEventManager as ɵAfterRenderEventManager, internalAfterNext
|
|||
export {depsTracker as ɵdepsTracker, USE_RUNTIME_DEPS_TRACKER_FOR_JIT as ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT} from './render3/deps_tracker/deps_tracker';
|
||||
export {generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError} from './render3/jit/module';
|
||||
export {getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn} from './render3/metadata';
|
||||
export {InputFlags as ɵɵInputFlags} from './render3/interfaces/definition';
|
||||
export {InputFlags as ɵɵInputFlags} from './render3/interfaces/input_flags';
|
||||
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
import {EMPTY_ARRAY} from '../util/empty';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {Injector} from './injector';
|
||||
import {Provider, StaticProvider} from './interface/provider';
|
||||
import type {Injector} from './injector';
|
||||
import type {Provider, StaticProvider} from './interface/provider';
|
||||
import {importProvidersFrom} from './provider_collection';
|
||||
import {getNullInjector, R3Injector} from './r3_injector';
|
||||
import {InjectorScope} from './scope';
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {stringify} from '../util/stringify';
|
|||
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
import {getInjectImplementation, injectRootLimpMode} from './inject_switch';
|
||||
import {Injector} from './injector';
|
||||
import type {Injector} from './injector';
|
||||
import {DecoratorFlags, InjectFlags, InjectOptions, InternalInjectFlags} from './interface/injector';
|
||||
import {ProviderToken} from './provider_token';
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {InjectionToken} from './injection_token';
|
||||
import {Injector} from './injector';
|
||||
import type {Injector} from './injector';
|
||||
import {InjectorMarkers} from './injector_marker';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {stringify} from '../util/stringify';
|
||||
import {Injector} from './injector';
|
||||
import type {Injector} from './injector';
|
||||
import {THROW_IF_NOT_FOUND} from './injector_compatibility';
|
||||
|
||||
export class NullInjector implements Injector {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import {resolveForwardRef} from './forward_ref';
|
|||
import {ENVIRONMENT_INITIALIZER} from './initializer_token';
|
||||
import {setInjectImplementation} from './inject_switch';
|
||||
import {InjectionToken} from './injection_token';
|
||||
import {Injector} from './injector';
|
||||
import type {Injector} from './injector';
|
||||
import {catchInjectorError, convertToBitFlags, injectArgs, NG_TEMP_TOKEN_PATH, setCurrentInjector, THROW_IF_NOT_FOUND, ɵɵinject} from './injector_compatibility';
|
||||
import {INJECTOR} from './injector_token';
|
||||
import {getInheritedInjectableDef, getInjectableDef, InjectorType, ɵɵInjectableDeclaration} from './interface/defs';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {Injector} from '../di/injector';
|
||||
import {ViewRef} from '../linker/view_ref';
|
||||
import type {ViewRef} from '../linker/view_ref';
|
||||
import {LContainer} from '../render3/interfaces/container';
|
||||
import {getDocument} from '../render3/interfaces/document';
|
||||
import {RElement, RNode} from '../render3/interfaces/renderer_dom';
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ import {reportUnknownPropertyError} from './instructions/element_validation';
|
|||
import {markViewDirty} from './instructions/mark_view_dirty';
|
||||
import {renderView} from './instructions/render';
|
||||
import {addToViewTree, createLView, createTView, executeContentQueries, getOrCreateComponentTView, getOrCreateTNode, initializeDirectives, invokeDirectivesHostBindings, locateHostElement, markAsComponentHost, setInputsForProperty} from './instructions/shared';
|
||||
import {ComponentDef, DirectiveDef, HostDirectiveDefs, InputFlags} from './interfaces/definition';
|
||||
import {ComponentDef, DirectiveDef, HostDirectiveDefs} from './interfaces/definition';
|
||||
import {InputFlags} from './interfaces/input_flags';
|
||||
import {NodeInputBindings, TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeType} from './interfaces/node';
|
||||
import {Renderer} from './interfaces/renderer';
|
||||
import {RElement, RNode} from './interfaces/renderer_dom';
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ import {initNgDevMode} from '../util/ng_dev_mode';
|
|||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {NG_COMP_DEF, NG_DIR_DEF, NG_MOD_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {ComponentDef, ComponentDefFeature, ComponentTemplate, ContentQueriesFunction, DependencyTypeList, DirectiveDef, DirectiveDefFeature, DirectiveDefListOrFactory, HostBindingsFunction, InputFlags, InputTransformFunction, PipeDef, PipeDefListOrFactory, TypeOrFactory, ViewQueriesFunction} from './interfaces/definition';
|
||||
import {TAttributes, TConstantsOrFactory} from './interfaces/node';
|
||||
import type {ComponentDef, ComponentDefFeature, ComponentTemplate, ContentQueriesFunction, DependencyTypeList, DirectiveDef, DirectiveDefFeature, DirectiveDefListOrFactory, HostBindingsFunction, InputTransformFunction, PipeDef, PipeDefListOrFactory, TypeOrFactory, ViewQueriesFunction} from './interfaces/definition';
|
||||
import { InputFlags } from './interfaces/input_flags';
|
||||
import type {TAttributes, TConstantsOrFactory} from './interfaces/node';
|
||||
import {CssSelectorList} from './interfaces/projection';
|
||||
import {stringifyCSSSelectorList} from './node_selector_matcher';
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ import {getFactoryDef} from './definition_factory';
|
|||
import {throwCyclicDependencyError, throwProviderNotFoundError} from './errors_di';
|
||||
import {NG_ELEMENT_ID, NG_FACTORY_DEF} from './fields';
|
||||
import {registerPreOrderHooks} from './hooks';
|
||||
import { AttributeMarker } from './interfaces/attribute_marker';
|
||||
import {ComponentDef, 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 {TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TNode, TNodeProviderIndexes, TNodeType} from './interfaces/node';
|
||||
import {isComponentDef, isComponentHost} from './interfaces/type_checks';
|
||||
import {DECLARATION_COMPONENT_VIEW, DECLARATION_VIEW, EMBEDDED_VIEW_INJECTOR, FLAGS, INJECTOR, LView, LViewFlags, T_HOST, TData, TVIEW, TView, TViewType} from './interfaces/view';
|
||||
import {assertTNodeType} from './node_assert';
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {SimpleChange, SimpleChanges} from '../../interface/simple_change';
|
|||
import {assertString} from '../../util/assert';
|
||||
import {EMPTY_OBJ} from '../../util/empty';
|
||||
import {applyValueToInputField} from '../apply_value_input_field';
|
||||
import {DirectiveDef, DirectiveDefFeature, InputFlags} from '../interfaces/definition';
|
||||
import {DirectiveDef, DirectiveDefFeature} from '../interfaces/definition';
|
||||
|
||||
/**
|
||||
* The NgOnChangesFeature decorates a component with support for the ngOnChanges
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ export {ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp,ɵ
|
|||
export {RenderFlags} from './interfaces/definition';
|
||||
export {
|
||||
AttributeMarker
|
||||
} from './interfaces/node';
|
||||
} from './interfaces/attribute_marker';
|
||||
export {CssSelectorList, ProjectionSlots} from './interfaces/projection';
|
||||
export {
|
||||
setClassMetadata,
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ import {getFactoryDef} from '../definition_factory';
|
|||
import {diPublicInInjector, getNodeInjectable, getOrCreateNodeInjectorForNode} from '../di';
|
||||
import {throwMultipleComponentError} from '../errors';
|
||||
import {CONTAINER_HEADER_OFFSET, LContainer} from '../interfaces/container';
|
||||
import {ComponentDef, ComponentTemplate, DirectiveDef, DirectiveDefListOrFactory, HostBindingsFunction, HostDirectiveBindingMap, HostDirectiveDefs, InputFlags, PipeDefListOrFactory, RenderFlags, ViewQueriesFunction} from '../interfaces/definition';
|
||||
import {ComponentDef, ComponentTemplate, DirectiveDef, DirectiveDefListOrFactory, HostBindingsFunction, HostDirectiveBindingMap, HostDirectiveDefs, PipeDefListOrFactory, RenderFlags, ViewQueriesFunction} from '../interfaces/definition';
|
||||
import {NodeInjectorFactory} from '../interfaces/injector';
|
||||
import {getUniqueLViewId} from '../interfaces/lview_tracking';
|
||||
import {AttributeMarker, InitialInputData, InitialInputs, LocalRefExtractor, NodeInputBindings, NodeOutputBindings, TAttributes, TConstantsOrFactory, TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TIcuContainerNode, TNode, TNodeFlags, TNodeType, TProjectionNode} from '../interfaces/node';
|
||||
import {InitialInputData, InitialInputs, LocalRefExtractor, NodeInputBindings, NodeOutputBindings, TAttributes, TConstantsOrFactory, TContainerNode, TDirectiveHostNode, TElementContainerNode, TElementNode, TIcuContainerNode, TNode, TNodeFlags, TNodeType, TProjectionNode} from '../interfaces/node';
|
||||
import {Renderer} from '../interfaces/renderer';
|
||||
import {RComment, RElement, RNode, RText} from '../interfaces/renderer_dom';
|
||||
import {SanitizerFn} from '../interfaces/sanitization';
|
||||
|
|
@ -56,6 +56,8 @@ import {selectIndexInternal} from './advance';
|
|||
import {ɵɵdirectiveInject} from './di';
|
||||
import {handleUnknownPropertyError, isPropertyValid, matchingSchemas} from './element_validation';
|
||||
import {writeToDirectiveInput} from './write_to_directive_input';
|
||||
import { AttributeMarker } from '../interfaces/attribute_marker';
|
||||
import { InputFlags } from '../interfaces/input_flags';
|
||||
|
||||
/**
|
||||
* Invoke `HostBindingsFunction`s for view.
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ import {EMPTY_ARRAY} from '../../util/empty';
|
|||
import {concatStringsWithSpace, stringify} from '../../util/stringify';
|
||||
import {assertFirstUpdatePass} from '../assert';
|
||||
import {bindingUpdated} from '../bindings';
|
||||
import { AttributeMarker } from '../interfaces/attribute_marker';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
import {AttributeMarker, TAttributes, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
|
||||
import {TAttributes, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
|
||||
import {Renderer} from '../interfaces/renderer';
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
import {getTStylingRangeNext, getTStylingRangeNextDuplicate, getTStylingRangePrev, getTStylingRangePrevDuplicate, TStylingKey, TStylingRange} from '../interfaces/styling';
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ import {setActiveConsumer, SIGNAL} from '@angular/core/primitives/signals';
|
|||
import {InputSignalWithTransform} from '../../authoring/input/input_signal';
|
||||
import {InputSignalNode} from '../../authoring/input/input_signal_node';
|
||||
import {applyValueToInputField} from '../apply_value_input_field';
|
||||
import {DirectiveDef, InputFlags} from '../interfaces/definition';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
import { InputFlags } from '../interfaces/input_flags';
|
||||
|
||||
export function writeToDirectiveInput<T>(
|
||||
def: DirectiveDef<T>, instance: T, publicName: string, privateName: string, flags: InputFlags,
|
||||
|
|
|
|||
142
packages/core/src/render3/interfaces/attribute_marker.ts
Normal file
142
packages/core/src/render3/interfaces/attribute_marker.ts
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
* A set of marker values to be used in the attributes arrays. These markers indicate that some
|
||||
* items are not regular attributes and the processing should be adapted accordingly.
|
||||
*/
|
||||
export const enum AttributeMarker {
|
||||
/**
|
||||
* An implicit marker which indicates that the value in the array are of `attributeKey`,
|
||||
* `attributeValue` format.
|
||||
*
|
||||
* NOTE: This is implicit as it is the type when no marker is present in array. We indicate that
|
||||
* it should not be present at runtime by the negative number.
|
||||
*/
|
||||
ImplicitAttributes = -1,
|
||||
|
||||
/**
|
||||
* Marker indicates that the following 3 values in the attributes array are:
|
||||
* namespaceUri, attributeName, attributeValue
|
||||
* in that order.
|
||||
*/
|
||||
NamespaceURI = 0,
|
||||
|
||||
/**
|
||||
* Signals class declaration.
|
||||
*
|
||||
* Each value following `Classes` designates a class name to include on the element.
|
||||
* ## Example:
|
||||
*
|
||||
* Given:
|
||||
* ```
|
||||
* <div class="foo bar baz">...<d/vi>
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
* ```
|
||||
* var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz'];
|
||||
* ```
|
||||
*/
|
||||
Classes = 1,
|
||||
|
||||
/**
|
||||
* Signals style declaration.
|
||||
*
|
||||
* Each pair of values following `Styles` designates a style name and value to include on the
|
||||
* element.
|
||||
* ## Example:
|
||||
*
|
||||
* Given:
|
||||
* ```
|
||||
* <div style="width:100px; height:200px; color:red">...</div>
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
* ```
|
||||
* var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red'];
|
||||
* ```
|
||||
*/
|
||||
Styles = 2,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute names were extracted from input or output bindings.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div moo="car" [foo]="exp" (bar)="doSth()">
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
*
|
||||
* ```
|
||||
* var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar'];
|
||||
* ```
|
||||
*/
|
||||
Bindings = 3,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute names were hoisted from an inline-template declaration.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value">
|
||||
* ```
|
||||
*
|
||||
* the generated code for the `template()` instruction would include:
|
||||
*
|
||||
* ```
|
||||
* ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf',
|
||||
* 'ngForTrackBy', 'let-value']
|
||||
* ```
|
||||
*
|
||||
* while the generated code for the `element()` instruction inside the template function would
|
||||
* include:
|
||||
*
|
||||
* ```
|
||||
* ['dirA', '', AttributeMarker.Bindings, 'dirB']
|
||||
* ```
|
||||
*/
|
||||
Template = 4,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute is `ngProjectAs` and its value is a parsed
|
||||
* `CssSelector`.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <h1 attr="value" ngProjectAs="[title]">
|
||||
* ```
|
||||
*
|
||||
* the generated code for the `element()` instruction would include:
|
||||
*
|
||||
* ```
|
||||
* ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']]
|
||||
* ```
|
||||
*/
|
||||
ProjectAs = 5,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute will be translated by runtime i18n
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div moo="car" foo="value" i18n-foo [bar]="binding" i18n-bar>
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
*
|
||||
* ```
|
||||
* var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar'];
|
||||
*/
|
||||
I18n = 6,
|
||||
}
|
||||
|
|
@ -16,7 +16,8 @@ import {FactoryFn} from '../definition_factory';
|
|||
|
||||
import {TAttributes, TConstantsOrFactory} from './node';
|
||||
import {CssSelectorList} from './projection';
|
||||
import {TView} from './view';
|
||||
import type {TView} from './view';
|
||||
import {InputFlags} from './input_flags';
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -88,13 +89,6 @@ export interface PipeType<T> extends Type<T> {
|
|||
ɵpipe: unknown;
|
||||
}
|
||||
|
||||
/** Flags describing an input for a directive. */
|
||||
export enum InputFlags {
|
||||
None = 0,
|
||||
SignalBased = 1 << 0,
|
||||
HasDecoratorInputTransform = 1 << 1,
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime link information for Directives.
|
||||
*
|
||||
|
|
|
|||
14
packages/core/src/render3/interfaces/input_flags.ts
Normal file
14
packages/core/src/render3/interfaces/input_flags.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/** Flags describing an input for a directive. */
|
||||
export enum InputFlags {
|
||||
None = 0,
|
||||
SignalBased = 1 << 0,
|
||||
HasDecoratorInputTransform = 1 << 1,
|
||||
}
|
||||
|
|
@ -7,12 +7,13 @@
|
|||
*/
|
||||
import {KeyValueArray} from '../../util/array_utils';
|
||||
import {TStylingRange} from '../interfaces/styling';
|
||||
import { AttributeMarker } from './attribute_marker';
|
||||
|
||||
import type {InputFlags} from './definition';
|
||||
import {InputFlags} from './input_flags';
|
||||
import {TIcu} from './i18n';
|
||||
import {CssSelector} from './projection';
|
||||
import {RNode} from './renderer_dom';
|
||||
import {LView, TView} from './view';
|
||||
import type {LView, TView} from './view';
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -164,141 +165,6 @@ export const enum TNodeProviderIndexes {
|
|||
CptViewProvidersCountShifter = 0b00000000000100000000000000000000,
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of marker values to be used in the attributes arrays. These markers indicate that some
|
||||
* items are not regular attributes and the processing should be adapted accordingly.
|
||||
*/
|
||||
export const enum AttributeMarker {
|
||||
/**
|
||||
* An implicit marker which indicates that the value in the array are of `attributeKey`,
|
||||
* `attributeValue` format.
|
||||
*
|
||||
* NOTE: This is implicit as it is the type when no marker is present in array. We indicate that
|
||||
* it should not be present at runtime by the negative number.
|
||||
*/
|
||||
ImplicitAttributes = -1,
|
||||
|
||||
/**
|
||||
* Marker indicates that the following 3 values in the attributes array are:
|
||||
* namespaceUri, attributeName, attributeValue
|
||||
* in that order.
|
||||
*/
|
||||
NamespaceURI = 0,
|
||||
|
||||
/**
|
||||
* Signals class declaration.
|
||||
*
|
||||
* Each value following `Classes` designates a class name to include on the element.
|
||||
* ## Example:
|
||||
*
|
||||
* Given:
|
||||
* ```
|
||||
* <div class="foo bar baz">...<d/vi>
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
* ```
|
||||
* var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz'];
|
||||
* ```
|
||||
*/
|
||||
Classes = 1,
|
||||
|
||||
/**
|
||||
* Signals style declaration.
|
||||
*
|
||||
* Each pair of values following `Styles` designates a style name and value to include on the
|
||||
* element.
|
||||
* ## Example:
|
||||
*
|
||||
* Given:
|
||||
* ```
|
||||
* <div style="width:100px; height:200px; color:red">...</div>
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
* ```
|
||||
* var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red'];
|
||||
* ```
|
||||
*/
|
||||
Styles = 2,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute names were extracted from input or output bindings.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div moo="car" [foo]="exp" (bar)="doSth()">
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
*
|
||||
* ```
|
||||
* var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar'];
|
||||
* ```
|
||||
*/
|
||||
Bindings = 3,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute names were hoisted from an inline-template declaration.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value">
|
||||
* ```
|
||||
*
|
||||
* the generated code for the `template()` instruction would include:
|
||||
*
|
||||
* ```
|
||||
* ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf',
|
||||
* 'ngForTrackBy', 'let-value']
|
||||
* ```
|
||||
*
|
||||
* while the generated code for the `element()` instruction inside the template function would
|
||||
* include:
|
||||
*
|
||||
* ```
|
||||
* ['dirA', '', AttributeMarker.Bindings, 'dirB']
|
||||
* ```
|
||||
*/
|
||||
Template = 4,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute is `ngProjectAs` and its value is a parsed
|
||||
* `CssSelector`.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <h1 attr="value" ngProjectAs="[title]">
|
||||
* ```
|
||||
*
|
||||
* the generated code for the `element()` instruction would include:
|
||||
*
|
||||
* ```
|
||||
* ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']]
|
||||
* ```
|
||||
*/
|
||||
ProjectAs = 5,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute will be translated by runtime i18n
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div moo="car" foo="value" i18n-foo [bar]="binding" i18n-bar>
|
||||
* ```
|
||||
*
|
||||
* the generated code is:
|
||||
*
|
||||
* ```
|
||||
* var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar'];
|
||||
*/
|
||||
I18n = 6,
|
||||
}
|
||||
|
||||
/**
|
||||
* A combination of:
|
||||
* - Attribute names and values.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injector} from '../../di/injector';
|
||||
import type {Injector} from '../../di/injector';
|
||||
import {ProviderToken} from '../../di/provider_token';
|
||||
import {DehydratedView} from '../../hydration/interfaces';
|
||||
import {SchemaMetadata} from '../../metadata/schema';
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {forwardRef, resolveForwardRef} from '../../di/forward_ref';
|
|||
import {ɵɵinject, ɵɵinvalidFactoryDep} from '../../di/injector_compatibility';
|
||||
import {ɵɵdefineInjectable, ɵɵdefineInjector} from '../../di/interface/defs';
|
||||
import {registerNgModuleType} from '../../linker/ng_module_registration';
|
||||
import {InputFlags} from '../../render3/interfaces/definition';
|
||||
import {InputFlags} from '../../render3/interfaces/input_flags';
|
||||
import * as iframe_attrs_validation from '../../sanitization/iframe_attrs_validation';
|
||||
import * as sanitization from '../../sanitization/sanitization';
|
||||
import * as r3 from '../index';
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@ import '../util/ng_dev_mode';
|
|||
|
||||
import {assertDefined, assertEqual, assertNotEqual} from '../util/assert';
|
||||
|
||||
import {AttributeMarker, TAttributes, TNode, TNodeType} from './interfaces/node';
|
||||
import {TAttributes, TNode, TNodeType} from './interfaces/node';
|
||||
import {CssSelector, CssSelectorList, SelectorFlags} from './interfaces/projection';
|
||||
import {classIndexOf} from './styling/class_differ';
|
||||
import {isNameOnlyAttributeMarker} from './util/attrs_utils';
|
||||
import { AttributeMarker } from './interfaces/attribute_marker';
|
||||
|
||||
const NG_TEMPLATE_SELECTOR = 'ng-template';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
import {concatStringsWithSpace} from '../../util/stringify';
|
||||
import {assertFirstCreatePass} from '../assert';
|
||||
import {AttributeMarker, TAttributes, TNode} from '../interfaces/node';
|
||||
import { AttributeMarker } from '../interfaces/attribute_marker';
|
||||
import {TAttributes, TNode} from '../interfaces/node';
|
||||
import {getTView} from '../state';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {CharCode} from '../../util/char_code';
|
||||
import {AttributeMarker, TAttributes} from '../interfaces/node';
|
||||
import { AttributeMarker } from '../interfaces/attribute_marker';
|
||||
import {TAttributes} from '../interfaces/node';
|
||||
import {CssSelector} from '../interfaces/projection';
|
||||
import {Renderer} from '../interfaces/renderer';
|
||||
import {RElement} from '../interfaces/renderer_dom';
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {assertLView} from '../assert';
|
|||
import {discoverLocalRefs, getComponentAtNodeIndex, getDirectivesAtNodeIndex, getLContext, readPatchedLView} from '../context_discovery';
|
||||
import {getComponentDef, getDirectiveDef} from '../definition';
|
||||
import {NodeInjector} from '../di';
|
||||
import {DirectiveDef, InputFlags} from '../interfaces/definition';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
import {TElementNode, TNode, TNodeProviderIndexes} from '../interfaces/node';
|
||||
import {CLEANUP, CONTEXT, FLAGS, LView, LViewFlags, TVIEW, TViewType} from '../interfaces/view';
|
||||
|
||||
|
|
|
|||
|
|
@ -1217,9 +1217,6 @@
|
|||
{
|
||||
"name": "init_definition"
|
||||
},
|
||||
{
|
||||
"name": "init_definition2"
|
||||
},
|
||||
{
|
||||
"name": "init_definition_factory"
|
||||
},
|
||||
|
|
@ -1463,6 +1460,9 @@
|
|||
{
|
||||
"name": "init_input"
|
||||
},
|
||||
{
|
||||
"name": "init_input_flags"
|
||||
},
|
||||
{
|
||||
"name": "init_input_signal"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {DirectiveDef} from '@angular/core/src/render3';
|
||||
import {AttributeMarker, DirectiveDef} from '@angular/core/src/render3';
|
||||
import {ɵɵdefineDirective} from '@angular/core/src/render3/definition';
|
||||
import {classStringParser, styleStringParser, toStylingKeyValueArray, ɵɵclassProp, ɵɵstyleMap, ɵɵstyleProp} from '@angular/core/src/render3/instructions/styling';
|
||||
import {AttributeMarker, TAttributes} from '@angular/core/src/render3/interfaces/node';
|
||||
import {TAttributes} from '@angular/core/src/render3/interfaces/node';
|
||||
import {getTStylingRangeNext, getTStylingRangeNextDuplicate, getTStylingRangePrev, getTStylingRangePrevDuplicate, setTStylingRangeNext, setTStylingRangePrev, StylingRange, toTStylingRange, TStylingKey, TStylingRange} from '@angular/core/src/render3/interfaces/styling';
|
||||
import {HEADER_OFFSET, TVIEW} from '@angular/core/src/render3/interfaces/view';
|
||||
import {getLView, leaveView, setBindingRootForHostBindings} from '@angular/core/src/render3/state';
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {TestBed} from '@angular/core/testing';
|
|||
import {getSortedClassName} from '@angular/core/testing/src/styling';
|
||||
|
||||
import {ɵɵadvance, ɵɵattribute, ɵɵclassMap, ɵɵelement, ɵɵproperty, ɵɵstyleMap, ɵɵstyleProp} from '../../src/render3/index';
|
||||
import {AttributeMarker} from '../../src/render3/interfaces/node';
|
||||
import {AttributeMarker} from '../../src/render3/interfaces/attribute_marker';
|
||||
import {bypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript, bypassSanitizationTrustStyle, bypassSanitizationTrustUrl, getSanitizationBypassType, SafeValue, unwrapSafeValue} from '../../src/sanitization/bypass';
|
||||
import {ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl} from '../../src/sanitization/sanitization';
|
||||
import {Sanitizer} from '../../src/sanitization/sanitizer';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
import {createTNode} from '@angular/core/src/render3/instructions/shared';
|
||||
|
||||
import {AttributeMarker, TAttributes, TNode, TNodeType} from '../../src/render3/interfaces/node';
|
||||
import {AttributeMarker} from '../../src/render3/interfaces/attribute_marker';
|
||||
import {TAttributes, TNode, TNodeType} from '../../src/render3/interfaces/node';
|
||||
import {CssSelector, CssSelectorList, SelectorFlags} from '../../src/render3/interfaces/projection';
|
||||
import {extractAttrsAndClassesFromSelector, getProjectAsAttrValue, isNodeMatchingSelector, isNodeMatchingSelectorList, stringifyCSSSelectorList} from '../../src/render3/node_selector_matcher';
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
|
||||
import {createTNode} from '@angular/core/src/render3/instructions/shared';
|
||||
import {AttributeMarker, TAttributes, TNode, TNodeType} from '@angular/core/src/render3/interfaces/node';
|
||||
import {AttributeMarker} from '@angular/core/src/render3/interfaces/attribute_marker';
|
||||
import {TAttributes, TNode, TNodeType} from '@angular/core/src/render3/interfaces/node';
|
||||
import {LView} from '@angular/core/src/render3/interfaces/view';
|
||||
import {enterView} from '@angular/core/src/render3/state';
|
||||
import {computeStaticStyling} from '@angular/core/src/render3/styling/static_styling';
|
||||
|
|
|
|||
Loading…
Reference in a new issue