From 6aa1bbc6c630ae5d8732a5dc8b01af01ef6cee21 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 1 May 2016 16:17:16 +0300 Subject: [PATCH 01/14] fix prepare_deploy fail --- build/prepare_deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/prepare_deploy.sh b/build/prepare_deploy.sh index f180a36e..71a8562b 100755 --- a/build/prepare_deploy.sh +++ b/build/prepare_deploy.sh @@ -8,7 +8,7 @@ git reset --hard git fetch origin gh-pages:gh-pages git checkout gh-pages cp -R ../releases/* . -git checkout master +git checkout @{-1} cd - # build From a272dacc956f077846b6b93a4f8a7481e2d30f2d Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Thu, 5 May 2016 11:05:02 +0300 Subject: [PATCH 02/14] Update angular to the rc --- lib/common/components/DropDown/dropdown.js | 4 +- .../StickySidebar/sticky-sidebar.js | 4 +- .../StickySidebar/sticky-sidebar.spec.js | 6 +- lib/common/components/Tabs/tabs.js | 4 +- lib/common/components/Tabs/tabs.spec.js | 4 +- lib/common/components/Zippy/zippy.js | 4 +- lib/common/components/Zippy/zippy.spec.js | 4 +- lib/components/ApiInfo/api-info.spec.js | 4 +- lib/components/ApiLogo/api-logo.spec.js | 4 +- lib/components/JsonSchema/json-schema-lazy.js | 12 ++-- .../JsonSchema/json-schema-lazy.spec.js | 8 +-- lib/components/JsonSchema/json-schema.js | 2 +- lib/components/JsonSchema/json-schema.spec.js | 4 +- lib/components/Method/method.spec.js | 6 +- .../MethodsList/methods-list.spec.js | 6 +- lib/components/Redoc/redoc.js | 7 ++- lib/components/Redoc/redoc.spec.js | 6 +- .../RequestSamples/request-samples.js | 2 +- lib/components/SchemaSample/schema-sample.js | 2 +- lib/components/SideMenu/side-menu.js | 32 +++++------ lib/components/SideMenu/side-menu.spec.js | 6 +- lib/components/base.js | 4 +- lib/events.js | 2 +- lib/options.js | 6 +- lib/utils/JsonFormatterPipe.js | 4 +- lib/utils/pipes.js | 6 +- package.json | 15 +++-- system.config.js | 55 ++++++++++++++----- 28 files changed, 127 insertions(+), 96 deletions(-) diff --git a/lib/common/components/DropDown/dropdown.js b/lib/common/components/DropDown/dropdown.js index 7ce695f4..1375b643 100644 --- a/lib/common/components/DropDown/dropdown.js +++ b/lib/common/components/DropDown/dropdown.js @@ -1,7 +1,7 @@ 'use strict'; -import {Component, EventEmitter, ElementRef} from 'angular2/core'; -import {CORE_DIRECTIVES} from 'angular2/common'; +import {Component, EventEmitter, ElementRef} from '@angular/core'; +import {CORE_DIRECTIVES} from '@angular/common'; import DropKick from 'Robdel12/DropKick'; import 'Robdel12/DropKick/build/css/dropkick.css!css'; diff --git a/lib/common/components/StickySidebar/sticky-sidebar.js b/lib/common/components/StickySidebar/sticky-sidebar.js index 701204d1..65919173 100644 --- a/lib/common/components/StickySidebar/sticky-sidebar.js +++ b/lib/common/components/StickySidebar/sticky-sidebar.js @@ -1,7 +1,7 @@ 'use strict'; -import {Directive, ElementRef} from 'angular2/core'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {Directive, ElementRef} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; @Directive({ selector: '[sticky-sidebar]', diff --git a/lib/common/components/StickySidebar/sticky-sidebar.spec.js b/lib/common/components/StickySidebar/sticky-sidebar.spec.js index 58084d42..50cf4a36 100644 --- a/lib/common/components/StickySidebar/sticky-sidebar.spec.js +++ b/lib/common/components/StickySidebar/sticky-sidebar.spec.js @@ -1,8 +1,8 @@ 'use strict'; import { getChildDebugElementByType } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {Component, provide} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { TestComponentBuilder, @@ -10,7 +10,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import StickySidebar from 'lib/common/components/StickySidebar/sticky-sidebar'; diff --git a/lib/common/components/Tabs/tabs.js b/lib/common/components/Tabs/tabs.js index d8b23da1..e620f926 100644 --- a/lib/common/components/Tabs/tabs.js +++ b/lib/common/components/Tabs/tabs.js @@ -1,7 +1,7 @@ 'use strict'; -import {Component, EventEmitter} from 'angular2/core'; -import {CORE_DIRECTIVES} from 'angular2/common'; +import {Component, EventEmitter} from '@angular/core'; +import {CORE_DIRECTIVES} from '@angular/common'; @Component({ selector: 'tabs', diff --git a/lib/common/components/Tabs/tabs.spec.js b/lib/common/components/Tabs/tabs.spec.js index dd8896f9..65f080c2 100644 --- a/lib/common/components/Tabs/tabs.spec.js +++ b/lib/common/components/Tabs/tabs.spec.js @@ -1,14 +1,14 @@ 'use strict'; import { getChildDebugElement, getChildDebugElementAll } from 'tests/helpers'; -import {Component} from 'angular2/core'; +import {Component} from '@angular/core'; import { TestComponentBuilder, inject, beforeEach, it -} from 'angular2/testing'; +} from '@angular/testing'; import {Tabs, Tab} from 'lib/common/components/Tabs/tabs'; diff --git a/lib/common/components/Zippy/zippy.js b/lib/common/components/Zippy/zippy.js index dda98d29..f6cd5519 100644 --- a/lib/common/components/Zippy/zippy.js +++ b/lib/common/components/Zippy/zippy.js @@ -1,7 +1,7 @@ 'use strict'; -import {Component, EventEmitter} from 'angular2/core'; -import {CORE_DIRECTIVES} from 'angular2/common'; +import {Component, EventEmitter} from '@angular/core'; +import {CORE_DIRECTIVES} from '@angular/common'; @Component({ selector: 'zippy', diff --git a/lib/common/components/Zippy/zippy.spec.js b/lib/common/components/Zippy/zippy.spec.js index 55c3a68f..e277eb68 100644 --- a/lib/common/components/Zippy/zippy.spec.js +++ b/lib/common/components/Zippy/zippy.spec.js @@ -1,14 +1,14 @@ 'use strict'; import { getChildDebugElement, mouseclick } from 'tests/helpers'; -import {Component} from 'angular2/core'; +import {Component} from '@angular/core'; import { TestComponentBuilder, inject, beforeEach, it -} from 'angular2/testing'; +} from '@angular/testing'; import Zippy from 'lib/common/components/Zippy/zippy'; diff --git a/lib/components/ApiInfo/api-info.spec.js b/lib/components/ApiInfo/api-info.spec.js index 87bcbc0e..6909a088 100644 --- a/lib/components/ApiInfo/api-info.spec.js +++ b/lib/components/ApiInfo/api-info.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; +import {Component, provide} from '@angular/core'; import { TestComponentBuilder, @@ -10,7 +10,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import ApiInfo from 'lib/components/ApiInfo/api-info'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/ApiLogo/api-logo.spec.js b/lib/components/ApiLogo/api-logo.spec.js index 946f36c8..dfb3a4c6 100644 --- a/lib/components/ApiLogo/api-logo.spec.js +++ b/lib/components/ApiLogo/api-logo.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; +import {Component, provide} from '@angular/core'; import { TestComponentBuilder, @@ -10,7 +10,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import ApiLogo from 'lib/components/ApiLogo/api-logo'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/JsonSchema/json-schema-lazy.js b/lib/components/JsonSchema/json-schema-lazy.js index 13457319..dd5a4b46 100644 --- a/lib/components/JsonSchema/json-schema-lazy.js +++ b/lib/components/JsonSchema/json-schema-lazy.js @@ -1,8 +1,8 @@ 'use strict'; -import {Component, ElementRef, ViewContainerRef} from 'angular2/core'; -import {CORE_DIRECTIVES} from 'angular2/common'; -import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; +import {Component, ElementRef, ViewContainerRef} from '@angular/core'; +import {CORE_DIRECTIVES} from '@angular/common'; +import {DynamicComponentLoader} from '@angular/core'; import JsonSchema from './json-schema'; import OptionsManager from '../../options'; @@ -41,7 +41,7 @@ export default class JsonSchemaLazy { this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => { this.initComponent(compRef); // trigger change detection - compRef.hostView.changeDetectorRef.detectChanges(); + compRef.changeDetectorRef.detectChanges(); }); } this.loaded = true; @@ -60,7 +60,7 @@ export default class JsonSchemaLazy { if ($element.querySelector('.discriminator-wrap')) { this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => { this.initComponent(compRef); - compRef.hostView.changeDetectorRef.detectChanges(); + compRef.changeDetectorRef.detectChanges(); }); return; } @@ -70,7 +70,7 @@ export default class JsonSchemaLazy { } else { cache[this.pointer] = this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => { this.initComponent(compRef); - compRef.hostView.changeDetectorRef.detectChanges(); + compRef.changeDetectorRef.detectChanges(); return compRef; }); } diff --git a/lib/components/JsonSchema/json-schema-lazy.spec.js b/lib/components/JsonSchema/json-schema-lazy.spec.js index debc622c..e8744b7e 100644 --- a/lib/components/JsonSchema/json-schema-lazy.spec.js +++ b/lib/components/JsonSchema/json-schema-lazy.spec.js @@ -1,9 +1,9 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; -import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {Component, provide} from '@angular/core'; +import {DynamicComponentLoader} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { TestComponentBuilder, @@ -11,7 +11,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import JsonSchemaLazy from 'lib/components/JsonSchema/json-schema-lazy'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index 8ab92146..7445e7d3 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -1,6 +1,6 @@ 'use strict'; -import {ElementRef} from 'angular2/core'; +import {ElementRef} from '@angular/core'; import {RedocComponent, BaseComponent, SchemaManager} from '../base'; import {DropDown} from '../../common/components/DropDown/dropdown'; diff --git a/lib/components/JsonSchema/json-schema.spec.js b/lib/components/JsonSchema/json-schema.spec.js index 50a4bcb6..6c7f2a3c 100644 --- a/lib/components/JsonSchema/json-schema.spec.js +++ b/lib/components/JsonSchema/json-schema.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; +import {Component, provide} from '@angular/core'; import OptionsManager from 'lib/options'; import { @@ -10,7 +10,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import JsonSchema from 'lib/components/JsonSchema/json-schema'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/Method/method.spec.js b/lib/components/Method/method.spec.js index 89d5ad1b..b36b93e5 100644 --- a/lib/components/Method/method.spec.js +++ b/lib/components/Method/method.spec.js @@ -1,8 +1,8 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {Component, provide} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { TestComponentBuilder, @@ -11,7 +11,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import Method from 'lib/components/Method/method'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/MethodsList/methods-list.spec.js b/lib/components/MethodsList/methods-list.spec.js index 22cba67b..71ae31ea 100644 --- a/lib/components/MethodsList/methods-list.spec.js +++ b/lib/components/MethodsList/methods-list.spec.js @@ -1,9 +1,9 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, provide} from 'angular2/core'; +import {Component, provide} from '@angular/core'; import OptionsManager from 'lib/options'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { TestComponentBuilder, @@ -12,7 +12,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import MethodsList from 'lib/components/MethodsList/methods-list'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/Redoc/redoc.js b/lib/components/Redoc/redoc.js index 3858d92e..139c995b 100644 --- a/lib/components/Redoc/redoc.js +++ b/lib/components/Redoc/redoc.js @@ -1,8 +1,9 @@ 'use strict'; -import {ChangeDetectionStrategy, provide, enableProdMode} from 'angular2/core'; -import {ElementRef} from 'angular2/core'; -import {BrowserDomAdapter, bootstrap} from 'angular2/platform/browser'; +import {ChangeDetectionStrategy, provide, enableProdMode} from '@angular/core'; +import {ElementRef} from '@angular/core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import detectScollParent from 'scrollparent'; import {RedocComponent, BaseComponent} from '../base'; import SchemaManager from '../../utils/SchemaManager'; diff --git a/lib/components/Redoc/redoc.spec.js b/lib/components/Redoc/redoc.spec.js index b6bcaac6..032ab8f0 100644 --- a/lib/components/Redoc/redoc.spec.js +++ b/lib/components/Redoc/redoc.spec.js @@ -1,8 +1,8 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, ViewMetadata, provide} from 'angular2/core'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {Component, ViewMetadata, provide} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { TestComponentBuilder, @@ -11,7 +11,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import Redoc from 'lib/components/Redoc/redoc'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/RequestSamples/request-samples.js b/lib/components/RequestSamples/request-samples.js index 032c0f98..ec8a542a 100644 --- a/lib/components/RequestSamples/request-samples.js +++ b/lib/components/RequestSamples/request-samples.js @@ -1,6 +1,6 @@ 'use strict'; -import {ViewChildren, QueryList, ChangeDetectorRef, ChangeDetectionStrategy} from 'angular2/core'; +import {ViewChildren, QueryList, ChangeDetectorRef, ChangeDetectionStrategy} from '@angular/core'; import {RedocComponent, BaseComponent, SchemaManager} from '../base'; import JsonPointer from '../../utils/JsonPointer'; diff --git a/lib/components/SchemaSample/schema-sample.js b/lib/components/SchemaSample/schema-sample.js index c0555c60..21f5f09f 100644 --- a/lib/components/SchemaSample/schema-sample.js +++ b/lib/components/SchemaSample/schema-sample.js @@ -1,6 +1,6 @@ 'use strict'; -import {ElementRef} from 'angular2/core'; +import {ElementRef} from '@angular/core'; import SchemaSampler from 'json-schema-instantiator'; diff --git a/lib/components/SideMenu/side-menu.js b/lib/components/SideMenu/side-menu.js index d0d63042..5ab3ebaf 100644 --- a/lib/components/SideMenu/side-menu.js +++ b/lib/components/SideMenu/side-menu.js @@ -1,9 +1,8 @@ 'use strict'; -import {ChangeDetectorRef, ChangeDetectionStrategy, ElementRef} from 'angular2/core'; -import {document} from 'angular2/src/facade/browser'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; -import {global} from 'angular2/src/facade/lang'; +import {ElementRef} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; +import {global} from '@angular/core/src/facade/lang'; import {RedocComponent, BaseComponent, SchemaManager} from '../base'; import {redocEvents} from '../../events'; @@ -24,20 +23,18 @@ const INVIEW_POSITION = { @RedocComponent({ selector: 'side-menu', templateUrl: './lib/components/SideMenu/side-menu.html', - styleUrls: ['./lib/components/SideMenu/side-menu.css'], - changeDetection: ChangeDetectionStrategy.Default + styleUrls: ['./lib/components/SideMenu/side-menu.css'] }) @Reflect.metadata('parameters', [[SchemaManager], [ElementRef], - [BrowserDomAdapter], [ChangeDetectorRef], [OptionsManager]]) + [BrowserDomAdapter], [OptionsManager]]) export default class SideMenu extends BaseComponent { - constructor(schemaMgr, elementRef, dom, changeDetectorRef, optionsMgr) { + constructor(schemaMgr, elementRef, dom, optionsMgr) { super(schemaMgr); this.$element = elementRef.nativeElement; - this.changeDetector = changeDetectorRef; this.dom = dom; this.options = optionsMgr.options; this.$scrollParent = this.options.$scrollParent; - this.bindEvents(); + this.activeCatIdx = 0; this.activeMethodIdx = -1; this.prevOffsetY = null; @@ -48,6 +45,14 @@ export default class SideMenu extends BaseComponent { this.activeItemCaption = ''; } + + init() { + this.bindEvents(); + this.$mobileNav = this.dom.querySelector(this.$element, '.mobile-nav'); + this.$resourcesNav = this.dom.querySelector(this.$element, '#resources-nav'); + this.changeActive(CHANGE.INITIAL); + } + scrollY() { return (this.$scrollParent.pageYOffset != null) ? this.$scrollParent.pageYOffset : this.$scrollParent.scrollTop; } @@ -218,7 +223,6 @@ export default class SideMenu extends BaseComponent { } stable = true; } - this.changeDetector.detectChanges(); } prepareModel() { @@ -245,10 +249,4 @@ export default class SideMenu extends BaseComponent { dom.setStyle(this.$resourcesNav, 'height', height + 'px'); } } - - init() { - this.$mobileNav = this.dom.querySelector(this.$element, '.mobile-nav'); - this.$resourcesNav = this.dom.querySelector(this.$element, '#resources-nav'); - this.changeActive(CHANGE.INITIAL); - } } diff --git a/lib/components/SideMenu/side-menu.spec.js b/lib/components/SideMenu/side-menu.spec.js index 734ed847..04762365 100644 --- a/lib/components/SideMenu/side-menu.spec.js +++ b/lib/components/SideMenu/side-menu.spec.js @@ -1,8 +1,8 @@ 'use strict'; import { getChildDebugElement, mouseclick} from 'tests/helpers'; -import {Component, provide, ViewMetadata} from 'angular2/core'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; +import {Component, provide, ViewMetadata} from '@angular/core'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import OptionsManager from 'lib/options'; import { @@ -12,7 +12,7 @@ import { beforeEach, beforeEachProviders, it -} from 'angular2/testing'; +} from '@angular/testing'; import {redocEvents} from 'lib/events'; import MethodsList from 'lib/components/MethodsList/methods-list'; diff --git a/lib/components/base.js b/lib/components/base.js index 30facc9b..c3ee656f 100644 --- a/lib/components/base.js +++ b/lib/components/base.js @@ -1,6 +1,6 @@ 'use strict'; -import {Component, ChangeDetectionStrategy} from 'angular2/core'; -import {CORE_DIRECTIVES, JsonPipe, AsyncPipe} from 'angular2/common'; +import {Component, ChangeDetectionStrategy} from '@angular/core'; +import {CORE_DIRECTIVES, JsonPipe, AsyncPipe} from '@angular/common'; import SchemaManager from '../utils/SchemaManager'; import JsonPointer from '../utils/JsonPointer'; import {MarkedPipe, JsonPointerEscapePipe} from '../utils/pipes'; diff --git a/lib/events.js b/lib/events.js index 77b6a0de..2dcac54f 100644 --- a/lib/events.js +++ b/lib/events.js @@ -1,6 +1,6 @@ 'use strict'; -import {EventEmitter} from 'angular2/core'; +import {EventEmitter} from '@angular/core'; var bootsrEmmiter = new EventEmitter(); var langChanged = new EventEmitter(); diff --git a/lib/options.js b/lib/options.js index d708b86c..3021c7cc 100644 --- a/lib/options.js +++ b/lib/options.js @@ -1,8 +1,8 @@ 'use strict'; -import {isFunction, isString} from 'angular2/src/facade/lang'; -import {BrowserDomAdapter} from 'angular2/platform/browser'; -import {global} from 'angular2/src/facade/lang'; +import {isFunction, isString} from '@angular/core/src/facade/lang'; +import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; +import {global} from '@angular/core/src/facade/lang'; var defaults = { scrollYOffset: 0, diff --git a/lib/utils/JsonFormatterPipe.js b/lib/utils/JsonFormatterPipe.js index 11971097..08208ab1 100644 --- a/lib/utils/JsonFormatterPipe.js +++ b/lib/utils/JsonFormatterPipe.js @@ -1,6 +1,6 @@ 'use strict'; -import {Pipe} from 'angular2/core'; -import {isBlank} from 'angular2/src/facade/lang'; +import {Pipe} from '@angular/core'; +import {isBlank} from '@angular/core/src/facade/lang'; var level = 1; const COLLAPSE_LEVEL = 2; diff --git a/lib/utils/pipes.js b/lib/utils/pipes.js index 29940a77..fb30e0a9 100644 --- a/lib/utils/pipes.js +++ b/lib/utils/pipes.js @@ -1,8 +1,8 @@ 'use strict'; -import {Pipe} from 'angular2/core'; -import {isString, stringify, isBlank} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {Pipe} from '@angular/core'; +import {isString, stringify, isBlank} from '@angular/core/src/facade/lang'; +import {BaseException} from '@angular/core/src/facade/exceptions'; import {JsonPointer} from './JsonPointer'; import Prism from '../../prismjs-bundle'; diff --git a/package.json b/package.json index fbb37100..df404abb 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,13 @@ "jspm": { "configFile": "system.config.js", "dependencies": { + "@angular/common": "npm:@angular/common@^2.0.0-rc.1", + "@angular/compiler": "npm:@angular/compiler@^2.0.0-rc.1", + "@angular/core": "npm:@angular/core@^2.0.0-rc.1", + "@angular/platform-browser": "npm:@angular/platform-browser@^2.0.0-rc.1", + "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@^2.0.0-rc.1", + "@angular/platform-browser-dynamic-dynamic": "npm:@angular/platform-browser-dynamic-dynamic@^2.0.0-rc.1", "Robdel12/DropKick": "github:Robdel12/DropKick@^2.1.7", - "angular2": "npm:angular2@2.0.0-beta.17", "es6-shim": "github:es-shims/es6-shim@^0.33.6", "hint.css": "npm:hint.css@^2.2.1", "json": "github:systemjs/plugin-json@^0.1.0", @@ -42,9 +47,11 @@ "json-schema-instantiator": "npm:json-schema-instantiator@^0.3.0", "marked": "npm:marked@^0.3.5", "prismjs": "npm:prismjs@^1.3.0", + "rxjs": "npm:rxjs@5.0.0-beta.6", "scrollparent": "npm:scrollparent@^0.1.0", "stream-http": "npm:stream-http@^2.3.0", - "swagger-parser": "npm:swagger-parser@4.0.0-beta.2" + "swagger-parser": "npm:swagger-parser@4.0.0-beta.2", + "zone.js": "npm:zone.js@0.6.12" }, "devDependencies": { "babel": "npm:babel-core@^5.8.34", @@ -85,7 +92,7 @@ "istanbul": "github:gotwarlost/istanbul#source-map", "jasmine-core": "^2.4.1", "jasmine-spec-reporter": "^2.4.0", - "jspm": "^0.16.19", + "jspm": "^0.16.34", "karma": "^0.13.15", "karma-babel-preprocessor": "^5.2.2", "karma-chrome-launcher": "^0.2.2", @@ -106,7 +113,7 @@ "run-sequence": "^1.1.5", "should": "^8.0.2", "sinon": "^1.17.2", - "systemjs-builder": "^0.15.2", + "systemjs-builder": "^0.15.16", "vinyl-paths": "^2.0.0", "zone.js": "^0.6.12" } diff --git a/system.config.js b/system.config.js index 8fb331e0..fae45007 100644 --- a/system.config.js +++ b/system.config.js @@ -29,16 +29,23 @@ System.config({ meta: { "jspm_packages/npm/json-formatter-js@0.2.0/src/*": { - "format": "es6" + "format": "esm" }, "jspm_packages/npm/json-schema-view-js@0.2.0/src/*": { - "format": "es6" + "format": "esm" + }, + "npm:@angular/**/*": { + "format": "esm" } }, map: { + "@angular/common": "npm:@angular/common@2.0.0-rc.1", + "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1", + "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.1", + "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0-rc.1", "Robdel12/DropKick": "github:Robdel12/DropKick@2.1.7", - "angular2": "npm:angular2@2.0.0-beta.17", "babel": "npm:babel-core@5.8.34", "babel-runtime": "npm:babel-runtime@5.8.34", "clean-css": "npm:clean-css@3.4.6", @@ -52,10 +59,12 @@ System.config({ "json-schema-instantiator": "npm:json-schema-instantiator@0.3.0", "marked": "npm:marked@0.3.5", "prismjs": "npm:prismjs@1.3.0", + "rxjs": "npm:rxjs@5.0.0-beta.6", "scrollparent": "npm:scrollparent@0.1.0", "stream-http": "npm:stream-http@2.3.0", "swagger-parser": "npm:swagger-parser@4.0.0-beta.2", "systemjs/plugin-json": "github:systemjs/plugin-json@0.1.2", + "zone.js": "npm:zone.js@0.6.12", "github:jspm/nodelibs-assert@0.1.0": { "assert": "npm:assert@1.3.0" }, @@ -131,17 +140,38 @@ System.config({ "github:jspm/nodelibs-zlib@0.1.0": { "browserify-zlib": "npm:browserify-zlib@0.1.4" }, + "npm:@angular/common@2.0.0-rc.1": { + "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "process": "github:jspm/nodelibs-process@0.1.2" + }, + "npm:@angular/compiler@2.0.0-rc.1": { + "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "process": "github:jspm/nodelibs-process@0.1.2" + }, + "npm:@angular/core@2.0.0-rc.1": { + "process": "github:jspm/nodelibs-process@0.1.2", + "rxjs": "npm:rxjs@5.0.0-beta.6", + "zone.js": "npm:zone.js@0.6.12" + }, + "npm:@angular/platform-browser-dynamic@2.0.0-rc.1": { + "@angular/common": "npm:@angular/common@2.0.0-rc.1", + "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1", + "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.1", + "process": "github:jspm/nodelibs-process@0.1.2" + }, + "npm:@angular/platform-browser@2.0.0-rc.1": { + "@angular/common": "npm:@angular/common@2.0.0-rc.1", + "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1", + "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "process": "github:jspm/nodelibs-process@0.1.2" + }, "npm:amdefine@1.0.0": { "fs": "github:jspm/nodelibs-fs@0.1.2", "module": "github:jspm/nodelibs-module@0.1.0", "path": "github:jspm/nodelibs-path@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:angular2@2.0.0-beta.17": { - "reflect-metadata": "npm:reflect-metadata@0.1.2", - "rxjs": "npm:rxjs@5.0.0-beta.7", - "zone.js": "npm:zone.js@0.6.12" - }, "npm:argparse@1.0.7": { "fs": "github:jspm/nodelibs-fs@0.1.2", "path": "github:jspm/nodelibs-path@0.1.0", @@ -736,10 +766,6 @@ System.config({ "string_decoder": "npm:string_decoder@0.10.31", "util-deprecate": "npm:util-deprecate@1.0.2" }, - "npm:reflect-metadata@0.1.2": { - "assert": "github:jspm/nodelibs-assert@0.1.0", - "process": "github:jspm/nodelibs-process@0.1.2" - }, "npm:request@2.72.0": { "aws-sign2": "npm:aws-sign2@0.6.0", "aws4": "npm:aws4@1.3.2", @@ -778,10 +804,9 @@ System.config({ "buffer": "github:jspm/nodelibs-buffer@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:rxjs@5.0.0-beta.7": { + "npm:rxjs@5.0.0-beta.6": { "buffer": "github:jspm/nodelibs-buffer@0.1.0", - "process": "github:jspm/nodelibs-process@0.1.2", - "symbol-observable": "npm:symbol-observable@0.2.4" + "process": "github:jspm/nodelibs-process@0.1.2" }, "npm:sha.js@2.4.5": { "buffer": "github:jspm/nodelibs-buffer@0.1.0", From d2eca9fcde54045b6a53617228e821c531519a93 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 6 May 2016 00:48:41 +0300 Subject: [PATCH 03/14] updated angular to rc + refactor --- build/tasks/build.js | 1 + lib/components/ApiInfo/api-info.js | 2 +- lib/components/ApiInfo/api-info.scss | 2 +- lib/components/ApiInfo/api-info.spec.js | 7 +-- lib/components/ApiLogo/api-logo.js | 2 +- lib/components/ApiLogo/api-logo.scss | 2 +- lib/components/ApiLogo/api-logo.spec.js | 7 +-- .../JsonSchema/json-schema-common.scss | 2 +- lib/components/JsonSchema/json-schema-lazy.js | 4 +- .../JsonSchema/json-schema-lazy.spec.js | 6 ++- lib/components/JsonSchema/json-schema.js | 8 +-- lib/components/JsonSchema/json-schema.spec.js | 5 +- lib/components/Method/method.html | 2 +- lib/components/Method/method.js | 26 +++++---- lib/components/Method/method.scss | 4 +- lib/components/Method/method.spec.js | 7 +-- lib/components/MethodsList/methods-list.js | 8 +-- lib/components/MethodsList/methods-list.scss | 4 +- .../MethodsList/methods-list.spec.js | 5 +- lib/components/ParamsList/params-list.js | 7 ++- lib/components/ParamsList/params-list.scss | 2 +- lib/components/Redoc/redoc.js | 40 ++++++++------ lib/components/Redoc/redoc.scss | 2 +- lib/components/Redoc/redoc.spec.js | 5 +- .../RequestSamples/request-samples.html | 6 +-- .../RequestSamples/request-samples.js | 47 ++++++++-------- .../RequestSamples/request-samples.scss | 2 +- .../ResponsesList/responses-list.js | 7 ++- .../ResponsesList/responses-list.scss | 2 +- .../ResponsesSamples/responses-samples.js | 13 ++--- .../ResponsesSamples/responses-samples.scss | 2 +- lib/components/SchemaSample/schema-sample.js | 8 +-- .../SchemaSample/schema-sample.scss | 2 +- lib/components/SideMenu/side-menu.html | 4 +- lib/components/SideMenu/side-menu.js | 20 +++---- lib/components/SideMenu/side-menu.scss | 2 +- lib/components/SideMenu/side-menu.spec.js | 5 +- lib/components/base.js | 6 +-- lib/components/index.js | 53 +++++-------------- lib/events.js | 10 ---- lib/services/events.service.js | 10 ++++ lib/services/index.js | 3 ++ .../components/DropDown/drop-down.js} | 2 +- .../components/DropDown/drop-down.scss} | 0 .../StickySidebar/sticky-sidebar.js | 2 +- .../StickySidebar/sticky-sidebar.spec.js | 6 +-- .../components/Tabs/tabs.js | 2 +- .../components/Tabs/tabs.scss | 0 .../components/Tabs/tabs.spec.js | 2 +- .../components/Zippy/zippy.html | 0 .../components/Zippy/zippy.js | 6 +-- .../components/Zippy/zippy.scss | 0 .../components/Zippy/zippy.spec.js | 4 +- lib/shared/components/index.js | 5 ++ .../styles/_share-link.scss | 0 lib/{common => shared}/styles/_variables.scss | 0 package.json | 3 ++ system.config.js | 1 - tests/helpers.js | 2 +- 59 files changed, 204 insertions(+), 193 deletions(-) delete mode 100644 lib/events.js create mode 100644 lib/services/events.service.js create mode 100644 lib/services/index.js rename lib/{common/components/DropDown/dropdown.js => shared/components/DropDown/drop-down.js} (92%) rename lib/{common/components/DropDown/dropdown.scss => shared/components/DropDown/drop-down.scss} (100%) rename lib/{common => shared}/components/StickySidebar/sticky-sidebar.js (97%) rename lib/{common => shared}/components/StickySidebar/sticky-sidebar.spec.js (90%) rename lib/{common => shared}/components/Tabs/tabs.js (96%) rename lib/{common => shared}/components/Tabs/tabs.scss (100%) rename lib/{common => shared}/components/Tabs/tabs.spec.js (98%) rename lib/{common => shared}/components/Zippy/zippy.html (100%) rename lib/{common => shared}/components/Zippy/zippy.js (79%) rename lib/{common => shared}/components/Zippy/zippy.scss (100%) rename lib/{common => shared}/components/Zippy/zippy.spec.js (96%) create mode 100644 lib/shared/components/index.js rename lib/{common => shared}/styles/_share-link.scss (100%) rename lib/{common => shared}/styles/_variables.scss (100%) diff --git a/build/tasks/build.js b/build/tasks/build.js index 69fc44a9..5361d12c 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -41,6 +41,7 @@ gulp.task('inlineTemplates', ['sass'], function() { var JS_DEV_DEPS = [ 'lib/utils/browser-update.js', 'node_modules/zone.js/dist/zone.js', + 'node_modules/zone.js/dist/long-stack-trace-zone.js', 'node_modules/reflect-metadata/Reflect.js', 'node_modules/babel-polyfill/dist/polyfill.js' ]; diff --git a/lib/components/ApiInfo/api-info.js b/lib/components/ApiInfo/api-info.js index 8fd9391c..336bbaf5 100644 --- a/lib/components/ApiInfo/api-info.js +++ b/lib/components/ApiInfo/api-info.js @@ -9,7 +9,7 @@ import OptionsManager from '../../options'; templateUrl: './lib/components/ApiInfo/api-info.html' }) @Reflect.metadata('parameters', [[SchemaManager], [OptionsManager]]) -export default class ApiInfo extends BaseComponent { +export class ApiInfo extends BaseComponent { constructor(schemaMgr, optionsMgr) { super(schemaMgr); this.optionsMgr = optionsMgr; diff --git a/lib/components/ApiInfo/api-info.scss b/lib/components/ApiInfo/api-info.scss index b7e81ba2..762471b9 100644 --- a/lib/components/ApiInfo/api-info.scss +++ b/lib/components/ApiInfo/api-info.scss @@ -1,4 +1,4 @@ -@import '../../common/styles/variables'; +@import '../../shared/styles/variables'; .api-info-header { font-weight: normal; diff --git a/lib/components/ApiInfo/api-info.spec.js b/lib/components/ApiInfo/api-info.spec.js index 6909a088..d34fdae9 100644 --- a/lib/components/ApiInfo/api-info.spec.js +++ b/lib/components/ApiInfo/api-info.spec.js @@ -4,13 +4,14 @@ import { getChildDebugElement } from 'tests/helpers'; import {Component, provide} from '@angular/core'; import { - TestComponentBuilder, - async, inject, + async, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; import ApiInfo from 'lib/components/ApiInfo/api-info'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/ApiLogo/api-logo.js b/lib/components/ApiLogo/api-logo.js index 46db79dd..dcf5a0bc 100644 --- a/lib/components/ApiLogo/api-logo.js +++ b/lib/components/ApiLogo/api-logo.js @@ -7,7 +7,7 @@ import {RedocComponent, BaseComponent} from '../base'; styleUrls: ['./lib/components/ApiLogo/api-logo.css'], templateUrl: './lib/components/ApiLogo/api-logo.html' }) -export default class ApiLogo extends BaseComponent { +export class ApiLogo extends BaseComponent { constructor(schemaMgr) { super(schemaMgr); } diff --git a/lib/components/ApiLogo/api-logo.scss b/lib/components/ApiLogo/api-logo.scss index 1e16b41e..7f78e62b 100644 --- a/lib/components/ApiLogo/api-logo.scss +++ b/lib/components/ApiLogo/api-logo.scss @@ -1,4 +1,4 @@ -@import '../../common/styles/variables'; +@import '../../shared/styles/variables'; img { max-height: 150px; diff --git a/lib/components/ApiLogo/api-logo.spec.js b/lib/components/ApiLogo/api-logo.spec.js index dfb3a4c6..dec6e5a3 100644 --- a/lib/components/ApiLogo/api-logo.spec.js +++ b/lib/components/ApiLogo/api-logo.spec.js @@ -4,13 +4,14 @@ import { getChildDebugElement } from 'tests/helpers'; import {Component, provide} from '@angular/core'; import { - TestComponentBuilder, - async, inject, + async, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; import ApiLogo from 'lib/components/ApiLogo/api-logo'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/JsonSchema/json-schema-common.scss b/lib/components/JsonSchema/json-schema-common.scss index 4b2d2953..ddcb9656 100644 --- a/lib/components/JsonSchema/json-schema-common.scss +++ b/lib/components/JsonSchema/json-schema-common.scss @@ -1,4 +1,4 @@ -@import '../../common/styles/variables'; +@import '../../shared/styles/variables'; $lines-width: 1px; $bullet-size: 1px; $cell-spacing: 25px; diff --git a/lib/components/JsonSchema/json-schema-lazy.js b/lib/components/JsonSchema/json-schema-lazy.js index dd5a4b46..5f3e1cf7 100644 --- a/lib/components/JsonSchema/json-schema-lazy.js +++ b/lib/components/JsonSchema/json-schema-lazy.js @@ -4,7 +4,7 @@ import {Component, ElementRef, ViewContainerRef} from '@angular/core'; import {CORE_DIRECTIVES} from '@angular/common'; import {DynamicComponentLoader} from '@angular/core'; -import JsonSchema from './json-schema'; +import {JsonSchema} from './json-schema'; import OptionsManager from '../../options'; import SchemaManager from '../../utils/SchemaManager'; @@ -19,7 +19,7 @@ var cache = {}; directives: [CORE_DIRECTIVES] }) @Reflect.metadata('parameters', [[SchemaManager], [ViewContainerRef], [ElementRef], [DynamicComponentLoader], [OptionsManager]]) -export default class JsonSchemaLazy { +export class JsonSchemaLazy { constructor(schemaMgr, viewRef, elementRef, dcl, optionsMgr) { this.viewRef = viewRef; diff --git a/lib/components/JsonSchema/json-schema-lazy.spec.js b/lib/components/JsonSchema/json-schema-lazy.spec.js index e8744b7e..9b4332af 100644 --- a/lib/components/JsonSchema/json-schema-lazy.spec.js +++ b/lib/components/JsonSchema/json-schema-lazy.spec.js @@ -6,12 +6,14 @@ import {DynamicComponentLoader} from '@angular/core'; import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { - TestComponentBuilder, inject, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; + import JsonSchemaLazy from 'lib/components/JsonSchema/json-schema-lazy'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index 7445e7d3..3059e845 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -1,9 +1,9 @@ 'use strict'; -import {ElementRef} from '@angular/core'; +import { ElementRef } from '@angular/core'; -import {RedocComponent, BaseComponent, SchemaManager} from '../base'; -import {DropDown} from '../../common/components/DropDown/dropdown'; +import { RedocComponent, BaseComponent, SchemaManager } from '../base'; +import { DropDown } from '../..//shared/components/index'; import JsonPointer from '../../utils/JsonPointer'; @RedocComponent({ @@ -14,7 +14,7 @@ import JsonPointer from '../../utils/JsonPointer'; inputs: ['isArray', 'final', 'nestOdd', 'childFor', 'skipReadOnly'] }) @Reflect.metadata('parameters', [[SchemaManager], [ElementRef]]) -export default class JsonSchema extends BaseComponent { +export class JsonSchema extends BaseComponent { constructor(schemaMgr, elementRef) { super(schemaMgr); this.$element = elementRef.nativeElement; diff --git a/lib/components/JsonSchema/json-schema.spec.js b/lib/components/JsonSchema/json-schema.spec.js index 6c7f2a3c..a27840f2 100644 --- a/lib/components/JsonSchema/json-schema.spec.js +++ b/lib/components/JsonSchema/json-schema.spec.js @@ -5,12 +5,13 @@ import {Component, provide} from '@angular/core'; import OptionsManager from 'lib/options'; import { - TestComponentBuilder, inject, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; import JsonSchema from 'lib/components/JsonSchema/json-schema'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/Method/method.html b/lib/components/Method/method.html index f3453aff..3cd33f02 100644 --- a/lib/components/Method/method.html +++ b/lib/components/Method/method.html @@ -20,7 +20,7 @@

- +
diff --git a/lib/components/Method/method.js b/lib/components/Method/method.js index 89757c5f..d2ac94fa 100644 --- a/lib/components/Method/method.js +++ b/lib/components/Method/method.js @@ -1,22 +1,30 @@ 'use strict'; -import {JsonPointer} from '../../utils/JsonPointer'; -import {RedocComponent, BaseComponent} from '../base'; +import { forwardRef } from '@angular/core'; +import { JsonPointer } from '../../utils/JsonPointer'; +import { RedocComponent, BaseComponent } from '../base'; -import ParamsList from '../ParamsList/params-list'; -import ResponsesList from '../ResponsesList/responses-list'; -import ResponsesSamples from '../ResponsesSamples/responses-samples'; -import SchemaSample from '../SchemaSample/schema-sample'; -import RequestSamples from '../RequestSamples/request-samples'; +import { + ParamsList, + ResponsesList, + ResponsesSamples, + SchemaSample, + RequestSamples +} from '../index'; @RedocComponent({ selector: 'method', templateUrl: './lib/components/Method/method.html', styleUrls: ['./lib/components/Method/method.css'], - directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample, RequestSamples], + directives: [ + forwardRef(() => ParamsList), + forwardRef(() => ResponsesList), + forwardRef(() => ResponsesSamples), + forwardRef(() => SchemaSample), + forwardRef(() => RequestSamples)], inputs: ['tag'] }) -export default class Method extends BaseComponent { +export class Method extends BaseComponent { constructor(schemaMgr) { super(schemaMgr); } diff --git a/lib/components/Method/method.scss b/lib/components/Method/method.scss index f3cec22a..ea625f20 100644 --- a/lib/components/Method/method.scss +++ b/lib/components/Method/method.scss @@ -1,5 +1,5 @@ -@import '../../common/styles/variables'; -@import '../../common/styles/share-link'; +@import '../../shared/styles/variables'; +@import '../../shared/styles/share-link'; :host { padding-bottom: 100px; diff --git a/lib/components/Method/method.spec.js b/lib/components/Method/method.spec.js index b36b93e5..44756606 100644 --- a/lib/components/Method/method.spec.js +++ b/lib/components/Method/method.spec.js @@ -5,13 +5,14 @@ import {Component, provide} from '@angular/core'; import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { - TestComponentBuilder, - async, inject, + async, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; import Method from 'lib/components/Method/method'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/MethodsList/methods-list.js b/lib/components/MethodsList/methods-list.js index 32998a4f..169e5a61 100644 --- a/lib/components/MethodsList/methods-list.js +++ b/lib/components/MethodsList/methods-list.js @@ -1,8 +1,8 @@ 'use strict'; -import {RedocComponent, BaseComponent} from '../base'; -import Method from '../Method/method'; -import {EncodeURIComponentPipe} from '../../utils/pipes'; +import { RedocComponent, BaseComponent } from '../base'; +import { Method } from '../index'; +import { EncodeURIComponentPipe } from '../../utils/pipes'; @RedocComponent({ selector: 'methods-list', @@ -11,7 +11,7 @@ import {EncodeURIComponentPipe} from '../../utils/pipes'; directives: [Method], pipes: [EncodeURIComponentPipe] }) -export default class MethodsList extends BaseComponent { +export class MethodsList extends BaseComponent { constructor(schemaMgr) { super(schemaMgr); diff --git a/lib/components/MethodsList/methods-list.scss b/lib/components/MethodsList/methods-list.scss index c4d64f39..ff1465c3 100644 --- a/lib/components/MethodsList/methods-list.scss +++ b/lib/components/MethodsList/methods-list.scss @@ -1,5 +1,5 @@ -@import '../../common/styles/variables'; -@import '../../common/styles/share-link'; +@import '../../shared/styles/variables'; +@import '../../shared/styles/share-link'; .tag-info { padding: 40px; diff --git a/lib/components/MethodsList/methods-list.spec.js b/lib/components/MethodsList/methods-list.spec.js index 71ae31ea..87119c21 100644 --- a/lib/components/MethodsList/methods-list.spec.js +++ b/lib/components/MethodsList/methods-list.spec.js @@ -6,13 +6,14 @@ import OptionsManager from 'lib/options'; import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { - TestComponentBuilder, inject, async, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; import MethodsList from 'lib/components/MethodsList/methods-list'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/ParamsList/params-list.js b/lib/components/ParamsList/params-list.js index e664af1b..1aef52a4 100644 --- a/lib/components/ParamsList/params-list.js +++ b/lib/components/ParamsList/params-list.js @@ -1,8 +1,7 @@ 'use strict'; -import {RedocComponent, BaseComponent} from '../base'; -import JsonSchema from '../JsonSchema/json-schema'; -import JsonSchemaLazy from '../JsonSchema/json-schema-lazy'; +import { RedocComponent, BaseComponent } from '../base'; +import { JsonSchema, JsonSchemaLazy } from '../index'; function safePush(obj, prop, item) { if (!obj[prop]) obj[prop] = []; @@ -15,7 +14,7 @@ function safePush(obj, prop, item) { styleUrls: ['./lib/components/ParamsList/params-list.css'], directives: [JsonSchema, JsonSchemaLazy] }) -export default class ParamsList extends BaseComponent { +export class ParamsList extends BaseComponent { constructor(schemaMgr) { super(schemaMgr); } diff --git a/lib/components/ParamsList/params-list.scss b/lib/components/ParamsList/params-list.scss index 211c04b4..f7b63f46 100644 --- a/lib/components/ParamsList/params-list.scss +++ b/lib/components/ParamsList/params-list.scss @@ -1,4 +1,4 @@ -@import '../../common/styles/variables'; +@import '../../shared/styles/variables'; $hint-color: #999999; diff --git a/lib/components/Redoc/redoc.js b/lib/components/Redoc/redoc.js index 139c995b..fdb36d27 100644 --- a/lib/components/Redoc/redoc.js +++ b/lib/components/Redoc/redoc.js @@ -1,20 +1,25 @@ 'use strict'; -import {ChangeDetectionStrategy, provide, enableProdMode} from '@angular/core'; +import {provide, enableProdMode} from '@angular/core'; import {ElementRef} from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; + import detectScollParent from 'scrollparent'; + import {RedocComponent, BaseComponent} from '../base'; import SchemaManager from '../../utils/SchemaManager'; -import ApiInfo from '../ApiInfo/api-info'; -import ApiLogo from '../ApiLogo/api-logo'; -import MethodsList from '../MethodsList/methods-list'; -import SideMenu from '../SideMenu/side-menu'; -import StickySidebar from '../../common/components/StickySidebar/sticky-sidebar'; +import { + ApiInfo, + ApiLogo, + MethodsList, + SideMenu +} from '../index'; +import { StickySidebar } from '../../shared/components/index'; + import OptionsManager from '../../options'; -import {redocEvents} from '../../events'; +import { RedocEventsService } from '../../services/index'; import './redoc-loading-styles.css!css'; @@ -25,23 +30,30 @@ var _modeLocked = false; selector: 'redoc', providers: [ SchemaManager, - BrowserDomAdapter + BrowserDomAdapter, + RedocEventsService ], templateUrl: './lib/components/Redoc/redoc.html', styleUrls: ['./lib/components/Redoc/redoc.css'], - directives: [ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar], - changeDetection: ChangeDetectionStrategy.Default + directives: [ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar] }) @Reflect.metadata('parameters', [ - [SchemaManager], [OptionsManager], [ElementRef]]) -export default class Redoc extends BaseComponent { - constructor(schemaMgr, optionsMgr, elementRef) { + [SchemaManager], [OptionsManager], [ElementRef], [RedocEventsService]]) +export class Redoc extends BaseComponent { + constructor(schemaMgr, optionsMgr, elementRef, events) { super(schemaMgr); this.element = elementRef.nativeElement; //parse options (top level component doesn't support inputs) optionsMgr.parseOptions( this.element ); optionsMgr.options.$scrollParent = detectScollParent( this.element ); this.options = optionsMgr.options; + this.events = events; + } + + ngAfterViewInit() { + setTimeout( () => { + this.events.bootstrapped.next(); + }); } static showLoadingAnimation() { @@ -82,8 +94,6 @@ export default class Redoc extends BaseComponent { (appRef) => { Redoc.hideLoadingAnimation(); Redoc.appRef = appRef; - // setTimeout to allow cached elements to init - setTimeout(() => redocEvents.bootstrapped.next()); console.log('ReDoc bootstrapped!'); }, error => { diff --git a/lib/components/Redoc/redoc.scss b/lib/components/Redoc/redoc.scss index a446e4f8..048e4060 100644 --- a/lib/components/Redoc/redoc.scss +++ b/lib/components/Redoc/redoc.scss @@ -1,4 +1,4 @@ -@import '../../common/styles/variables'; +@import '../../shared/styles/variables'; :host { display: block; diff --git a/lib/components/Redoc/redoc.spec.js b/lib/components/Redoc/redoc.spec.js index 032ab8f0..7bf7cb92 100644 --- a/lib/components/Redoc/redoc.spec.js +++ b/lib/components/Redoc/redoc.spec.js @@ -5,13 +5,14 @@ import {Component, ViewMetadata, provide} from '@angular/core'; import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; import { - TestComponentBuilder, inject, async, beforeEach, beforeEachProviders, it -} from '@angular/testing'; +} from '@angular/core/testing'; + +import { TestComponentBuilder } from '@angular/compiler/testing'; import Redoc from 'lib/components/Redoc/redoc'; import SchemaManager from 'lib/utils/SchemaManager'; diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html index 78bb0657..a11d9b1f 100644 --- a/lib/components/RequestSamples/request-samples.html +++ b/lib/components/RequestSamples/request-samples.html @@ -1,8 +1,8 @@ -
Request samples
- +
Request samples
+ - +

diff --git a/lib/components/RequestSamples/request-samples.js b/lib/components/RequestSamples/request-samples.js
index ec8a542a..c8c65408 100644
--- a/lib/components/RequestSamples/request-samples.js
+++ b/lib/components/RequestSamples/request-samples.js
@@ -1,49 +1,50 @@
 'use strict';
 
-import {ViewChildren, QueryList, ChangeDetectorRef, ChangeDetectionStrategy} from '@angular/core';
+import { forwardRef, ViewChildren, QueryList } from '@angular/core';
 
-import {RedocComponent, BaseComponent, SchemaManager} from '../base';
+import { RedocComponent, BaseComponent, SchemaManager } from '../base';
 import JsonPointer from '../../utils/JsonPointer';
-import {Tabs, Tab} from '../../common/components/Tabs/tabs';
-import SchemaSample from '../SchemaSample/schema-sample';
-import {PrismPipe} from '../../utils/pipes';
-import {redocEvents} from '../../events';
+import { Tabs, Tab } from '../..//shared/components/index';
+import { SchemaSample } from '../index';
+import { PrismPipe } from '../../utils/pipes';
+import { RedocEventsService } from '../../services/index';
 
 @RedocComponent({
   selector: 'request-samples',
   templateUrl: './lib/components/RequestSamples/request-samples.html',
   styleUrls: ['./lib/components/RequestSamples/request-samples.css'],
-  directives: [SchemaSample, Tabs, Tab],
-  inputs: ['bodySchemaPtr'],
-  pipes: [PrismPipe],
-  changeDetection: ChangeDetectionStrategy.OnPush
+  directives: [forwardRef(() =>SchemaSample), Tabs, Tab],
+  inputs: ['schemaPointer'],
+  pipes: [PrismPipe]
 })
-@Reflect.metadata('parameters', [[SchemaManager], [new ViewChildren(Tabs), QueryList], [ChangeDetectorRef]])
-export default class RequestSamples extends BaseComponent {
-  constructor(schemaMgr, tabs, changeDetector) {
+@Reflect.metadata('parameters', [[SchemaManager], [RedocEventsService], [new ViewChildren(Tabs), QueryList]])
+export class RequestSamples extends BaseComponent {
+  constructor(schemaMgr, events, childQuery) {
     super(schemaMgr);
-    tabs.changes.subscribe(_ => {
-      this.tabs = tabs.first;
-      this.subscribeForEvents(_);
+    childQuery.changes.subscribe(() => {
+      this.childTabs = childQuery.first;
     });
-    this.changeDetector = changeDetector;
+    this.events = events;
+  }
+
+  init() {
+    this.subscribeForEvents();
   }
 
   changeLangNotify(lang) {
-    redocEvents.samplesLanguageChanged.next(lang);
+    this.events.samplesLanguageChanged.next(lang);
   }
 
   subscribeForEvents() {
-    if (!this.tabs) return;
-    redocEvents.samplesLanguageChanged.subscribe((sampleLang) => {
-      this.tabs.selectyByTitle(sampleLang);
-      this.changeDetector.markForCheck();
+    this.events.samplesLanguageChanged.subscribe((sampleLang) => {
+      if (!this.childTabs) return;
+      this.childTabs.selectyByTitle(sampleLang);
     });
   }
 
   prepareModel() {
     this.data = {};
-    this.data.bodySchemaPtr = JsonPointer.join(this.bodySchemaPtr, 'schema');
+    this.data.schemaPointer = JsonPointer.join(this.schemaPointer, 'schema');
     this.data.samples = this.componentSchema['x-code-samples'] || [];
   }
 }
diff --git a/lib/components/RequestSamples/request-samples.scss b/lib/components/RequestSamples/request-samples.scss
index 333d0420..84569503 100644
--- a/lib/components/RequestSamples/request-samples.scss
+++ b/lib/components/RequestSamples/request-samples.scss
@@ -1,4 +1,4 @@
-@import '../../common/styles/variables';
+@import '../../shared/styles/variables';
 
 header {
     font-family: $headers-font;
diff --git a/lib/components/ResponsesList/responses-list.js b/lib/components/ResponsesList/responses-list.js
index 6c85d901..2ff52f59 100644
--- a/lib/components/ResponsesList/responses-list.js
+++ b/lib/components/ResponsesList/responses-list.js
@@ -2,9 +2,8 @@
 
 import {RedocComponent, BaseComponent, SchemaManager} from '../base';
 import JsonPointer from '../../utils/JsonPointer';
-import JsonSchema from '../JsonSchema/json-schema';
-import JsonSchemaLazy from '../JsonSchema/json-schema-lazy';
-import Zippy from '../../common/components/Zippy/zippy';
+import { JsonSchema, JsonSchemaLazy } from '../index';
+import {Zippy} from '../../shared/components/index';
 import {statusCodeType} from '../../utils/helpers';
 import OptionsManager from '../../options';
 
@@ -19,7 +18,7 @@ function isNumeric(n) {
   directives: [JsonSchema, Zippy, JsonSchemaLazy]
 })
 @Reflect.metadata('parameters', [[SchemaManager], [OptionsManager]])
-export default class ResponsesList extends BaseComponent {
+export class ResponsesList extends BaseComponent {
   constructor(schemaMgr, optionsMgr) {
     super(schemaMgr);
     this.options = optionsMgr.options;
diff --git a/lib/components/ResponsesList/responses-list.scss b/lib/components/ResponsesList/responses-list.scss
index d9212b11..c63354c9 100644
--- a/lib/components/ResponsesList/responses-list.scss
+++ b/lib/components/ResponsesList/responses-list.scss
@@ -1,4 +1,4 @@
-@import '../../common/styles/variables';
+@import '../../shared/styles/variables';
 
 .responses-list-header {
   font-size: 18px;
diff --git a/lib/components/ResponsesSamples/responses-samples.js b/lib/components/ResponsesSamples/responses-samples.js
index db573f84..3515f5e9 100644
--- a/lib/components/ResponsesSamples/responses-samples.js
+++ b/lib/components/ResponsesSamples/responses-samples.js
@@ -1,10 +1,11 @@
 'use strict';
 
-import {RedocComponent, BaseComponent} from '../base';
+import { forwardRef } from '@angular/core';
+import { RedocComponent, BaseComponent } from '../base';
 import JsonPointer from '../../utils/JsonPointer';
-import {Tabs, Tab} from '../../common/components/Tabs/tabs';
-import SchemaSample from '../SchemaSample/schema-sample';
-import {statusCodeType} from '../../utils/helpers';
+import { Tabs, Tab } from '../../shared/components/index';
+import { SchemaSample } from '../index';
+import { statusCodeType } from '../../utils/helpers';
 
 
 function isNumeric(n) {
@@ -20,9 +21,9 @@ function hasExample(response) {
   selector: 'responses-samples',
   templateUrl: './lib/components/ResponsesSamples/responses-samples.html',
   styleUrls: ['./lib/components/ResponsesSamples/responses-samples.css'],
-  directives: [SchemaSample, Tabs, Tab]
+  directives: [forwardRef( ()=> SchemaSample), Tabs, Tab]
 })
-export default class ResponsesSamples extends BaseComponent {
+export class ResponsesSamples extends BaseComponent {
   constructor(schemaMgr) {
     super(schemaMgr);
   }
diff --git a/lib/components/ResponsesSamples/responses-samples.scss b/lib/components/ResponsesSamples/responses-samples.scss
index cb9ab0cd..1334dd8d 100644
--- a/lib/components/ResponsesSamples/responses-samples.scss
+++ b/lib/components/ResponsesSamples/responses-samples.scss
@@ -1,4 +1,4 @@
-@import '../../common/styles/variables';
+@import '../../shared/styles/variables';
 
 tab, tabs {
     display: block;
diff --git a/lib/components/SchemaSample/schema-sample.js b/lib/components/SchemaSample/schema-sample.js
index 21f5f09f..0c350ba1 100644
--- a/lib/components/SchemaSample/schema-sample.js
+++ b/lib/components/SchemaSample/schema-sample.js
@@ -1,11 +1,11 @@
 'use strict';
 
-import {ElementRef} from '@angular/core';
+import { ElementRef } from '@angular/core';
 
 import SchemaSampler from 'json-schema-instantiator';
 
-import {JsonFormatter} from '../../utils/JsonFormatterPipe';
-import {RedocComponent, BaseComponent, SchemaManager} from '../base';
+import { RedocComponent, BaseComponent, SchemaManager } from '../base';
+import { JsonFormatter } from '../../utils/JsonFormatterPipe';
 
 @RedocComponent({
   selector: 'schema-sample',
@@ -14,7 +14,7 @@ import {RedocComponent, BaseComponent, SchemaManager} from '../base';
   styleUrls: ['./lib/components/SchemaSample/schema-sample.css']
 })
 @Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
-export default class SchemaSample extends BaseComponent {
+export class SchemaSample extends BaseComponent {
   constructor(schemaMgr, elementRef) {
     super(schemaMgr);
     this.element = elementRef.nativeElement;
diff --git a/lib/components/SchemaSample/schema-sample.scss b/lib/components/SchemaSample/schema-sample.scss
index 13463cca..ef191331 100644
--- a/lib/components/SchemaSample/schema-sample.scss
+++ b/lib/components/SchemaSample/schema-sample.scss
@@ -1,4 +1,4 @@
-@import '../../common/styles/variables';
+@import '../../shared/styles/variables';
 
 pre {
   background-color: transparent;
diff --git a/lib/components/SideMenu/side-menu.html b/lib/components/SideMenu/side-menu.html
index 429f7db7..a947fcc1 100644
--- a/lib/components/SideMenu/side-menu.html
+++ b/lib/components/SideMenu/side-menu.html
@@ -1,11 +1,11 @@
-
+
API Reference: {{activeCatCaption}} {{activeItemCaption}}
-
+