|
| 1 | +<a name="1.0.0"></a> |
| 2 | +# [1.0.0](https://github.com/angular-ui/ui-router/compare/1.0.0-rc.1...1.0.0) (2017-04-30) |
| 3 | + |
| 4 | + |
| 5 | +# NOTICE: The npm package is renamed from `angular-ui-router` to `@uirouter/angularjs` |
| 6 | + |
| 7 | + |
| 8 | +### Bug Fixes |
| 9 | + |
| 10 | +* **noImplicitAny:** move noimplicitany compliance test file to correct location ([ec6e5e4](https://github.com/angular-ui/ui-router/commit/ec6e5e4)) |
| 11 | +* **onEnter:** Fix typescript typing for onEnter/onRetain/onExit ([df6ee24](https://github.com/angular-ui/ui-router/commit/df6ee24)) |
| 12 | +* **routeToComponent:** Bind resolves that start with data- or x- ([4559c32](https://github.com/angular-ui/ui-router/commit/4559c32)) |
| 13 | +* **StateRegistry:** Allow stateRegistry.register() to take a Ng1StateDeclaration ([cc88525](https://github.com/angular-ui/ui-router/commit/cc88525)), closes [#3345](https://github.com/angular-ui/ui-router/issues/3345) |
| 14 | +* **uiCanExit:** Only process uiCanExit hook once during redirects ([7a086ee](https://github.com/angular-ui/ui-router/commit/7a086ee)) |
| 15 | +* **uiSref:** replace angular.copy with extend (PR [#3330](https://github.com/angular-ui/ui-router/issues/3330)) ([20d1fcd](https://github.com/angular-ui/ui-router/commit/20d1fcd)), closes [#3189](https://github.com/angular-ui/ui-router/issues/3189) |
| 16 | +* **UrlRouterProvider:** export `UrlRouterProvider` symbol for use with .d.ts typings ([d71bad0](https://github.com/angular-ui/ui-router/commit/d71bad0)), closes [#3296](https://github.com/angular-ui/ui-router/issues/3296) |
| 17 | +* **view:** Allow targeting nested named ui-view by simple ui-view name ([8fe5b1f](https://github.com/angular-ui/ui-router/commit/8fe5b1f)) |
| 18 | +* **views:** Allow same views object to be reused in multiple states ([66103fc](https://github.com/angular-ui/ui-router/commit/66103fc)), closes [#3353](https://github.com/angular-ui/ui-router/issues/3353) |
| 19 | +* **views:** Better validation of view declarations (throw when there are state-level and view-level conflicts) ([7573156](https://github.com/angular-ui/ui-router/commit/7573156)) |
| 20 | + |
| 21 | + |
| 22 | +### Features |
| 23 | + |
| 24 | +* **uiSref:** Bind ui-sref to other DOM events (PR [#3343](https://github.com/angular-ui/ui-router/issues/3343)) ([193ac2e](https://github.com/angular-ui/ui-router/commit/193ac2e)), closes [#3169](https://github.com/angular-ui/ui-router/issues/3169) |
| 25 | +* **uiSref:** switch custom events prop from `event:` to `events:` ([d3942a6](https://github.com/angular-ui/ui-router/commit/d3942a6)) |
| 26 | + |
| 27 | + |
| 28 | +UI-Router for AngularJS version 1.0.0 updates ` [email protected]` to `@uirouter/ [email protected]`. |
| 29 | +Please keep reading to see if the breaking changes from core between 3.1.0 and 5.0.1 affect you. |
| 30 | + |
| 31 | +### @uirouter/core changes |
| 32 | +# [5.0.0](https://github.com/ui-router/core/compare/3.1.0...5.0.1) (2017-04-30) |
| 33 | + |
| 34 | +### Bug Fixes |
| 35 | + |
| 36 | +* **BrowserLocationConfig:** fixed protocol + port value ([#38](https://github.com/ui-router/core/issues/38)) ([5559382](https://github.com/ui-router/core/commit/5559382)) |
| 37 | +* **lazyLoad:** Allow `lazyLoad` stateBuilder: Get lazyLoad fn from internal State object, not StateDeclaration ([9313880](https://github.com/ui-router/core/commit/9313880)) |
| 38 | +* **lazyLoad:** Wait for future state to be replaced before registering lazy children ([4bdce47](https://github.com/ui-router/core/commit/4bdce47)) |
| 39 | +* **noImplicitAny:** Fix noimplicitany compliance ([1a6cdfc](https://github.com/ui-router/core/commit/1a6cdfc)) |
| 40 | +* **pushStateLocation:** call listeners in url() ([#24](https://github.com/ui-router/core/issues/24)) ([7c90911](https://github.com/ui-router/core/commit/7c90911)), closes [#23](https://github.com/ui-router/core/issues/23) |
| 41 | +* **redirect:** Do not update URL after redirect with { location: false } ([652a760](https://github.com/ui-router/core/commit/652a760)) |
| 42 | +* **resolve:** Allow resolve's state context to be injected as `$state$` ([a06948b](https://github.com/ui-router/core/commit/a06948b)) |
| 43 | +* **tfs:** Rename $q.ts and $injector.ts files, removing leading dollar signs ([cb653ee](https://github.com/ui-router/core/commit/cb653ee)) |
| 44 | +* **trace:** Re-add transitionStart trace ([b019036](https://github.com/ui-router/core/commit/b019036)) |
| 45 | +* **transitionHook:** Do not process transition hooks after router has been disposed. ([666c6d7](https://github.com/ui-router/core/commit/666c6d7)) |
| 46 | +* **TransitionHook:** Transition hooks no longer expose the internal StateObject ([2b0e48b](https://github.com/ui-router/core/commit/2b0e48b)) |
| 47 | +* **typings:** Allow strictNullChecks for HookMatchCriteria ([d92d4d5](https://github.com/ui-router/core/commit/d92d4d5)) |
| 48 | +* **ui-sref:** Improve performance of generating hrefs ([c3967bd](https://github.com/ui-router/core/commit/c3967bd)) |
| 49 | +* **view:** Do not throw when uiView doesn't have a state context ([f76ee2a](https://github.com/ui-router/core/commit/f76ee2a)) |
| 50 | +* **view:** Update views in order of ui-view depth and also by state depth ([46dea2b](https://github.com/ui-router/core/commit/46dea2b)) |
| 51 | + |
| 52 | + |
| 53 | +### Features |
| 54 | + |
| 55 | +* **abort:** Add API to manually abort/cancel a transition ([39f8a53](https://github.com/ui-router/core/commit/39f8a53)) |
| 56 | +* **common:** Perf improvements in hot functions: ([4193244](https://github.com/ui-router/core/commit/4193244)) |
| 57 | +* **core:** Export all vanilla.* code from `ui-router-core` ([f3392d1](https://github.com/ui-router/core/commit/f3392d1)) |
| 58 | +* **core:** Switch to [@uirouter](https://github.com/uirouter)/core npm module ([e3f389f](https://github.com/ui-router/core/commit/e3f389f)) |
| 59 | +* **decorators:** Add state, resolve and resolve data decorators ([642df0b](https://github.com/ui-router/core/commit/642df0b)) |
| 60 | +* **defaultErrorHandler:** Do not invoke default error handler for ABORTED transitions ([b07a24b](https://github.com/ui-router/core/commit/b07a24b)) |
| 61 | +* **globals:** Removed `UIRouterGlobals` interface. Renamed `Globals` class to `UIRouterGlobals` ([8719334](https://github.com/ui-router/core/commit/8719334)) |
| 62 | +* **Globals:** implement Disposable and delete global transition data ([a794018](https://github.com/ui-router/core/commit/a794018)) |
| 63 | +* **onBefore:** Run onBefore hooks asynchronously. ([30b82aa](https://github.com/ui-router/core/commit/30b82aa)) |
| 64 | +* **onEnter/Exit/Retain:** Use onExit/onEnter/onRetain from 56955state(), not state.self ([bc1f554](https://github.com/ui-router/core/commit/bc1f554)) |
| 65 | +* **Rejection:** Add $id to ease debugging of transition rejections ([d456d54](https://github.com/ui-router/core/commit/d456d54)) |
| 66 | +* **State:** Support registration of ES6 state classes (as opposed to object literals) ([3a5d055](https://github.com/ui-router/core/commit/3a5d055)) |
| 67 | +* **State:** Switch Internal State Object to prototypally inherit from the State Declaration ([027c995](https://github.com/ui-router/core/commit/027c995)), closes [#34](https://github.com/ui-router/core/issues/34) |
| 68 | +* **StateObject:** Rename internal `State` object to `StateObject` ([feceaf9](https://github.com/ui-router/core/commit/feceaf9)) |
| 69 | +* **StateRegistry:** improve perf for: `.register()` and `StateMatcher.find()` misses ([fdb3ab9](https://github.com/ui-router/core/commit/fdb3ab9)) |
| 70 | +* **transition:** Ignore duplicate transitions (double clicks) ([bd1bd0b](https://github.com/ui-router/core/commit/bd1bd0b)) |
| 71 | +* **transition:** Improve supersede logic: Do not supersede if the new trans is aborted before onStart ([3141a8f](https://github.com/ui-router/core/commit/3141a8f)) |
| 72 | +* **transition:** Run hooks synchronously in current stack, when possible ([953e618](https://github.com/ui-router/core/commit/953e618)) |
| 73 | +* **Transition:** deprecate `Transition.is()` which was never implemented ([1edff4b](https://github.com/ui-router/core/commit/1edff4b)) |
| 74 | +* **Transition:** Normalize all transition errors to a Rejection. ([a7464bb](https://github.com/ui-router/core/commit/a7464bb)) |
| 75 | +* **UIRouter:** Add `trace` global to the `UIRouter` object ([48c5af6](https://github.com/ui-router/core/commit/48c5af6)) |
| 76 | +* **UrlService:** (`UrlRouter`) improve perf of registering Url Rules and sorting Url Rules ([64fbfff](https://github.com/ui-router/core/commit/64fbfff)) |
| 77 | +* **UrlService:** Add `rules.initial("/home")` to config initial state (like otherwise) ([bbe4209](https://github.com/ui-router/core/commit/bbe4209)) |
| 78 | +* **View:** Allow targeting views on own state using `viewname@.` (normalizeUIViewTarget) ([7078216](https://github.com/ui-router/core/commit/7078216)), closes [#25](https://github.com/ui-router/core/issues/25) |
| 79 | + |
| 80 | + |
| 81 | +### BREAKING CHANGES |
| 82 | + |
| 83 | +## **TransitionHook:** Transition hooks no longer expose the internal `State` object (now named `StateObject`) |
| 84 | + |
| 85 | +#### Before: |
| 86 | + |
| 87 | +```js |
| 88 | +import { State } from "ui-router-core"; |
| 89 | +const match = { to: (state: State) => state.data.auth }; |
| 90 | +transitionsvc.onEnter(match, (trans: Transition, state: State) => { |
| 91 | + // state is the internal State object |
| 92 | + if (state.includes["foo"]) { // internal ui-router API |
| 93 | + return false; |
| 94 | + } |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +#### Now: |
| 99 | + |
| 100 | +```js |
| 101 | +import { StateDeclaration } from "ui-router-core"; |
| 102 | +const match = { to: (state: StateDeclaration) => state.data.auth }; |
| 103 | +transitionsvc.onEnter(match, (trans: Transition, state: StateDeclaration) => { |
| 104 | + // state === the state object you registered |
| 105 | + // Access internal ui-router API using $$state() |
| 106 | + if (state.$$state().includes["foo"]) { |
| 107 | + return false; |
| 108 | + } |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +#### Motivation: |
| 113 | + |
| 114 | +The `State` object (now named `StateObject`) is an internal API and should not be exposed via any public APIs. |
| 115 | +If you depend on the internal APIs, you can still access the internal object by calling `state.$$state()`. |
| 116 | + |
| 117 | +#### BC Likelihood |
| 118 | + |
| 119 | +How likely is this BC to affect me? |
| 120 | + |
| 121 | +Medium: You will likely be affected you 1) have transition hooks, 2) are using typescript and/or 3) use the internal ui-router State API. |
| 122 | + |
| 123 | +#### BC Severity |
| 124 | + |
| 125 | +How severe is this BC? |
| 126 | + |
| 127 | +Low: Access to the internal api is still available using `$$state()`. |
| 128 | + |
| 129 | + |
| 130 | +## **StateObject:** Renamed internal API `State` object to `StateObject` |
| 131 | + |
| 132 | +#### Before: |
| 133 | + |
| 134 | +``` |
| 135 | +import {State} from "ui-router-core"; |
| 136 | +``` |
| 137 | + |
| 138 | +- #### Now: |
| 139 | + |
| 140 | +``` |
| 141 | +import {StateObject} from "ui-router-core"; |
| 142 | +``` |
| 143 | + |
| 144 | +#### Motivation: |
| 145 | + |
| 146 | +We'd like to use the `State` name/symbol as a public API. |
| 147 | +It will likely be an ES7/TS decorator for ES6/TS state definition classes, i.e: |
| 148 | + |
| 149 | +```js |
| 150 | +@State("foo") |
| 151 | +export class FooState implements StateDeclaration { |
| 152 | + url = "/foo"; |
| 153 | + component = FooComponent; |
| 154 | + |
| 155 | + @Resolve({ deps: [FooService] }) |
| 156 | + fooData(fooService) { |
| 157 | + return fooService.getFoos(); |
| 158 | + } |
| 159 | +} |
| 160 | +``` |
| 161 | + |
| 162 | +#### BC Likelihood |
| 163 | + |
| 164 | +How likely is this to affect me? |
| 165 | + |
| 166 | +Low: This only affects code that imports the internal API symbol `State`. |
| 167 | +You will likely be affected you 1) import that symbol, 2) are using typescript and 3) explicitly |
| 168 | +typed a variable such as `let internalStateObject = state.$$state();` |
| 169 | + |
| 170 | +#### BC Severity |
| 171 | + |
| 172 | +How severe is this change? |
| 173 | + |
| 174 | +Low: Find all places where `State` is imported and rename to `StateObject` |
| 175 | + |
| 176 | + |
| 177 | +## **Transition:** All Transition errors are now wrapped in a Rejection object. |
| 178 | + |
| 179 | +#### Before: |
| 180 | + |
| 181 | +Previously, if a transition hook returned a rejected promise: |
| 182 | +```js |
| 183 | +.onStart({}, () => Promise.reject('reject transition')); |
| 184 | +``` |
| 185 | + |
| 186 | +In `onError` or `transtion.promise.catch()`, the raw rejection was returned: |
| 187 | +```js |
| 188 | +.onError({}, (trans, err) => err === 'reject transition') |
| 189 | +``` |
| 190 | + |
| 191 | +#### Now: |
| 192 | + |
| 193 | +Now, the error is wrapped in a Rejection object. |
| 194 | + |
| 195 | +- The detail (thrown error or rejected value) is still available as `.detail`. |
| 196 | + |
| 197 | +```js |
| 198 | +.onError({}, (trans, err) => |
| 199 | + err instanceof Rejection && err.detail === 'reject transition') |
| 200 | +``` |
| 201 | + |
| 202 | +- The Rejection object indicates the `.type` of transition rejection (ABORTED, ERROR, SUPERSEDED and/or redirection). |
| 203 | +```js |
| 204 | +.onError({}, (trans, err) => { |
| 205 | + err.type === RejectType.ABORTED === 3 |
| 206 | +}); |
| 207 | +``` |
| 208 | + |
| 209 | +#### Motivation: |
| 210 | + |
| 211 | +Errors *thrown from* a hook and rejection values *returned from* a hook can now be processed in the same way. |
| 212 | + |
| 213 | +#### BC Likelihood |
| 214 | + |
| 215 | +How likely is this to affect me? |
| 216 | + |
| 217 | +Medium: apps which have onError handlers for rejected values |
| 218 | + |
| 219 | +#### BC Severity |
| 220 | + |
| 221 | +How severe is this change? |
| 222 | + |
| 223 | +Low: Find all error handlers (or .catch/.then chains) that do not understand Rejection. Add `err.detail` processing. |
| 224 | + |
| 225 | + |
| 226 | + |
| 227 | +## **onBefore:** `onBefore` hooks are now run asynchronously like all the other hooks. |
| 228 | + |
| 229 | +#### Old behavior |
| 230 | + |
| 231 | +Previously, the `onBefore` hooks were run in the same stackframe as `transitionTo`. |
| 232 | +If they threw an error, it could be caught using try/catch. |
| 233 | + |
| 234 | +```js |
| 235 | +transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 236 | +try { |
| 237 | + stateService.go('foo'); |
| 238 | +} catch (error) { |
| 239 | + // handle error |
| 240 | +} |
| 241 | +``` |
| 242 | + |
| 243 | +#### New behavior |
| 244 | + |
| 245 | +Now, `onBefore` hooks are processed asynchronously. |
| 246 | +To handle errors, use any of the async error handling paradigms: |
| 247 | + |
| 248 | +- Chain off the promise |
| 249 | + ```js |
| 250 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 251 | + stateService.go('foo').catch(error => { //handle error }); |
| 252 | + ``` |
| 253 | +- Define an error handler |
| 254 | + ```js |
| 255 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 256 | + transitionService.onError({ to: 'foo' }), () => { // handle error }); |
| 257 | + stateService.go('foo'); |
| 258 | + ``` |
| 259 | +- Use the global defaultErrorHandler |
| 260 | + ```js |
| 261 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 262 | + stateService.go('foo'); |
| 263 | + stateService.defaultErrorHandler(error => { // global error handler }); |
| 264 | + ``` |
| 265 | + |
| 266 | +#### Motivation |
| 267 | + |
| 268 | +Why introduce a BC? |
| 269 | + |
| 270 | +- No subtle behavior differences by hook type |
| 271 | +- Simpler code and mental model |
| 272 | +- Fewer edge cases to account for |
| 273 | + |
| 274 | +#### BC Liklihood |
| 275 | + |
| 276 | +How likely is this to affect my app? |
| 277 | + |
| 278 | +Very Low: Apps that registered onBefore hooks and depend on |
| 279 | +synchronous execution are affected. |
| 280 | + |
| 281 | +#### BC Severity |
| 282 | + |
| 283 | +How severe is this BC? |
| 284 | + |
| 285 | +Low: Switch to asynchronous handling, such as chaining off the |
| 286 | +transition promise |
| 287 | + |
| 288 | + |
| 289 | +## **defaultErrorHandler:** ABORTED transitions do not invoke the `defaultErrorHandler` |
| 290 | + |
| 291 | +Returning `false` from a transition hook will abort the transition. |
| 292 | + |
| 293 | +#### Old behavior |
| 294 | + |
| 295 | +Previously, this case was considered an error and was logged by |
| 296 | +`defaultErrorHandler`. |
| 297 | +After your feedback, we agree that this is not typically an error. |
| 298 | + |
| 299 | +#### New behavior |
| 300 | + |
| 301 | +Now, aborted transitions do not trigger the `defaultErrorHandler` |
| 302 | + |
| 303 | +#### Motivation: |
| 304 | + |
| 305 | +> Why introduce a BC? |
| 306 | + |
| 307 | +Most users do not consider ABORT to be an error. The default error |
| 308 | +handler should match this assumption. |
| 309 | + |
| 310 | +#### BC liklihood |
| 311 | + |
| 312 | +> How likely am I to be affected? |
| 313 | + |
| 314 | +Low: Most users do not consider ABORT to be an error. For most users |
| 315 | +this will not be a BC. |
| 316 | + |
| 317 | +#### BC severity |
| 318 | + |
| 319 | +> How severe is this BC? |
| 320 | + |
| 321 | +Low: Users who want to handle all transition rejections can |
| 322 | +register a `.onError` handler and filter/process accordingly. |
| 323 | + |
| 324 | + |
| 325 | +## **globals:** This change will likely only affect a small subset of typescript users and probably only those using `ui-router-ng2`. |
| 326 | + |
| 327 | +If you're injecting the `Globals` class somewhere, e.g.: |
| 328 | +``` |
| 329 | +@Injectable() |
| 330 | +class MyService { |
| 331 | + _globals: UIRouterGlobals; |
| 332 | + constructor(globals: Globals) { |
| 333 | + this._globals = <UIRouterGlobals> globals; |
| 334 | + } |
| 335 | +} |
| 336 | +``` |
| 337 | +you should now inject `UIRouterGlobals`, e.g.: |
| 338 | +``` |
| 339 | +@Injectable() |
| 340 | +class MyService { |
| 341 | + constructor(public globals: UIRouterGlobals) { } |
| 342 | +} |
| 343 | +``` |
| 344 | + |
| 345 | +Likewise, if you were casting the `UIRouter.globals` object as a `UIRouterGlobals`, it is no longer necessary: |
| 346 | + |
| 347 | +```js |
| 348 | +function myHook(trans: Transition) { |
| 349 | + let globals: UIRouterGlobals = trans.router.globals; // cast is no longer necessary |
| 350 | +} |
| 351 | +``` |
| 352 | + |
| 353 | +Closes https://github.com/ui-router/core/issues/31 |
| 354 | + |
| 355 | + |
| 356 | + |
1 | 357 | <a name="1.0.0-rc.1"></a>
|
2 | 358 | # [1.0.0-rc.1](https://github.com/angular-ui/ui-router/compare/1.0.0-beta.3...v1.0.0-rc.1) (2017-01-09)
|
3 | 359 |
|
|
0 commit comments