Skip to content
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

Rename2 #4470

Closed
wants to merge 4 commits into from
Closed

Rename2 #4470

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions modules/angular2/angular2.dart
Expand Up @@ -9,6 +9,5 @@ export 'package:angular2/core.dart' hide forwardRef, resolveForwardRef, ForwardR
export 'package:angular2/profile.dart';
export 'package:angular2/lifecycle_hooks.dart';
export 'package:angular2/src/core/application_ref.dart';
export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE;
export 'package:angular2/src/core/render/dom/dom_tokens.dart' hide APP_ID_RANDOM_BINDING;
export 'package:angular2/src/core/render/dom/dom_tokens.dart' hide APP_ID_RANDOM_BINDING;
export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_BINDING;
export 'package:angular2/src/core/render/dom/dom_tokens.dart';
2 changes: 1 addition & 1 deletion modules/angular2/mock.ts
Expand Up @@ -2,4 +2,4 @@ export * from './src/mock/mock_location_strategy';
export {LocationStrategy} from './src/router/location_strategy';

export {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
export {MockXHR} from 'angular2/src/core/render/xhr_mock';
export {MockXHR} from 'angular2/src/core/compiler/xhr_mock';
2 changes: 1 addition & 1 deletion modules/angular2/src/core/application.ts
Expand Up @@ -6,7 +6,7 @@ import {compilerBindings} from 'angular2/src/core/compiler/compiler';
import {commonBootstrap} from './application_common';
import {ComponentRef} from './linker/dynamic_component_loader';

export {APP_COMPONENT} from './application_tokens';
export {APP_COMPONENT, APP_ID} from './application_tokens';
export {platform} from './application_common';
export {
PlatformRef,
Expand Down
19 changes: 5 additions & 14 deletions modules/angular2/src/core/application_common.ts
Expand Up @@ -13,32 +13,27 @@ import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter';
import {BrowserGetTestability} from 'angular2/src/core/testability/browser_testability';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async';
import {XHR} from 'angular2/src/core/render/xhr';
import {XHRImpl} from 'angular2/src/core/render/xhr_impl';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {XHRImpl} from 'angular2/src/core/compiler/xhr_impl';

import {
EventManager,
DomEventsPlugin,
EVENT_MANAGER_PLUGINS
} from 'angular2/src/core/render/dom/events/event_manager';
import {KeyEventsPlugin} from 'angular2/src/core/render/dom/events/key_events';
import {HammerGesturesPlugin} from 'angular2/src/core/render/dom/events/hammer_gestures';
import {AppRootUrl} from 'angular2/src/core/services/app_root_url';
import {AnchorBasedAppRootUrl} from 'angular2/src/core/services/anchor_based_app_root_url';
import {
ComponentRef,
DynamicComponentLoader
} from 'angular2/src/core/linker/dynamic_component_loader';
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
import {Renderer} from 'angular2/src/core/render/api';
import {DomRenderer, DOCUMENT, APP_ID_RANDOM_BINDING} from 'angular2/src/core/render/render';
import {ElementSchemaRegistry} from 'angular2/src/core/render/dom/schema/element_schema_registry';
import {
DomElementSchemaRegistry
} from 'angular2/src/core/render/dom/schema/dom_element_schema_registry';
import {DomRenderer, DOCUMENT} from 'angular2/src/core/render/render';
import {
SharedStylesHost,
DomSharedStylesHost
} from 'angular2/src/core/render/dom/view/shared_styles_host';
} from 'angular2/src/core/render/dom/shared_styles_host';
import {EXCEPTION_BINDING} from './platform_bindings';
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
import {BrowserDetails} from 'angular2/src/animate/browser_details';
Expand All @@ -62,15 +57,11 @@ export function applicationDomBindings(): Array<Type | Binding | any[]> {
new Binding(EVENT_MANAGER_PLUGINS, {toClass: HammerGesturesPlugin, multi: true}),
DomRenderer,
bind(Renderer).toAlias(DomRenderer),
APP_ID_RANDOM_BINDING,
bind(ElementSchemaRegistry).toValue(new DomElementSchemaRegistry()),
DomSharedStylesHost,
bind(SharedStylesHost).toAlias(DomSharedStylesHost),
EXCEPTION_BINDING,
bind(XHR).toValue(new XHRImpl()),
Testability,
AnchorBasedAppRootUrl,
bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl),
BrowserDetails,
AnimationBuilder,
FORM_BINDINGS
Expand Down
15 changes: 5 additions & 10 deletions modules/angular2/src/core/application_ref.ts
@@ -1,7 +1,11 @@
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {Type, isBlank, isPresent, assertionsEnabled} from 'angular2/src/core/facade/lang';
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
import {APP_COMPONENT_REF_PROMISE, APP_COMPONENT} from './application_tokens';
import {
APP_COMPONENT_REF_PROMISE,
APP_COMPONENT,
APP_ID_RANDOM_BINDING
} from './application_tokens';
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {Reflector, reflector} from 'angular2/src/core/reflection/reflection';
Expand All @@ -19,8 +23,6 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {internalView} from 'angular2/src/core/linker/view_ref';
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
import {
Parser,
Lexer,
IterableDiffers,
defaultIterableDiffers,
KeyValueDiffers,
Expand All @@ -35,10 +37,6 @@ import {DEFAULT_PIPES} from 'angular2/src/core/pipes';
import {ViewResolver} from './linker/view_resolver';
import {DirectiveResolver} from './linker/directive_resolver';
import {PipeResolver} from './linker/pipe_resolver';
import {UrlResolver} from 'angular2/src/core/services/url_resolver';
import {
APP_ID_RANDOM_BINDING,
} from 'angular2/src/core/render/render';
import {Compiler} from 'angular2/src/core/linker/compiler';

/**
Expand Down Expand Up @@ -98,10 +96,7 @@ export function applicationCommonBindings(): Array<Type | Binding | any[]> {
bind(IterableDiffers).toValue(defaultIterableDiffers),
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
DirectiveResolver,
UrlResolver,
PipeResolver,
Parser,
Lexer,
DynamicComponentLoader,
bind(LifeCycle).toFactory((exceptionHandler) => new LifeCycle(null, assertionsEnabled()),
[ExceptionHandler]),
Expand Down
29 changes: 27 additions & 2 deletions modules/angular2/src/core/application_tokens.ts
@@ -1,5 +1,5 @@
import {OpaqueToken} from 'angular2/src/core/di';
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
import {OpaqueToken, Binding} from 'angular2/src/core/di';
import {CONST_EXPR, Math, StringWrapper} from 'angular2/src/core/facade/lang';

/**
* @private
Expand All @@ -24,3 +24,28 @@ export const APP_COMPONENT_REF_PROMISE = CONST_EXPR(new OpaqueToken('Promise<Com
* ```
*/
export const APP_COMPONENT: OpaqueToken = CONST_EXPR(new OpaqueToken('AppComponent'));

/**
* A DI Token representing a unique string id assigned to the application by Angular and used
* primarily for prefixing application attributes and CSS styles when
* {@link ViewEncapsulation#Emulated} is being used.
*
* If you need to avoid randomly generated value to be used as an application id, you can provide
* a custom value via a DI binding <!-- TODO: provider --> configuring the root {@link Injector}
* using this token.
*/
export const APP_ID: OpaqueToken = CONST_EXPR(new OpaqueToken('AppId'));

function _appIdRandomBindingFactory() {
return `${_randomChar()}${_randomChar()}${_randomChar()}`;
}

/**
* Bindings that will generate a random APP_ID_TOKEN.
*/
export const APP_ID_RANDOM_BINDING: Binding =
CONST_EXPR(new Binding(APP_ID, {toFactory: _appIdRandomBindingFactory, deps: []}));

function _randomChar(): string {
return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25));
}
Expand Up @@ -7,7 +7,7 @@ export 'dart:core' show List;
export 'package:angular2/src/core/change_detection/abstract_change_detector.dart'
show AbstractChangeDetector;
export 'package:angular2/src/core/change_detection/change_detection.dart'
show preGeneratedProtoDetectors, ChangeDetectionStrategy;
show ChangeDetectionStrategy;
export 'package:angular2/src/core/change_detection/directive_record.dart'
show DirectiveIndex, DirectiveRecord;
export 'package:angular2/src/core/change_detection/interfaces.dart'
Expand Down
@@ -1,4 +1,4 @@
import {AppRootUrl} from "angular2/src/core/services/app_root_url";
import {AppRootUrl} from "angular2/src/core/compiler/app_root_url";
import {DOM} from "angular2/src/core/dom/dom_adapter";
import {Injectable} from "angular2/src/core/di";

