Merge commit '128b1fc1e2decb7a1a60e7ee6e03dd0762984597' into releases

This commit is contained in:
RedocBot 2017-05-05 10:56:34 +00:00 committed by travis@localhost
commit b1bb8e1896
23 changed files with 326 additions and 487 deletions

View File

@ -1,3 +1,25 @@
<a name="1.15.0"></a>
# [1.15.0](https://github.com/Rebilly/ReDoc/compare/v1.14.0...v1.15.0) (2017-05-05)
### Bug Fixes
* menu items not full-width on short item names ([ef1b2bd](https://github.com/Rebilly/ReDoc/commit/ef1b2bd))
* menu service subscription leak ([bb00dc3](https://github.com/Rebilly/ReDoc/commit/bb00dc3))
* openapi button: add `download` attribute ([583c571](https://github.com/Rebilly/ReDoc/commit/583c571))
* sample unavailable when no schema in response object ([1eedbfe](https://github.com/Rebilly/ReDoc/commit/1eedbfe))
* Slugifying non-ascii headers make duplicate permalinks ([#264](https://github.com/Rebilly/ReDoc/issues/264)) ([6edbbe7](https://github.com/Rebilly/ReDoc/commit/6edbbe7))
* typo in download button classname (thanks [@dwilding](https://github.com/dwilding)) ([6b363a5](https://github.com/Rebilly/ReDoc/commit/6b363a5))
* firefox and IE scroll sync after deps update ([ad04636](https://github.com/Rebilly/ReDoc/commit/ad04636))
### Features
* add triangle icon for expandable menu items ([e7130d2](https://github.com/Rebilly/ReDoc/commit/e7130d2))
* clear button (x) in search box ([0341db4](https://github.com/Rebilly/ReDoc/commit/0341db4))
<a name="1.14.0"></a>
# [1.14.0](https://github.com/Rebilly/ReDoc/compare/v1.13.0...v1.14.0) (2017-04-23)

View File

@ -1,7 +1,7 @@
# ReDoc
**OpenAPI/Swagger-generated API Reference Documentation**
[![Build Status](https://travis-ci.org/Rebilly/ReDoc.svg?branch=master)](https://travis-ci.org/Rebilly/ReDoc) [![Coverage Status](https://coveralls.io/repos/Rebilly/ReDoc/badge.svg?branch=master&service=github)](https://coveralls.io/github/Rebilly/ReDoc?branch=master) [![Tested on APIs.guru](http://api.apis.guru/badges/tested_on.svg)](https://APIs.guru) [![Dependency Status](https://gemnasium.com/badges/github.com/Rebilly/ReDoc.svg)](https://gemnasium.com/github.com/Rebilly/ReDoc) [![Stories in Ready](https://badge.waffle.io/Rebilly/ReDoc.png?label=ready&title=Ready)](https://waffle.io/Rebilly/ReDoc)
[![Build Status](https://travis-ci.org/Rebilly/ReDoc.svg?branch=master)](https://travis-ci.org/Rebilly/ReDoc) [![Coverage Status](https://coveralls.io/repos/Rebilly/ReDoc/badge.svg?branch=master&service=github)](https://coveralls.io/github/Rebilly/ReDoc?branch=master) [![Tested on APIs.guru](http://api.apis.guru/badges/tested_on.svg)](https://APIs.guru) [![dependencies Status](https://david-dm.org/Rebilly/ReDoc/status.svg)](https://david-dm.org/Rebilly/ReDoc) [![devDependencies Status](https://david-dm.org/Rebilly/ReDoc/dev-status.svg)](https://david-dm.org/Rebilly/ReDoc#info=devDependencies) [![Stories in Ready](https://badge.waffle.io/Rebilly/ReDoc.png?label=ready&title=Ready)](https://waffle.io/Rebilly/ReDoc)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/Rebilly/redoc.svg)](http://isitmaintained.com/project/Rebilly/redoc "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/REBILLY/REDOC.svg)](http://isitmaintained.com/project/REBILLY/REDOC "Percentage of issues still open")

View File

@ -16,10 +16,10 @@ mkdir('-p', 'dist');
cp('-R', '../dist/*', './dist/');
cd('..');
var version = 'v' + require(path.join(__dirname, '../package.json')).version + '/';
var versionDir = path.join(paths.releases, version);
var version = require(path.join(__dirname, '../package.json')).version;
var versionDir = path.join(paths.releases, 'v' + version + '/');
var latestDir = path.join(paths.releases, 'latest/');
var v1Dir = path.join(paths.releases, 'v1.x.x/');
var v1Dir = path.join(paths.releases, 'v' + version.split('.')[0] + '.x.x/');
mkdir('-p', versionDir)
mkdir('-p', latestDir);
mkdir('-p', v1Dir);

View File

@ -1,12 +1,11 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RedocModule } from './redoc.module';
import { Redoc } from './components/index';
@NgModule({
imports: [ BrowserModule, BrowserAnimationsModule, RedocModule ],
imports: [ BrowserModule, RedocModule ],
bootstrap: [ Redoc ],
exports: [ Redoc ]
})

View File

@ -1,8 +1,8 @@
<div class="api-info-wrapper">
<h1>{{info.title}} <span class="api-info-version">({{info.version}})</span></h1>
<p class="donwload-openapi" *ngIf="specUrl">
<p class="download-openapi" *ngIf="specUrl">
Download OpenAPI (fka Swagger) specification:
<a class="openapi-button" target="_blank" attr.href='{{specUrl}}'> Download </a>
<a class="openapi-button" download target="_blank" attr.href='{{specUrl}}'> Download </a>
</p>
<p>
<!-- TODO: create separate components for contact and license ? -->

View File

@ -78,7 +78,7 @@ export class Redoc extends BaseComponent implements OnInit {
//parse options (top level component doesn't support inputs)
optionsMgr.parseOptions( this.element );
let scrollParent = detectScollParent( this.element );
if (scrollParent === DOM.defaultDoc().body) scrollParent = window;
if (scrollParent === (document.scrollingElement || document.documentElement)) scrollParent = window;
optionsMgr.options.$scrollParent = scrollParent;
this.options = optionsMgr.options;
this.lazyTasksService.allSync = !this.options.lazyRendering;

View File

@ -33,7 +33,7 @@ export class SchemaSample extends BaseComponent implements OnInit {
init() {
this.bindEvents();
let base:any = {};
let base:any = this.componentSchema;
let sample;
// got pointer not directly to the schema but e.g. to the response obj

View File

@ -1,4 +1,5 @@
<div class="search-input-wrap">
<div class="clear-button" *ngIf="searchTerm" (click)="clearSearch()">×</div>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<path d="M968.2,849.4L667.3,549c83.9-136.5,66.7-317.4-51.7-435.6C477.1-25,252.5-25,113.9,113.4c-138.5,138.3-138.5,362.6,0,501C219.2,730.1,413.2,743,547.6,666.5l301.9,301.4c43.6,43.6,76.9,14.9,104.2-12.4C981,928.3,1011.8,893,968.2,849.4z M524.5,522c-88.9,88.7-233,88.7-321.8,0c-88.9-88.7-88.9-232.6,0-321.3c88.9-88.7,233-88.7,321.8,0C613.4,289.4,613.4,433.3,524.5,522z"/>
</svg>

View File

@ -18,12 +18,24 @@
fill: lighten($text-color, 20%);
}
}
.clear-button {
position: absolute;
display: inline-block;
width: 13px;
text-align: center;
right: 20px;
height: 28px;
line-height: 28px;
vertical-align: middle;
cursor: pointer;
}
}
input {
width: 100%;
box-sizing: border-box;
padding: 5px 5px 5px 20px;
padding: 5px 20px 5px 20px;
border: 0;
border-bottom: 1px solid darken($side-bar-bg-color, 10%);

View File

@ -38,6 +38,11 @@ export class RedocSearch implements OnInit {
this.search.indexAll();
}
clearSearch() {
this.searchTerm = '';
this.updateSearch();
}
update(event:KeyboardEvent, val) {
if (event && event.keyCode === 27) { // escape
this.searchTerm = '';

View File

@ -3,8 +3,11 @@
<label class="menu-item-header" [ngClass]="{disabled: !item.ready}" (click)="activateItem(item)">
<span class="operation-type" [ngClass]="item?.metadata?.operation" *ngIf="item?.metadata?.operation"> {{item?.metadata?.operation}} </span><!--
--><span class="menu-item-title">{{item.name}}</span>
<svg *ngIf="item.items?.length" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" viewBox="0 0 24 24" xml:space="preserve">
<polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "/>
</svg>
</label>
<ul *ngIf="item.items" class="menu-subitems" [@itemAnimation]="(item.active || item.isGroup) ? 'expanded' : 'collapsed'">
<ul *ngIf="item.items" class="menu-subitems">
<side-menu-items [items]="item.items" (activate)="activateItem($event)"> </side-menu-items>
</ul>
</li>

View File

@ -20,6 +20,25 @@
cursor: default;
color: lighten($text-color, 60%);
}
display: flex;
justify-content: space-between;
> svg {
height: 18px;
vertical-align: middle;
float: right;
transform: rotateZ(-90deg);
//transition: transform 0.3s ease-out;
polygon {
fill: $border-color;
}
.active > & {
transform: rotateZ(0);
}
}
}
.menu-item {
@ -98,6 +117,10 @@
font-size: 0.8em;
padding-bottom: 0;
cursor: default;
> svg {
display: none;
}
}
&:hover,
&.active {

View File

@ -8,6 +8,7 @@ $mobile-menu-compact-breakpoint: 550px;
#resources-nav {
position: relative;
width: 100%;
}
ul.menu-root {

View File

@ -22,17 +22,6 @@ const global = window;
selector: 'side-menu-items',
templateUrl: './side-menu-items.html',
styleUrls: ['./side-menu-items.css'],
animations: [
trigger('itemAnimation', [
state('collapsed, void',
style({ height: '0px' })),
state('expanded',
style({ height: '*' })),
transition('collapsed <=> expanded', [
animate('200ms ease')
])
])
]
})
export class SideMenuItems {
@Input() items: MenuItem[];

View File

@ -29,4 +29,4 @@ export const REDOC_DIRECTIVES = [
export { ApiInfo, ApiLogo, JsonSchema, JsonSchemaLazy, ParamsList, RequestSamples, ResponsesList,
ResponsesSamples, SchemaSample, SideMenu, OperationsList, Operation, Warnings, Redoc, SecurityDefinitions,
LoadingBar, SideMenuItems, ExternalDocs, EndpointLink }
LoadingBar, SideMenuItems, ExternalDocs, EndpointLink };

View File

@ -35,7 +35,7 @@ export interface MenuItem {
active?: boolean;
ready?: boolean;
depth?: number;
depth?: string|number;
flatIdx?: number;
metadata?: any;
@ -72,7 +72,11 @@ export class MenuService {
this.buildMenu();
});
this._scrollSubscription = scrollService.scroll.subscribe((evt) => {
this.subscribe();
}
subscribe() {
this._scrollSubscription = this.scrollService.scroll.subscribe((evt) => {
this.onScroll(evt.isScrolledDown);
});
@ -260,7 +264,7 @@ export class MenuService {
if (namespace === 'section') {
searchId = hash;
} else {
searchId = ptr || (namespace + '/' + sectionId);;
searchId = ptr || (namespace + '/' + sectionId);
}
idx = this.flatItems.findIndex(item => item.id === searchId);
@ -478,5 +482,6 @@ export class MenuService {
destroy() {
this._hashSubscription.unsubscribe();
this._scrollSubscription.unsubscribe();
this._progressSubscription.unsubscribe();
}
}

View File

@ -1,6 +1,6 @@
'use strict';
import { SchemaNormalizer } from './schema-normalizer.service';
import { SpecManager } from '../utils/spec-manager';;
import { SpecManager } from '../utils/spec-manager';
import { OptionsService } from '../services/options.service';

View File

@ -53,7 +53,8 @@ export class MdRenderer {
}
saveHeading(title: string, parent:MarkdownHeading = {id:null, children: this.headings}) :MarkdownHeading {
let slug = slugify(title);
// if title contains some non-ASCII characters (e.g. chinese) slugify returns empty string
let slug = slugify(title) || title;
let id = slug;
if (parent && parent.id) id = `${parent.id}/${id}`;
parent.children = parent.children || {};
@ -110,7 +111,7 @@ export class MdRenderer {
} else {
let content = tokens[idx + 1].content;
if (tokens[idx].hLevel === 1 ) {
this.currentTopHeading = this.saveHeading(content);;
this.currentTopHeading = this.saveHeading(content);
let id = this.currentTopHeading.id;
return `<h${tokens[idx].hLevel} section="section/${id}">` +
`<a class="share-link" href="#section/${id}"></a>` +

View File

@ -15,11 +15,11 @@ export interface RedocInjectedPointer {
}
export interface SwaggerOperation extends Operation, RedocInjectedPointer {};
export interface SwaggerOperation extends Operation, RedocInjectedPointer {}
export interface SwaggerBodyParameter extends BodyParameter, RedocInjectedPointer {}
export interface SwaggerHeaderParameter extends HeaderParameter, RedocInjectedPointer {}
export interface SwaggerQueryParameter extends QueryParameter, RedocInjectedPointer {}
export interface SwaggerFormDataParameter extends FormDataParameter, RedocInjectedPointer {}
export type SwaggerParameter = SwaggerBodyParameter | SwaggerHeaderParameter | SwaggerQueryParameter | SwaggerFormDataParameter;
export interface SwaggerSchema extends Schema, RedocInjectedPointer {};
export interface SwaggerSchema extends Schema, RedocInjectedPointer {}
export { Spec as SwaggerSpec, Response as SwaggerResponse };

View File

@ -1,7 +1,7 @@
{
"name": "redoc",
"description": "Swagger-generated API Reference Documentation",
"version": "1.14.0",
"version": "1.15.0",
"repository": {
"type": "git",
"url": "git://github.com/Rebilly/ReDoc"
@ -50,40 +50,39 @@
"author": "Roman Hotsiy",
"license": "MIT",
"devDependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@types/jasmine": "^2.5.46",
"@types/requirejs": "^2.1.26",
"@types/should": "^8.1.28",
"@types/swagger-schema-official": "^2.0.2",
"@types/webpack": "^2.2.12",
"@angular/common": "^4.1.1",
"@angular/compiler": "^4.1.1",
"@angular/compiler-cli": "^4.1.1",
"@angular/core": "^4.1.1",
"@angular/platform-browser": "^4.1.1",
"@angular/platform-browser-dynamic": "^4.1.1",
"@angular/platform-server": "^4.1.1",
"@types/jasmine": "^2.5.47",
"@types/requirejs": "^2.1.29",
"@types/should": "^8.3.0",
"@types/swagger-schema-official": "^2.0.4",
"@types/webpack": "^2.2.15",
"angular2-template-loader": "^0.6.2",
"awesome-typescript-loader": "^3.1.2",
"awesome-typescript-loader": "^3.1.3",
"branch-release": "^1.0.3",
"chalk": "^1.1.3",
"codelyzer": "^3.0.0-beta.4",
"codelyzer": "^3.0.1",
"conventional-changelog-cli": "^1.3.1",
"core-js": "^2.4.1",
"coveralls": "^2.12.0",
"css-loader": "^0.27.3",
"coveralls": "^2.13.1",
"css-loader": "^0.28.1",
"deploy-to-gh-pages": "^1.3.3",
"dropkickjs": "^2.1.10",
"hint.css": "^2.3.2",
"http-server": "^0.9.0",
"hint.css": "^2.5.0",
"http-server": "^0.10.0",
"https-browserify": "^1.0.0",
"istanbul-instrumenter-loader": "^2.0.0",
"jasmine-core": "^2.4.1",
"jasmine-spec-reporter": "^3.1.0",
"jasmine-core": "^2.6.1",
"jasmine-spec-reporter": "^4.1.0",
"json-pointer": "^0.6.0",
"json-schema-ref-parser": "^3.1.2",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",
"karma": "^1.6.0",
"karma-chrome-launcher": "^2.1.0",
"karma-coverage": "^1.1.1",
"karma-coveralls": "^1.1.2",
"karma-jasmine": "^1.0.2",
@ -95,36 +94,36 @@
"karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"lunr": "^1.0.0",
"mark.js": "github:julmot/mark.js",
"node-sass": "^4.5.2",
"openapi-sampler": "^0.4.1",
"phantomjs-prebuilt": "^2.1.7",
"phantomjs-prebuilt": "^2.1.14",
"prismjs": "^1.5.1",
"protractor": "^5.1.1",
"raw-loader": "^0.5.1",
"remarkable": "^1.6.2",
"rimraf": "^2.6.1",
"rxjs": "^5.2.0",
"rxjs": "^5.3.1",
"sass-loader": "^6.0.3",
"scrollparent": "^1.0.0",
"scrollparent": "^2.0.1",
"shelljs": "^0.7.7",
"should": "^11.2.1",
"sinon": "^2.1.0",
"sinon": "^2.2.0",
"slugify": "^1.0.2",
"source-map-loader": "^0.2.0",
"stream-http": "^2.6.1",
"source-map-loader": "^0.2.1",
"stream-http": "^2.7.0",
"string-replace-webpack-plugin": "^0.1.3",
"style-loader": "^0.16.1",
"style-loader": "^0.17.0",
"ts-helpers": "^1.1.1",
"tslint": "^4.5.1",
"typescript": "^2.2.2",
"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2",
"tslint": "^5.2.0",
"typescript": "^2.3.2",
"webpack": "^2.5.0",
"webpack-dev-server": "^2.4.5",
"webpack-merge": "^4.1.0",
"zone.js": "^0.8.5"
"zone.js": "^0.8.10"
},
"dependencies": {
"perfect-scrollbar": "^0.6.16"
"lunr": "1.0.0",
"perfect-scrollbar": "^0.7.0"
}
}

View File

@ -55,7 +55,7 @@ function verifyNoBrowserErrors() {
if (message.match(/This site makes use of a SHA-1 Certificate/)) return false;
if (logEntry.level.value >= LogLevel.INFO) {
if (logEntry.level.value > LogLevel.WARNING) {
if (message.length > MAX_ERROR_MESSAGE_SYMBOLS) {
message = message.substr(0, MAX_ERROR_MESSAGE_SYMBOLS) + '...';
}

View File

@ -23,7 +23,6 @@ var ErrorHandler = require('@angular/core').ErrorHandler;
var forwardRef = require('@angular/core').forwardRef;
var BrowserDynamicTestingModule = require('@angular/platform-browser-dynamic/testing').BrowserDynamicTestingModule;
var platformBrowserDynamicTesting = require('@angular/platform-browser-dynamic/testing').platformBrowserDynamicTesting;
var BrowserAnimationsModule = require('@angular/platform-browser/animations').BrowserAnimationsModule;
var SpecManager = require('../lib/utils/spec-manager').SpecManager;
var services = require('../lib/services/index');
var REDOC_PIPES = require('../lib/utils/pipes').REDOC_PIPES;
@ -39,7 +38,6 @@ TestBed.initTestEnvironment(
beforeEach(function() {
TestBed.configureTestingModule({
imports: [BrowserAnimationsModule],
providers: [
SpecManager,
services.AppStateService,

609
yarn.lock

File diff suppressed because it is too large Load Diff