-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Ivy #20855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Ivy #20855
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b8c2cbe
feat(core): Moving Renderer3 into @angular/core
mhevery e959440
refactor(core): store locals in main array in rederer3
mhevery 8924445
perf: add large table and deep tree benchmarks for render3
marclaval e6b1ec7
perf: add benchmarks for IV and render3 with functions (tree)
marclaval f5af17c
docs(core): add comments to assert functions
kara d9826e5
docs(core): add comments to node_manipulation functions
kara b6c3101
refactor(core): store directive defs in static data
kara 026748b
docs(core): document di and minor renames
kara 4cf0d84
docs(core): add more comments to di and fix formatting
kara 70c10c4
refactor(core): renamed and split out interfaces
kara cf65350
style: fix formatting errors
mhevery c7142c8
docs(core): add docs to instructions, minor renames
kara 69db520
refactor(core): rename instructions for consistency
kara 28cbf2f
perf: use style.setProperty instead of setAttribute in render3 and iv…
marclaval bc69f35
style: fix formatting errors
mhevery 53e6363
feat: support queries for elements with local names
pkozlowski-opensource 7618565
feat(core): add renderer factory in render3
marclaval 48ad6e2
refactor: remove import circular dependencies
pkozlowski-opensource 8be04bb
test(core): animation renderer factory in render3
marclaval c1d1f83
docs(core): add missing docs to component and fix formatting
kara 0951ded
feat(core): support 'read' option for ngIvy queries
pkozlowski-opensource 63a993f
build: yarn buildifier
mhevery 58def09
build: fix benchmarks for render3
mhevery 0ad6b71
build: fix circular dep between interface and l_node by merging
mhevery File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
build: fix circular dep between interface and l_node by merging
- Loading branch information
commit 0ad6b71cfd761a344e19c8693c7c8639898deee1
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,14 @@ | |
|
|
||
| // We are temporarily importing the existing viewEngine from core so we can be sure we are | ||
| // correctly implementing its interfaces for backwards compatibility. | ||
| import * as viewEngine from '../core'; | ||
| import {Injector} from '../di/injector'; | ||
| import {ComponentRef as viewEngine_ComponentRef} from '../linker/component_factory'; | ||
| import {EmbeddedViewRef as viewEngine_EmbeddedViewRef} from '../linker/view_ref'; | ||
|
|
||
| import {assertNotNull} from './assert'; | ||
| import {ComponentDef, ComponentType} from './definition_interfaces'; | ||
| import {NG_HOST_SYMBOL, createError, createViewState, directive, enterView, hostElement, leaveView, locateHostElement, renderComponentOrTemplate} from './instructions'; | ||
| import {LElement} from './l_node'; | ||
| import {ComponentDef, ComponentType} from './public_interfaces'; | ||
| import {LElement} from './interfaces'; | ||
| import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './renderer'; | ||
| import {notImplemented, stringify} from './util'; | ||
|
|
||
|
|
@@ -32,7 +34,7 @@ export interface CreateComponentOptions { | |
| host?: RElement|string; | ||
|
|
||
| /** Module injector for the component. If unspecified, the injector will be NULL_INJECTOR. */ | ||
| injector?: viewEngine.Injector; | ||
| injector?: Injector; | ||
|
|
||
| /** | ||
| * List of features to be applied to the created component. Features are simply | ||
|
|
@@ -51,7 +53,7 @@ export interface CreateComponentOptions { | |
| * @param options Optional parameters which control bootstrapping | ||
| */ | ||
| export function createComponentRef<T>( | ||
| componentType: ComponentType<T>, opts: CreateComponentOptions): viewEngine.ComponentRef<T> { | ||
| componentType: ComponentType<T>, opts: CreateComponentOptions): viewEngine_ComponentRef<T> { | ||
| const component = renderComponent(componentType, opts); | ||
| const hostView = createViewRef(() => detectChanges(component), component); | ||
| return { | ||
|
|
@@ -78,7 +80,7 @@ function createViewRef<T>(detectChanges: () => void, context: T): EmbeddedViewRe | |
| return addDestroyable(new EmbeddedViewRef(detectChanges), context); | ||
| } | ||
|
|
||
| class EmbeddedViewRef<T> implements viewEngine.EmbeddedViewRef<T> { | ||
| class EmbeddedViewRef<T> implements viewEngine_EmbeddedViewRef<T> { | ||
| // TODO: rootNodes should be replaced when properly implemented | ||
| rootNodes = null !; | ||
| context: T; | ||
|
|
@@ -147,7 +149,7 @@ function addDestroyable<T, C>(obj: any, context: C): T&DestroyRef<C> { | |
|
|
||
|
|
||
| // TODO: A hack to not pull in the NullInjector from @angular/core. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you fix the hack before landing in master?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because it would break the other repo, will fix when we officially cut over |
||
| export const NULL_INJECTOR: viewEngine.Injector = { | ||
| export const NULL_INJECTOR: Injector = { | ||
| get: (token: any, notFoundValue?: any) => { | ||
| throw new Error('NullInjector: Not found: ' + stringify(token)); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| */ | ||
|
|
||
| import {RendererType2} from '../render/api'; | ||
| import {Type} from '../type'; | ||
| import {resolveRendererType2} from '../view/util'; | ||
|
|
||
| import {ComponentDef, ComponentDefArgs, DirectiveDef, DirectiveDefArgs} from './definition_interfaces'; | ||
| import {componentRefresh, diPublic} from './instructions'; | ||
|
|
||
|
|
||
|
|
||
| /** | ||
| * Create a component definition object. | ||
| * | ||
| * | ||
| * # Example | ||
| * ``` | ||
| * class MyDirective { | ||
| * // Generated by Angular Template Compiler | ||
| * // [Symbol] syntax will not be supported by TypeScript until v2.7 | ||
| * static [COMPONENT_DEF_SYMBOL] = defineComponent({ | ||
| * ... | ||
| * }); | ||
| * } | ||
| * ``` | ||
| */ | ||
| export function defineComponent<T>(componentDefinition: ComponentDefArgs<T>): ComponentDef<T> { | ||
| const def = <ComponentDef<any>>{ | ||
| type: componentDefinition.type, | ||
| diPublic: null, | ||
| n: componentDefinition.factory, | ||
| tag: (componentDefinition as ComponentDefArgs<T>).tag || null !, | ||
| template: (componentDefinition as ComponentDefArgs<T>).template || null !, | ||
| r: componentDefinition.refresh || | ||
| function(d: number, e: number) { componentRefresh(d, e, componentDefinition.template); }, | ||
| inputs: invertObject(componentDefinition.inputs), | ||
| outputs: invertObject(componentDefinition.outputs), | ||
| methods: invertObject(componentDefinition.methods), | ||
| rendererType: resolveRendererType2(componentDefinition.rendererType) || null, | ||
| }; | ||
| const feature = componentDefinition.features; | ||
| feature && feature.forEach((fn) => fn(def)); | ||
| return def; | ||
| } | ||
|
|
||
| export function NgOnChangesFeature<T>(definition: DirectiveDef<T>) { | ||
| // TODO: implement. See: https://app.asana.com/0/443577627818617/465170715764659 | ||
| } | ||
|
|
||
| export function PublicFeature<T>(definition: DirectiveDef<T>) { | ||
| definition.diPublic = diPublic; | ||
| } | ||
|
|
||
| const EMPTY = {}; | ||
|
|
||
| /** Swaps the keys and values of an object. */ | ||
| function invertObject(obj: any): any { | ||
| if (obj == null) return EMPTY; | ||
| const newObj: any = {}; | ||
| for (let minifiedKey in obj) { | ||
| newObj[obj[minifiedKey]] = minifiedKey; | ||
| } | ||
| return newObj; | ||
| } | ||
|
|
||
| /** | ||
| * Create a directive definition object. | ||
| * | ||
| * # Example | ||
| * ``` | ||
| * class MyDirective { | ||
| * // Generated by Angular Template Compiler | ||
| * // [Symbol] syntax will not be supported by TypeScript until v2.7 | ||
| * static [DIRECTIVE_DEF_SYMBOL] = defineDirective({ | ||
| * ... | ||
| * }); | ||
| * } | ||
| * ``` | ||
| */ | ||
| export const defineDirective = defineComponent as<T>(directiveDefinition: DirectiveDefArgs<T>) => | ||
| DirectiveDef<T>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this always for bootstrap? If so, would it make sense to say
bootstrapComponent<T>? If not,createComponent?This will better reflect what the function does rather than what it returns.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The analogy I'd make is that you want APIs to be like
dialog.open(), notdialog.createDialogRef(), which, while accurate, is kind of missing the point