Expand Down
15 changes: 12 additions & 3 deletions modules/angular2/src/core/compiler/compiler.ts
Expand Up @@ -19,13 +19,19 @@ import {TemplateCompiler} from 'angular2/src/core/compiler/template_compiler';
import {ChangeDetectorGenConfig} from 'angular2/src/core/change_detection/change_detection';
import {Compiler} from 'angular2/src/core/linker/compiler';
import {RuntimeCompiler} from 'angular2/src/core/compiler/runtime_compiler';
import {ElementSchemaRegistry} from 'angular2/src/core/render/dom/schema/element_schema_registry';
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
import {
DomElementSchemaRegistry
} from 'angular2/src/core/render/dom/schema/dom_element_schema_registry';
} from 'angular2/src/core/compiler/schema/dom_element_schema_registry';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
import {AppRootUrl} from 'angular2/src/core/compiler/app_root_url';
import {AnchorBasedAppRootUrl} from 'angular2/src/core/compiler/anchor_based_app_root_url';
import {Parser, Lexer} from 'angular2/src/core/change_detection/change_detection';

export function compilerBindings(): Array<Type | Binding | any[]> {
return [
Lexer,
Parser,
HtmlParser,
TemplateParser,
TemplateNormalizer,
Expand All @@ -40,6 +46,9 @@ export function compilerBindings(): Array<Type | Binding | any[]> {
RuntimeCompiler,
bind(Compiler).toAlias(RuntimeCompiler),
DomElementSchemaRegistry,
bind(ElementSchemaRegistry).toAlias(DomElementSchemaRegistry)
bind(ElementSchemaRegistry).toAlias(DomElementSchemaRegistry),
AnchorBasedAppRootUrl,
bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl),
UrlResolver
];
}
2 changes: 1 addition & 1 deletion modules/angular2/src/core/compiler/directive_metadata.ts
Expand Up @@ -13,7 +13,7 @@ import {
CHANGE_DECTION_STRATEGY_VALUES
} from 'angular2/src/core/change_detection/change_detection';
import {ViewEncapsulation, VIEW_ENCAPSULATION_VALUES} from 'angular2/src/core/render/api';
import {CssSelector} from 'angular2/src/core/render/dom/compiler/selector';
import {CssSelector} from 'angular2/src/core/compiler/selector';
import {splitAtColon} from './util';
import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from 'angular2/src/core/linker/interfaces';

