From b29da8cb1b9a478254de5c861f9187cfd082a8cc Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Thu, 1 Dec 2016 07:40:40 +0200 Subject: [PATCH 01/12] Update CHANGELOG.md --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdc18639..0221a828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 1.6.0 (2016-11-30) +### Bug fixes +* Update webpack to the latest beta ([#143](https://github.com/Rebilly/ReDoc/issues/143)) +* Fix read-only fields appear in request samples ([#142](https://github.com/Rebilly/ReDoc/issues/142)) +* A few more minor UI improvemnts + +### Features/Improvements +* Major performance optimization with new option `lazy-rendering` + +To enable use `` tag parameter: ``. +In this mode ReDoc shows initial screen ASAP and then renders the rest operations asynchronously while showing progress bar on the top. Check out [the demo](//rebilly.github.io/ReDoc) for the example. +* Enable cors-proxy for demo +* README: Add button link to yeoman-generator + # 1.5.2 (2016-11-28) ### Bug fixes * Fix crashing on array without items ([#104](https://github.com/Rebilly/ReDoc/issues/104)) From 0e8402aa0a6faf7f924e9ba5214f863485e6abed Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 08:00:14 +0200 Subject: [PATCH 02/12] Update README.md --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 79247b7b..90607e9c 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,24 @@ ## Features - Extremely easy deployment - It’s free and open-source project under MIT license -- The widest OpenAPI features support (yes, it supports even discriminator) -- Neat documentation for nested objects +- The widest OpenAPI features support (yes, it supports even `discriminator`) +- Neat **interactive** documentation for nested objects + + + - Code samples support (via vendor extension) - Responsive three-panel design with menu/scrolling synchronization - Integrate API introduction into side menu - ReDoc takes advantage of markdown headings from OpenAPI description field. It pulls them into side menu and also supports deep linking. ## Roadmap - - [ ] docs pre-rendering (performance and SEO) - - [ ] ability to simple customization + - [x] performance optimizations + - [ ] better navigation (menu improvements + search) + - [ ] ability to simple branding/styling - [ ] built-in API Console + - [ ] docs pre-rendering (performance and SEO) ## Releases -We host latest and all the previous ReDoc releases on GitHub Pages-based **CDN**: +We host the latest and all the previous ReDoc releases on GitHub Pages-based **CDN**: - particular release, e.g. `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js - `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js - `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js **[not for production]** From 73ec40072dc77127c5c8f991e3fa8effe561c2c8 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 11:25:54 +0200 Subject: [PATCH 03/12] Update deps --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index acae3b91..deba56ff 100644 --- a/package.json +++ b/package.json @@ -45,13 +45,13 @@ "author": "Roman Hotsiy", "license": "MIT", "devDependencies": { - "@angular/common": "~2.1.2", - "@angular/compiler": "~2.1.2", - "@angular/compiler-cli": "~2.1.2", - "@angular/core": "~2.1.2", - "@angular/platform-browser": "~2.1.2", - "@angular/platform-browser-dynamic": "~2.1.2", - "@angular/platform-server": "~2.1.2", + "@angular/common": "^2.2.4", + "@angular/compiler": "^2.2.4", + "@angular/compiler-cli": "^2.2.4", + "@angular/core": "^2.2.4", + "@angular/platform-browser": "^2.2.4", + "@angular/platform-browser-dynamic": "^2.2.4", + "@angular/platform-server": "^2.2.4", "@types/core-js": "^0.9.31", "@types/jasmine": "^2.2.32", "@types/requirejs": "^2.1.26", @@ -60,10 +60,10 @@ "awesome-typescript-loader": "2.2.4", "branch-release": "^1.0.3", "chalk": "^1.1.3", - "codelyzer": "^1.0.0-beta.3", + "codelyzer": "^2.0.0-beta.1", "core-js": "^2.4.1", "coveralls": "^2.11.9", - "css-loader": "^0.25.0", + "css-loader": "^0.26.0", "deploy-to-gh-pages": "^1.1.2", "http-server": "^0.9.0", "istanbul-instrumenter-loader": "^0.2.0", @@ -94,7 +94,7 @@ "string-replace-webpack-plugin": "0.0.4", "style-loader": "^0.13.1", "ts-helpers": "^1.1.1", - "tslint": "^3.15.1", + "tslint": "^4.0.2", "typescript": "^2.0.3", "webpack": "^2.1.0-beta.27", "webpack-dev-server": "^2.1.0-beta.12", @@ -113,12 +113,12 @@ "stream-http": "^2.3.1" }, "peerDependencies": { - "@angular/common": "~2.1.2", - "@angular/compiler": "~2.1.2", - "@angular/core": "~2.1.2", - "@angular/platform-browser": "~2.1.2", - "@angular/platform-browser-dynamic": "~2.1.2", - "@angular/platform-server": "~2.1.2", + "@angular/common": "^2.2.4", + "@angular/compiler": "^2.2.4", + "@angular/core": "^2.2.4", + "@angular/platform-browser": "^2.2.4", + "@angular/platform-browser-dynamic": "^2.2.4", + "@angular/platform-server": "^2.2.4", "core-js": "^2.4.1", "rxjs": "5.0.0-beta.12", "zone.js": "^0.6.25" From 5c6d57ab2cece7ed3fa65f7ef26c944bc33ff57e Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 11:26:47 +0200 Subject: [PATCH 04/12] Fix content projector after angular2 update --- lib/services/content-projector.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/services/content-projector.service.ts b/lib/services/content-projector.service.ts index a02b58dc..0f87001b 100644 --- a/lib/services/content-projector.service.ts +++ b/lib/services/content-projector.service.ts @@ -29,13 +29,13 @@ export class ContentProjector { let parentCompRef = parentView.createComponent(componentFactory, null, contextInjector, [projectedNodes]); // using private property to get AppElement instance - let appElement = (parentView)._element; - appElement.nestedViews = appElement.nestedViews || []; + let viewContainer = (parentView)._element; + viewContainer.nestedViews = viewContainer.nestedViews || []; for (let i=0; i < componentRefs.length; i++) { let compRef = componentRefs[i]; - appElement.nestedViews.push((compRef.hostView).internalView); - // attach appElement to parentView change detector - (compRef.hostView).internalView.addToContentChildren(appElement); + // attach view to viewContainer change detector + viewContainer.nestedViews.push((compRef.hostView).internalView); + (compRef.hostView).internalView.viewContainer = viewContainer; } return parentCompRef; } From 14074856b6acfbb16308cc80043094ea032e0b61 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 11:35:04 +0200 Subject: [PATCH 05/12] Enable more strict checks for linter/tsc --- tsconfig.json | 2 ++ tslint.json | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 950a07a1..38caa5da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,8 @@ "outDir": ".tmp", "pretty": true, "moduleResolution": "node", + "noUnusedParameters": true, + "noUnusedLocals": true, "types": [ "core-js", "jasmine", diff --git a/tslint.json b/tslint.json index 19d7a0b3..d50cd5fc 100644 --- a/tslint.json +++ b/tslint.json @@ -13,14 +13,12 @@ ], "no-arg": true, "no-construct": true, - "no-duplicate-key": true, + "no-duplicate-variable": true, "no-empty": true, "no-eval": true, "no-trailing-whitespace": true, "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, "no-use-before-declare": true, "one-line": [true, "check-open-brace", @@ -36,10 +34,8 @@ ], "variable-name": false, - "directive-selector-type": [true, "attribute"], - "component-selector-type": [true, "element"], - "component-selector-name": [true, "kebab-case"], - "directive-selector-name": [true, "camelCase"], + "directive-selector": [true, "attribute", "", "camelCase"], + "component-selector": [true, "element", "", "kebab-case"], "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, @@ -53,6 +49,10 @@ "no-access-missing-member": true, "invoke-injectable": true, "no-forward-ref": true, - "no-attribute-parameter-decorator": true + "no-attribute-parameter-decorator": true, + "templates-use-public": true, + "no-access-missing-member": true, + "invoke-injectable": true, + "no-unused-css": true } } From 1855d2bd38e771e589efa0d9d86456ccc9cc8399 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 11:59:29 +0200 Subject: [PATCH 06/12] Fix linter/tsc errors --- lib/components/ApiInfo/api-info.ts | 2 +- lib/components/JsonSchema/json-schema.ts | 2 +- lib/components/LoadingBar/loading-bar.ts | 11 +++-------- lib/components/Method/method.ts | 7 +++---- lib/components/MethodsList/methods-list.ts | 6 +----- lib/components/Redoc/redoc.ts | 3 --- lib/components/ResponsesList/responses-list.ts | 2 +- .../SecurityDefinitions/security-definitions.ts | 2 +- lib/components/SideMenu/side-menu.ts | 4 ++-- lib/index.ts | 1 - lib/redoc.module.ts | 2 +- lib/services/app-state.service.ts | 7 ++----- lib/services/component-parser.service.ts | 2 +- lib/services/options.service.ts | 2 +- lib/services/schema-helper.service.ts | 6 +++--- lib/services/schema-normalizer.service.ts | 2 +- lib/services/scroll.service.ts | 2 +- .../DynamicNg2Viewer/dynamic-ng2-viewer.component.ts | 2 -- lib/shared/components/LazyFor/lazy-for.ts | 12 +++++------- lib/utils/md-renderer.ts | 5 ----- 20 files changed, 28 insertions(+), 54 deletions(-) diff --git a/lib/components/ApiInfo/api-info.ts b/lib/components/ApiInfo/api-info.ts index 946b6ff2..fcb8163c 100644 --- a/lib/components/ApiInfo/api-info.ts +++ b/lib/components/ApiInfo/api-info.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { SpecManager, BaseComponent } from '../base'; -import { OptionsService, MenuService } from '../../services/index'; +import { OptionsService } from '../../services/index'; @Component({ selector: 'api-info', diff --git a/lib/components/JsonSchema/json-schema.ts b/lib/components/JsonSchema/json-schema.ts index 317a7860..19ec9449 100644 --- a/lib/components/JsonSchema/json-schema.ts +++ b/lib/components/JsonSchema/json-schema.ts @@ -120,7 +120,7 @@ export class JsonSchema extends BaseComponent implements OnInit { } } - trackByName(index: number, item: any): number { + trackByName(_: number, item: any): number { return item.name + (item._pointer || ''); } diff --git a/lib/components/LoadingBar/loading-bar.ts b/lib/components/LoadingBar/loading-bar.ts index 8666deb7..55702822 100644 --- a/lib/components/LoadingBar/loading-bar.ts +++ b/lib/components/LoadingBar/loading-bar.ts @@ -1,9 +1,5 @@ 'use strict'; -import { Input, HostBinding, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } from '@angular/core'; -import JsonPointer from '../../utils/JsonPointer'; -import { BaseComponent, SpecManager } from '../base'; -import { SchemaHelper } from '../../services/schema-helper.service'; -import { OptionsService, AppStateService } from '../../services/'; +import { Input, HostBinding, Component, OnChanges } from '@angular/core'; @Component({ selector: 'loading-bar', @@ -32,10 +28,9 @@ import { OptionsService, AppStateService } from '../../services/'; background-color: #5f7fc3; transition: right 0.2s linear; } - `], - //changeDetection: ChangeDetectionStrategy.OnPush + `] }) -export class LoadingBar { +export class LoadingBar implements OnChanges { @Input() progress:number = 0; @HostBinding('style.display') display = 'block'; diff --git a/lib/components/Method/method.ts b/lib/components/Method/method.ts index b846684f..82332307 100644 --- a/lib/components/Method/method.ts +++ b/lib/components/Method/method.ts @@ -1,9 +1,9 @@ 'use strict'; -import { Input, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } from '@angular/core'; +import { Input, Component, OnInit, ChangeDetectionStrategy, ElementRef } from '@angular/core'; import JsonPointer from '../../utils/JsonPointer'; import { BaseComponent, SpecManager } from '../base'; import { SchemaHelper } from '../../services/schema-helper.service'; -import { OptionsService, AppStateService } from '../../services/'; +import { OptionsService } from '../../services/'; @Component({ selector: 'method', @@ -20,8 +20,7 @@ export class Method extends BaseComponent implements OnInit { method:any; - constructor(specMgr:SpecManager, private optionsService: OptionsService, private chDetector: ChangeDetectorRef, - private appState: AppStateService, private el: ElementRef) { + constructor(specMgr:SpecManager, private optionsService: OptionsService, private el: ElementRef) { super(specMgr); } diff --git a/lib/components/MethodsList/methods-list.ts b/lib/components/MethodsList/methods-list.ts index 6be3e494..ec130328 100644 --- a/lib/components/MethodsList/methods-list.ts +++ b/lib/components/MethodsList/methods-list.ts @@ -30,11 +30,7 @@ export class MethodsList extends BaseComponent implements OnInit { }); } - trackByPointer(idx, el) { - return el.pointer; - } - - trackByTagName(idx, el) { + trackByTagName(_, el) { return el.name; } diff --git a/lib/components/Redoc/redoc.ts b/lib/components/Redoc/redoc.ts index 96698994..a2b23b6e 100644 --- a/lib/components/Redoc/redoc.ts +++ b/lib/components/Redoc/redoc.ts @@ -1,12 +1,10 @@ 'use strict'; import { ElementRef, - ComponentRef, ChangeDetectorRef, Input, Component, OnInit, - ChangeDetectionStrategy, HostBinding } from '@angular/core'; @@ -18,7 +16,6 @@ import * as detectScollParent from 'scrollparent'; import { SpecManager } from '../../utils/spec-manager'; import { OptionsService, Hash, AppStateService, SchemaHelper } from '../../services/index'; import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for'; -import { CustomErrorHandler } from '../../utils/'; @Component({ selector: 'redoc', diff --git a/lib/components/ResponsesList/responses-list.ts b/lib/components/ResponsesList/responses-list.ts index 84bd4740..08b8b303 100644 --- a/lib/components/ResponsesList/responses-list.ts +++ b/lib/components/ResponsesList/responses-list.ts @@ -63,7 +63,7 @@ export class ResponsesList extends BaseComponent implements OnInit { this.responses = responses; } - trackByCode(idx, el) { + trackByCode(_, el) { return el.code; } diff --git a/lib/components/SecurityDefinitions/security-definitions.ts b/lib/components/SecurityDefinitions/security-definitions.ts index 0515540f..0faa2562 100644 --- a/lib/components/SecurityDefinitions/security-definitions.ts +++ b/lib/components/SecurityDefinitions/security-definitions.ts @@ -1,5 +1,5 @@ 'use strict'; -import { Component, ChangeDetectionStrategy, OnInit, HostListener } from '@angular/core'; +import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { SpecManager, BaseComponent } from '../base'; import { ComponentParser } from '../../services/component-parser.service'; diff --git a/lib/components/SideMenu/side-menu.ts b/lib/components/SideMenu/side-menu.ts index e9180bd1..7a46dcf9 100644 --- a/lib/components/SideMenu/side-menu.ts +++ b/lib/components/SideMenu/side-menu.ts @@ -5,7 +5,7 @@ import { Component, ElementRef, ChangeDetectorRef, OnInit } from '@angular/core' //import { global } from '@angular/core/src/facade/lang'; import { trigger, state, animate, transition, style } from '@angular/core'; import { BaseComponent, SpecManager } from '../base'; -import { ScrollService, Hash, MenuService, OptionsService } from '../../services/index'; +import { ScrollService, MenuService, OptionsService } from '../../services/index'; import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter'; import { MenuCategory } from '../../services/schema-helper.service'; @@ -41,7 +41,7 @@ export class SideMenu extends BaseComponent implements OnInit { private firstChange = true; constructor(specMgr:SpecManager, elementRef:ElementRef, - private scrollService:ScrollService, private menuService:MenuService, private hash:Hash, + private scrollService:ScrollService, private menuService:MenuService, optionsService:OptionsService, private detectorRef:ChangeDetectorRef) { super(specMgr); this.$element = elementRef.nativeElement; diff --git a/lib/index.ts b/lib/index.ts index 32a05be6..bb2fdc3a 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -3,7 +3,6 @@ import './components/Redoc/redoc-initial-styles.css'; import { enableProdMode } from '@angular/core'; import { Redoc } from './components/index'; -import { SpecManager } from './utils/spec-manager'; import { BrowserDomAdapter as DOM } from './utils/browser-adapter'; import { disableDebugTools } from '@angular/platform-browser'; diff --git a/lib/redoc.module.ts b/lib/redoc.module.ts index 7244cfb6..a8224fb3 100644 --- a/lib/redoc.module.ts +++ b/lib/redoc.module.ts @@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common'; import { Redoc, SecurityDefinitions, Method, REDOC_DIRECTIVES } from './components/index'; import { REDOC_COMMON_DIRECTIVES, DynamicNg2Wrapper } from './shared/components/index'; -import { REDOC_PIPES, KeysPipe } from './utils/pipes'; +import { REDOC_PIPES } from './utils/pipes'; import { CustomErrorHandler } from './utils/' import { LazyTasksService } from './shared/components/LazyFor/lazy-for'; diff --git a/lib/services/app-state.service.ts b/lib/services/app-state.service.ts index 4fc434a2..8bd8f143 100644 --- a/lib/services/app-state.service.ts +++ b/lib/services/app-state.service.ts @@ -1,15 +1,15 @@ 'use strict'; -import { Injectable, NgZone } from '@angular/core'; +import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Injector } from '@angular/core'; @Injectable() export class AppStateService { samplesLanguage = new Subject(); error = new BehaviorSubject(null); loading = new Subject(); + initialized = new BehaviorSubject(false); startLoading() { this.loading.next(true); @@ -18,7 +18,4 @@ export class AppStateService { stopLoading() { this.loading.next(false); } - - constructor(private injector: Injector, private zone: NgZone) { - } } diff --git a/lib/services/component-parser.service.ts b/lib/services/component-parser.service.ts index 2a3d1f82..8d26fdf4 100644 --- a/lib/services/component-parser.service.ts +++ b/lib/services/component-parser.service.ts @@ -64,7 +64,7 @@ export class ComponentParser { } createComponentByHtml(htmlTag: string, injector:Injector):ComponentRef| null { - let {componentType, options} = this._parseHtml(htmlTag); + let { componentType } = this._parseHtml(htmlTag); if (!componentType) return null; let factory = this.resolver.resolveComponentFactory(componentType); diff --git a/lib/services/options.service.ts b/lib/services/options.service.ts index 260ce4a6..e8e41663 100644 --- a/lib/services/options.service.ts +++ b/lib/services/options.service.ts @@ -52,7 +52,7 @@ export class OptionsService { //camelCasify .map(k => ({ attrName: k, - name: k.replace(/-(.)/g, (m, $1) => $1.toUpperCase()) + name: k.replace(/-(.)/g, (_, $1) => $1.toUpperCase()) }) ) .filter(option => OPTION_NAMES.has(option.name)) diff --git a/lib/services/schema-helper.service.ts b/lib/services/schema-helper.service.ts index e990ff52..c01e1fd6 100644 --- a/lib/services/schema-helper.service.ts +++ b/lib/services/schema-helper.service.ts @@ -64,7 +64,7 @@ const injectors = { }, discriminator: { check: (propertySchema) => propertySchema.discriminator || propertySchema['x-extendedDiscriminator'], - inject: (injectTo, propertySchema = injectTo, pointer) => { + inject: (injectTo, propertySchema = injectTo) => { injectTo.discriminator = propertySchema.discriminator; injectTo['x-extendedDiscriminator'] = propertySchema['x-extendedDiscriminator']; } @@ -182,7 +182,7 @@ const injectors = { }, file: { check: propertySchema => (propertySchema.type === 'file'), - inject: (injectTo, propertySchema = injectTo, propPointer, hostPointer) => { + inject: (injectTo, propertySchema = injectTo, _, hostPointer) => { injectTo.isFile = true; let parentPtr; if (propertySchema.in === 'formData') { @@ -230,7 +230,7 @@ export class SchemaHelper { schema.required.forEach(prop => requiredMap[prop] = true); } - let props = schema.properties && Object.keys(schema.properties).map((propName, idx) => { + let props = schema.properties && Object.keys(schema.properties).map(propName => { let propertySchema = Object.assign({}, schema.properties[propName]); let propPointer = propertySchema._pointer || JsonPointer.join(pointer, ['properties', propName]); diff --git a/lib/services/schema-normalizer.service.ts b/lib/services/schema-normalizer.service.ts index 0cec0de6..ddec2bc3 100644 --- a/lib/services/schema-normalizer.service.ts +++ b/lib/services/schema-normalizer.service.ts @@ -20,7 +20,7 @@ interface Schema { @Injectable() export class SchemaNormalizer { _dereferencer:SchemaDereferencer; - constructor(private _schema:any) { + constructor(_schema:any) { this._dereferencer = new SchemaDereferencer(_schema, this); } normalize(schema, ptr, opts:any ={}) { diff --git a/lib/services/scroll.service.ts b/lib/services/scroll.service.ts index 1cf104b7..94cbdd06 100644 --- a/lib/services/scroll.service.ts +++ b/lib/services/scroll.service.ts @@ -19,7 +19,7 @@ export class ScrollService { private _cancel:any; private _savedPosition:number; private _stickElement: HTMLElement; - constructor(private optionsService:OptionsService) { + constructor(optionsService:OptionsService) { this.scrollYOffset = () => optionsService.options.scrollYOffset(); this.$scrollParent = optionsService.options.$scrollParent || window; this.scroll = new EventEmitter(); diff --git a/lib/shared/components/DynamicNg2Viewer/dynamic-ng2-viewer.component.ts b/lib/shared/components/DynamicNg2Viewer/dynamic-ng2-viewer.component.ts index 56dbf968..a8cc1147 100644 --- a/lib/shared/components/DynamicNg2Viewer/dynamic-ng2-viewer.component.ts +++ b/lib/shared/components/DynamicNg2Viewer/dynamic-ng2-viewer.component.ts @@ -2,8 +2,6 @@ import { Component, - EventEmitter, - Output, Input, OnInit, ViewContainerRef, diff --git a/lib/shared/components/LazyFor/lazy-for.ts b/lib/shared/components/LazyFor/lazy-for.ts index d0edf9a3..6beb8353 100644 --- a/lib/shared/components/LazyFor/lazy-for.ts +++ b/lib/shared/components/LazyFor/lazy-for.ts @@ -6,8 +6,7 @@ import { TemplateRef, ChangeDetectorRef, ViewContainerRef, - Injectable, - NgZone + Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; @@ -36,7 +35,7 @@ export class LazyTasksService { public loadProgress = new BehaviorSubject(0); public allSync = false; - constructor(public optionsService: OptionsService, private zone: NgZone) { + constructor(public optionsService: OptionsService) { } get empty() { @@ -117,8 +116,8 @@ export class LazyTasksService { @Injectable() export class LazyTasksServiceSync extends LazyTasksService { - constructor(optionsService: OptionsService, zone: NgZone) { - super(optionsService, zone); + constructor(optionsService: OptionsService) { + super(optionsService); this.allSync = true; } } @@ -132,7 +131,6 @@ export class LazyFor { prevIdx = null; - private _viewRef; constructor( public _template: TemplateRef, public cdr: ChangeDetectorRef, @@ -152,7 +150,7 @@ export class LazyFor { if (sync) { return Promise.resolve(); } - return new Promise((resolve, reject) => { + return new Promise(resolve => { requestAnimationFrame(() => { this.scroll.saveScroll(); diff --git a/lib/utils/md-renderer.ts b/lib/utils/md-renderer.ts index 114a2d71..06b5539e 100644 --- a/lib/utils/md-renderer.ts +++ b/lib/utils/md-renderer.ts @@ -19,11 +19,6 @@ const md = new Remarkable({ } }); -interface HeadersHandler { - open: Function; - close: Function; -} - @Injectable() export class MdRenderer { public firstLevelHeadings: string[] = []; From cc4688fd5d91252c8bed3ba866571a0ab408f181 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 11:48:50 +0200 Subject: [PATCH 07/12] Don't show error screen for runtimes after render finished --- lib/components/Redoc/redoc.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/components/Redoc/redoc.ts b/lib/components/Redoc/redoc.ts index a2b23b6e..8efcd4d7 100644 --- a/lib/components/Redoc/redoc.ts +++ b/lib/components/Redoc/redoc.ts @@ -109,16 +109,12 @@ export class Redoc extends BaseComponent implements OnInit { this.appState.error.subscribe(_err => { if (!_err) return; - if (this.specLoading) { - this.specLoaded = true; - this.hideLoadingAnimation(); - } + this.appState.stopLoading(); + + if (this.loadingProgress === 100) return; this.error = _err; this.changeDetector.markForCheck(); - setTimeout(() => { - this.changeDetector.detectChanges() - }); - }) + }); if (this.specUrl) { this.options.specUrl = this.specUrl; From f8df377d567a366997a0d50a4e59e0d7434ded3b Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 12:00:33 +0200 Subject: [PATCH 08/12] Fix ng animation crash after angular upgrade --- lib/components/SideMenu/side-menu.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/SideMenu/side-menu.html b/lib/components/SideMenu/side-menu.html index 9124c6f4..3328bd3b 100644 --- a/lib/components/SideMenu/side-menu.html +++ b/lib/components/SideMenu/side-menu.html @@ -11,7 +11,7 @@ -