Skip to content

Commit 822fc10

Browse files
refactor(UIRouter): Switched symbol names from Ui* to UI* (upper case UI)
BC-BREAK: UIRouter class names no longer have mixed case Ui. They now have upper case UI. - UiView -> UIView - UiSref -> UISref (and related directives) - UiInjector -> UIInjector
1 parent aa37ee7 commit 822fc10

30 files changed

+179
-179
lines changed

src/common/interface.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* An interface for getting values from dependency injection.
55
*/
6-
export interface UiInjector {
6+
export interface UIInjector {
77
/**
88
* Gets a value from the injector
99
*

src/common/trace.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import {parse} from "../common/hof";
3333
import {isNumber} from "../common/predicates";
3434
import {Transition} from "../transition/transition";
35-
import {ActiveUiView, ViewConfig} from "../view/interface";
35+
import {ActiveUIView, ViewConfig} from "../view/interface";
3636
import {stringify, functionToString, maxLength, padString} from "./strings";
3737
import {Resolvable} from "../resolve/resolvable";
3838
import {PathNode} from "../path/node";
@@ -211,27 +211,27 @@ export class Trace {
211211
}
212212

213213
/** called by ui-router code */
214-
traceUiViewEvent(event: string, viewData: ActiveUiView, extra = "") {
214+
traceUIViewEvent(event: string, viewData: ActiveUIView, extra = "") {
215215
if (!this.enabled(Category.UIVIEW)) return;
216216
console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);
217217
}
218218

219219
/** called by ui-router code */
220-
traceUiViewConfigUpdated(viewData: ActiveUiView, context) {
220+
traceUIViewConfigUpdated(viewData: ActiveUIView, context) {
221221
if (!this.enabled(Category.UIVIEW)) return;
222-
this.traceUiViewEvent("Updating", viewData, ` with ViewConfig from context='${context}'`);
222+
this.traceUIViewEvent("Updating", viewData, ` with ViewConfig from context='${context}'`);
223223
}
224224

225225
/** called by ui-router code */
226-
traceUiViewScopeCreated(viewData: ActiveUiView, newScope) {
226+
traceUIViewScopeCreated(viewData: ActiveUIView, newScope) {
227227
if (!this.enabled(Category.UIVIEW)) return;
228-
this.traceUiViewEvent("Created scope for", viewData, `, scope #${newScope.$id}`);
228+
this.traceUIViewEvent("Created scope for", viewData, `, scope #${newScope.$id}`);
229229
}
230230

231231
/** called by ui-router code */
232-
traceUiViewFill(viewData: ActiveUiView, html) {
232+
traceUIViewFill(viewData: ActiveUIView, html) {
233233
if (!this.enabled(Category.UIVIEW)) return;
234-
this.traceUiViewEvent("Fill", viewData, ` with: ${maxLength(200, html)}`);
234+
this.traceUIViewEvent("Fill", viewData, ` with: ${maxLength(200, html)}`);
235235
}
236236

237237
/** called by ui-router code */
@@ -241,7 +241,7 @@ export class Trace {
241241
}
242242

243243
/** called by ui-router code */
244-
traceViewServiceUiViewEvent(event: string, viewData: ActiveUiView) {
244+
traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {
245245
if (!this.enabled(Category.VIEWCONFIG)) return;
246246
console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);
247247
}

src/core.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export * from "./url/module";
1010
export * from "./view/module";
1111
export * from "./globals";
1212

13-
export { UiRouter } from "./router";
13+
export { UIRouter } from "./router";

src/globals.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {Observable} from "rxjs/Rx";
1414
* This is where we hold the global mutable state such as current state, current
1515
* params, current transition, etc.
1616
*/
17-
export interface UiRouterGlobals {
17+
export interface UIRouterGlobals {
1818
/**
1919
* Current parameter values
2020
*
@@ -43,7 +43,7 @@ export interface UiRouterGlobals {
4343
/**
4444
* Global mutable state
4545
*/
46-
export class Globals implements UiRouterGlobals {
46+
export class Globals implements UIRouterGlobals {
4747
params: StateParams = new StateParams();
4848
current: StateDeclaration;
4949
$current: State;

src/ng1/directives/stateDirectives.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/ /** for typedoc */
88
import {extend, forEach, toJson, tail} from "../../common/common";
99
import {isString, isObject} from "../../common/predicates";
10-
import {UiViewData} from "./viewDirective";
10+
import {UIViewData} from "./viewDirective";
1111
import {parse} from "../../common/hof";
1212
import {PathNode} from "../../path/node";
1313

@@ -22,7 +22,7 @@ function parseStateRef(ref, current) {
2222

2323
/** @hidden */
2424
function stateContext(el) {
25-
let $uiView: UiViewData = el.parent().inheritedData('$uiView');
25+
let $uiView: UIViewData = el.parent().inheritedData('$uiView');
2626
let path: PathNode[] = parse('$cfg.path')($uiView);
2727
return path ? tail(path).state.name : undefined;
2828
}

src/ng1/directives/viewDirective.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import {extend, unnestR, filter, tail} from "../../common/common";
44
import {isDefined, isFunction, isString} from "../../common/predicates";
55
import {trace} from "../../common/trace";
6-
import {ActiveUiView} from "../../view/interface";
6+
import {ActiveUIView} from "../../view/interface";
77
import {Ng1ViewConfig} from "../statebuilders/views";
88
import {TransitionService} from "../../transition/transitionService";
99
import {parse} from "../../common/hof";
@@ -17,9 +17,9 @@ import {Ng1Controller, Ng1StateDeclaration} from "../interface";
1717
import {getLocals} from "../services";
1818

1919
/** @hidden */
20-
export type UiViewData = {
20+
export type UIViewData = {
2121
$cfg: Ng1ViewConfig;
22-
$uiView: ActiveUiView;
22+
$uiView: ActiveUIView;
2323

2424
$animEnter: Promise<any>;
2525
$animLeave: Promise<any>;
@@ -203,7 +203,7 @@ function $ViewDirective( $view, $animate, $uiViewScroll, $interpolate,
203203
inherited = $element.inheritedData('$uiView') || rootData,
204204
name = $interpolate(attrs.uiView || attrs.name || '')(scope) || '$default';
205205

206-
let activeUiView: ActiveUiView = {
206+
let activeUIView: ActiveUIView = {
207207
$type: 'ng1',
208208
id: directive.count++, // Global sequential ID for ui-view tags added to DOM
209209
name: name, // ui-view name (<div ui-view="name"></div>
@@ -215,43 +215,43 @@ function $ViewDirective( $view, $animate, $uiViewScroll, $interpolate,
215215
}
216216
};
217217

218-
trace.traceUiViewEvent("Linking", activeUiView);
218+
trace.traceUIViewEvent("Linking", activeUIView);
219219

220220
function configUpdatedCallback(config?: Ng1ViewConfig) {
221221
if (config && !(config instanceof Ng1ViewConfig)) return;
222222
if (configsEqual(viewConfig, config)) return;
223-
trace.traceUiViewConfigUpdated(activeUiView, config && config.viewDecl && config.viewDecl.$context);
223+
trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);
224224

225225
viewConfig = config;
226226
updateView(config);
227227
}
228228

229-
$element.data('$uiView', { $uiView: activeUiView });
229+
$element.data('$uiView', { $uiView: activeUIView });
230230

231231
updateView();
232232

233-
unregister = $view.registerUiView(activeUiView);
233+
unregister = $view.registerUIView(activeUIView);
234234
scope.$on("$destroy", function() {
235-
trace.traceUiViewEvent("Destroying/Unregistering", activeUiView);
235+
trace.traceUIViewEvent("Destroying/Unregistering", activeUIView);
236236
unregister();
237237
});
238238

239239
function cleanupLastView() {
240240
if (previousEl) {
241-
trace.traceUiViewEvent("Removing (previous) el", previousEl.data('$uiView'));
241+
trace.traceUIViewEvent("Removing (previous) el", previousEl.data('$uiView'));
242242
previousEl.remove();
243243
previousEl = null;
244244
}
245245

246246
if (currentScope) {
247-
trace.traceUiViewEvent("Destroying scope", activeUiView);
247+
trace.traceUIViewEvent("Destroying scope", activeUIView);
248248
currentScope.$destroy();
249249
currentScope = null;
250250
}
251251

252252
if (currentEl) {
253253
let _viewData = currentEl.data('$uiView');
254-
trace.traceUiViewEvent("Animate out", _viewData);
254+
trace.traceUIViewEvent("Animate out", _viewData);
255255
renderer.leave(currentEl, function() {
256256
_viewData.$$animLeave.resolve();
257257
previousEl = null;
@@ -264,19 +264,19 @@ function $ViewDirective( $view, $animate, $uiViewScroll, $interpolate,
264264

265265
function updateView(config?: Ng1ViewConfig) {
266266
let newScope = scope.$new();
267-
trace.traceUiViewScopeCreated(activeUiView, newScope);
267+
trace.traceUIViewScopeCreated(activeUIView, newScope);
268268
let animEnter = $q.defer(), animLeave = $q.defer();
269269

270-
let $uiViewData: UiViewData = {
270+
let $uiViewData: UIViewData = {
271271
$cfg: config,
272-
$uiView: activeUiView,
272+
$uiView: activeUIView,
273273
$animEnter: animEnter.promise,
274274
$animLeave: animLeave.promise,
275275
$$animLeave: animLeave
276276
};
277277

278278
let cloned = $transclude(newScope, function(clone) {
279-
renderer.enter(clone.data('$uiView', $uiViewData), $element, function onUiViewEnter() {
279+
renderer.enter(clone.data('$uiView', $uiViewData), $element, function onUIViewEnter() {
280280
animEnter.resolve();
281281
if (currentScope) currentScope.$emit('$viewContentAnimationEnded');
282282

@@ -323,12 +323,12 @@ function $ViewDirectiveFill ( $compile, $controller, $transitions, $view,
323323
let initial = tElement.html();
324324

325325
return function (scope, $element) {
326-
let data: UiViewData = $element.data('$uiView');
326+
let data: UIViewData = $element.data('$uiView');
327327
if (!data) return;
328328

329329
let cfg: Ng1ViewConfig = data.$cfg || <any> { viewDecl: {} };
330330
$element.html(cfg.template || initial);
331-
trace.traceUiViewFill(data.$uiView, $element.html());
331+
trace.traceUIViewFill(data.$uiView, $element.html());
332332

333333
let link = $compile($element.contents());
334334
let controller = cfg.controller;

src/ng1/services.ts

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
*
44
* - Provides an implementation for the [[CoreServices]] API, based on angular 1 services.
55
* - Also registers some services with the angular 1 injector.
6-
* - Creates and bootstraps a new [[UiRouter]] object. Ties it to the the angular 1 lifecycle.
6+
* - Creates and bootstraps a new [[UIRouter]] object. Ties it to the the angular 1 lifecycle.
77
*
88
* @module ng1
99
* @preferred
1010
*/
1111

1212
/** for typedoc */
13-
import {UiRouter} from "../router";
13+
import {UIRouter} from "../router";
1414
import {services} from "../common/coreservices";
1515
import {bindFunctions, removeFrom, applyPairs} from "../common/common";
1616
import {prop} from "../common/hof";
@@ -156,14 +156,14 @@ function runBlock($injector, $q) {
156156

157157
app.run(runBlock);
158158

159-
let router: UiRouter = null;
159+
let router: UIRouter = null;
160160

161-
ng1UiRouter.$inject = ['$locationProvider'];
161+
ng1UIRouter.$inject = ['$locationProvider'];
162162
/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */
163-
function ng1UiRouter($locationProvider) {
163+
function ng1UIRouter($locationProvider) {
164164

165-
// Create a new instance of the Router when the ng1UiRouterProvider is initialized
166-
router = new UiRouter();
165+
// Create a new instance of the Router when the ng1UIRouterProvider is initialized
166+
router = new UIRouter();
167167

168168
// Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties
169169
router.stateRegistry.decorator("views", ng1ViewsBuilder);
@@ -211,17 +211,17 @@ function ng1UiRouter($locationProvider) {
211211
}
212212
}
213213

214-
function $stateParamsFactory(ng1UiRouter) {
215-
return ng1UiRouter.globals.params;
214+
function $stateParamsFactory(ng1UIRouter) {
215+
return ng1UIRouter.globals.params;
216216
}
217217

218218
// The 'ui.router' ng1 module depends on 'ui.router.init' module.
219-
angular.module('ui.router.init', []).provider("ng1UiRouter", <any> ng1UiRouter);
219+
angular.module('ui.router.init', []).provider("ng1UIRouter", <any> ng1UIRouter);
220220
// This effectively calls $get() to init when we enter runtime
221-
angular.module('ui.router.init').run(['ng1UiRouter', function(ng1UiRouter) { }]);
221+
angular.module('ui.router.init').run(['ng1UIRouter', function(ng1UIRouter) { }]);
222222

223223
// $urlMatcherFactory service and $urlMatcherFactoryProvider
224-
angular.module('ui.router.util').provider('$urlMatcherFactory', ['ng1UiRouterProvider', () => router.urlMatcherFactory]);
224+
angular.module('ui.router.util').provider('$urlMatcherFactory', ['ng1UIRouterProvider', () => router.urlMatcherFactory]);
225225
angular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]);
226226

227227
// $urlRouter service and $urlRouterProvider
@@ -233,7 +233,7 @@ function getUrlRouterProvider() {
233233
};
234234
return router.urlRouterProvider;
235235
}
236-
angular.module('ui.router.router').provider('$urlRouter', ['ng1UiRouterProvider', getUrlRouterProvider]);
236+
angular.module('ui.router.router').provider('$urlRouter', ['ng1UIRouterProvider', getUrlRouterProvider]);
237237
angular.module('ui.router.router').run(['$urlRouter', function($urlRouter) { }]);
238238

239239
// $state service and $stateProvider
@@ -246,22 +246,22 @@ function getStateProvider() {
246246
};
247247
return router.stateProvider;
248248
}
249-
angular.module('ui.router.state').provider('$state', ['ng1UiRouterProvider', getStateProvider]);
249+
angular.module('ui.router.state').provider('$state', ['ng1UIRouterProvider', getStateProvider]);
250250
angular.module('ui.router.state').run(['$state', function($state) { }]);
251251

252252
// $stateParams service
253-
angular.module('ui.router.state').factory('$stateParams', ['ng1UiRouter', (ng1UiRouter) =>
254-
ng1UiRouter.globals.params]);
253+
angular.module('ui.router.state').factory('$stateParams', ['ng1UIRouter', (ng1UIRouter) =>
254+
ng1UIRouter.globals.params]);
255255

256256
// $transitions service and $transitionsProvider
257257
function getTransitionsProvider() {
258258
router.transitionService["$get"] = () => router.transitionService;
259259
return router.transitionService;
260260
}
261-
angular.module('ui.router.state').provider('$transitions', ['ng1UiRouterProvider', getTransitionsProvider]);
261+
angular.module('ui.router.state').provider('$transitions', ['ng1UIRouterProvider', getTransitionsProvider]);
262262

263263
// $templateFactory service
264-
angular.module('ui.router.util').factory('$templateFactory', ['ng1UiRouter', () => new TemplateFactory()]);
264+
angular.module('ui.router.util').factory('$templateFactory', ['ng1UIRouter', () => new TemplateFactory()]);
265265

266266
// The $view service
267267
angular.module('ui.router').factory('$view', () => router.viewService);
@@ -283,16 +283,16 @@ export const getLocals = (ctx: ResolveContext) => {
283283
return tuples.reduce(applyPairs, {});
284284
};
285285

286-
/** Adds the angular 1 `$injector` to the `UiInjector` interface */
286+
/** Adds the angular 1 `$injector` to the `UIInjector` interface */
287287
declare module "../common/interface" {
288288
/**
289-
* This enhances the [[common.UiInjector]] interface by adding the `$injector` service as the [[native]] injector.
289+
* This enhances the [[common.UIInjector]] interface by adding the `$injector` service as the [[native]] injector.
290290
*/
291-
interface UiInjector {
291+
interface UIInjector {
292292
/**
293293
* The native Angular 1 `$injector` service
294294
*
295-
* When you have access to a `UiInjector`, this property will contain the native `$injector` Angular 1 service.
295+
* When you have access to a `UIInjector`, this property will contain the native `$injector` Angular 1 service.
296296
*
297297
* @example:
298298
* ```js

src/ng1/statebuilders/views.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function ng1ViewsBuilder(state: State) {
6969
config.$context = state;
7070
config.$name = name;
7171

72-
let normalized = ViewService.normalizeUiViewTarget(config.$context, config.$name);
72+
let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);
7373
config.$uiViewName = normalized.uiViewName;
7474
config.$uiViewContextAnchor = normalized.uiViewContextAnchor;
7575

src/ng2/directives/directives.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
22
* The UI-Router Angular 2 directives:
33
*
4-
* - [[UiView]]: A viewport for routed components
5-
* - [[UiSref]]: A state ref to a target state; navigates when clicked
6-
* - [[UiSrefActive]]: (and `UiSrefActiveEq`) Adds a css class when a UiSref's target state (or a child state) is active
4+
* - [[UIView]]: A viewport for routed components
5+
* - [[UISref]]: A state ref to a target state; navigates when clicked
6+
* - [[UISrefActive]]: (and `UISrefActiveEq`) Adds a css class when a UISref's target state (or a child state) is active
77
*
88
* @preferred @module ng2_directives
99
*/ /** */
10-
import {UiSref, AnchorUiSref} from "./uiSref";
11-
import {UiSrefActive} from "./uiSrefActive";
12-
import {UiView} from "./uiView";
13-
import {UiSrefStatus} from "./uiSrefStatus";
10+
import {UISref, AnchorUISref} from "./uiSref";
11+
import {UISrefActive} from "./uiSrefActive";
12+
import {UIView} from "./uiView";
13+
import {UISrefStatus} from "./uiSrefStatus";
1414

1515
export * from "./uiView";
1616
export * from "./uiSref";
@@ -30,4 +30,4 @@ export * from "./uiSrefActive";
3030
* })
3131
* ```
3232
*/
33-
export let UIROUTER_DIRECTIVES = [UiSref, AnchorUiSref, UiView, UiSrefActive, UiSrefStatus];
33+
export let UIROUTER_DIRECTIVES = [UISref, AnchorUISref, UIView, UISrefActive, UISrefStatus];

0 commit comments

Comments
 (0)