Expand Down
8 changes: 4 additions & 4 deletions modules/angular2/src/core/compiler/style_compiler.ts
@@ -1,11 +1,11 @@
import {CompileTypeMetadata, CompileTemplateMetadata} from './directive_metadata';
import {SourceModule, SourceExpression, moduleRef} from './source_module';
import {ViewEncapsulation} from 'angular2/src/core/render/api';
import {XHR} from 'angular2/src/core/render/xhr';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {StringWrapper, isBlank} from 'angular2/src/core/facade/lang';
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
import {ShadowCss} from 'angular2/src/core/render/dom/compiler/shadow_css';
import {UrlResolver} from 'angular2/src/core/services/url_resolver';
import {ShadowCss} from 'angular2/src/core/compiler/shadow_css';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
import {resolveStyleUrls} from './style_url_resolver';
import {
escapeSingleQuoteString,
Expand Down Expand Up @@ -148,4 +148,4 @@ function componentId(appId: string, templateId: number): string {

function componentIdExpression(appIdExpression: string, templateIdExpression: string): string {
return `${appIdExpression}+'-'+${codeGenToString(templateIdExpression)}`;
}
}
2 changes: 1 addition & 1 deletion modules/angular2/src/core/compiler/style_url_resolver.ts
Expand Up @@ -2,7 +2,7 @@
// https://github.com/webcomponents/webcomponentsjs/blob/master/src/HTMLImports/path.js

import {RegExp, RegExpWrapper, StringWrapper, isPresent} from 'angular2/src/core/facade/lang';
import {UrlResolver} from 'angular2/src/core/services/url_resolver';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';

/**
* Rewrites URLs by resolving '@import' and 'url()' URLs from the given base URL,
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/compiler/template_compiler.ts
Expand Up @@ -23,7 +23,7 @@ import {CommandCompiler} from './command_compiler';
import {TemplateParser} from './template_parser';
import {TemplateNormalizer} from './template_normalizer';
import {RuntimeMetadataResolver} from './runtime_metadata';
import {APP_ID} from 'angular2/src/core/render/dom/dom_tokens';
import {APP_ID} from 'angular2/src/core/application_tokens';

import {TEMPLATE_COMMANDS_MODULE_REF} from './command_compiler';
import {
Expand Down
4 changes: 2 additions & 2 deletions modules/angular2/src/core/compiler/template_normalizer.ts
Expand Up @@ -7,8 +7,8 @@ import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
import {BaseException} from 'angular2/src/core/facade/exceptions';
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';

import {XHR} from 'angular2/src/core/render/xhr';
import {UrlResolver} from 'angular2/src/core/services/url_resolver';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
import {resolveStyleUrls} from './style_url_resolver';
import {Injectable} from 'angular2/src/core/di';
import {ViewEncapsulation} from 'angular2/src/core/render/api';
Expand Down
4 changes: 2 additions & 2 deletions modules/angular2/src/core/compiler/template_parser.ts
Expand Up @@ -35,9 +35,9 @@ import {
DirectiveAst,
BoundDirectivePropertyAst
} from './template_ast';
import {CssSelector, SelectorMatcher} from 'angular2/src/core/render/dom/compiler/selector';
import {CssSelector, SelectorMatcher} from 'angular2/src/core/compiler/selector';

import {ElementSchemaRegistry} from 'angular2/src/core/render/dom/schema/element_schema_registry';
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
import {preparseElement, PreparsedElement, PreparsedElementType} from './template_preparser';

import {
Expand Down
@@ -1,4 +1,4 @@
import {XHR} from 'angular2/src/core/render/xhr';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection';
import {isBlank, isPresent, normalizeBlank} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/dom/parse5_adapter.ts
Expand Up @@ -15,7 +15,7 @@ import {
DateWrapper
} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
import {SelectorMatcher, CssSelector} from 'angular2/src/core/render/dom/compiler/selector';
import {SelectorMatcher, CssSelector} from 'angular2/src/core/compiler/selector';

var _attrToPropMap = {
'class': 'className',
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/linker/element_injector.ts
Expand Up @@ -48,7 +48,7 @@ import {
import {QueryList} from './query_list';
import {reflector} from 'angular2/src/core/reflection/reflection';
import {SetterFn} from 'angular2/src/core/reflection/types';
import {EventConfig} from 'angular2/src/core/render/event_config';
import {EventConfig} from 'angular2/src/core/linker/event_config';
import {PipeBinding} from '../pipes/pipe_binding';

import {LifecycleHooks} from './interfaces';
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/linker/proto_view_factory.ts
Expand Up @@ -32,7 +32,7 @@ import {
} from './template_commands';

import {Renderer} from 'angular2/render';
import {APP_ID} from 'angular2/src/core/render/dom/dom_tokens';
import {APP_ID} from 'angular2/src/core/application_tokens';


@Injectable()
Expand Down
1 change: 0 additions & 1 deletion modules/angular2/src/core/render.ts
Expand Up @@ -8,7 +8,6 @@ export {
RenderFragmentRef,
RenderViewWithFragments,
DOCUMENT,
APP_ID,
RenderTemplateCmd,
RenderCommandVisitor,
RenderTextCmd,
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/render/dom/dom_renderer.ts
Expand Up @@ -13,7 +13,7 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';

import {EventManager} from './events/event_manager';

import {DomSharedStylesHost} from './view/shared_styles_host';
import {DomSharedStylesHost} from './shared_styles_host';
import {WtfScopeFn, wtfLeave, wtfCreateScope} from '../../profile/profile';

import {
Expand Down
29 changes: 2 additions & 27 deletions modules/angular2/src/core/render/dom/dom_tokens.ts
@@ -1,5 +1,5 @@
import {OpaqueToken, Binding} from 'angular2/src/core/di';
import {CONST_EXPR, StringWrapper, Math} from 'angular2/src/core/facade/lang';
import {OpaqueToken} from 'angular2/src/core/di';
import {CONST_EXPR} from 'angular2/src/core/facade/lang';

/**
* A DI Token representing the main rendering context. In a browser this is the DOM Document.
Expand All @@ -8,28 +8,3 @@ import {CONST_EXPR, StringWrapper, Math} from 'angular2/src/core/facade/lang';
* Contexts are not the same (e.g. when running the application into a Web Worker).
*/
export const DOCUMENT: OpaqueToken = CONST_EXPR(new OpaqueToken('DocumentToken'));

/**
* A DI Token representing a unique string id assigned to the application by Angular and used
* primarily for prefixing application attributes and CSS styles when
* {@link ViewEncapsulation#Emulated} is being used.
*
* If you need to avoid randomly generated value to be used as an application id, you can provide
* a custom value via a DI binding <!-- TODO: provider --> configuring the root {@link Injector}
* using this token.
*/
export const APP_ID: OpaqueToken = CONST_EXPR(new OpaqueToken('AppId'));

function _appIdRandomBindingFactory() {
return `${_randomChar()}${_randomChar()}${_randomChar()}`;
}

/**
* Bindings that will generate a random APP_ID_TOKEN.
*/
export const APP_ID_RANDOM_BINDING: Binding =
CONST_EXPR(new Binding(APP_ID, {toFactory: _appIdRandomBindingFactory, deps: []}));

function _randomChar(): string {
return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25));
}
@@ -1,7 +1,7 @@
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {Inject, Injectable} from 'angular2/src/core/di';
import {SetWrapper} from 'angular2/src/core/facade/collection';
import {DOCUMENT} from '../dom_tokens';
import {DOCUMENT} from './dom_tokens';

@Injectable()
export class SharedStylesHost {
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/render/render.ts
Expand Up @@ -4,7 +4,7 @@
* This module provides advanced support for extending dom strategy.
*/

export * from './dom/view/shared_styles_host';
export * from './dom/shared_styles_host';
export * from './dom/dom_renderer';
export * from './dom/dom_tokens';
export * from './api';
4 changes: 2 additions & 2 deletions modules/angular2/src/core/services.ts
@@ -1,4 +1,4 @@
// Public API for Services
export {AppRootUrl} from 'angular2/src/core/services/app_root_url';
export {UrlResolver} from 'angular2/src/core/services/url_resolver';
export {AppRootUrl} from 'angular2/src/core/compiler/app_root_url';
export {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
export {Title} from 'angular2/src/core/services/title';