Skip to content

Commit 736fa34

Browse files
committed
updated documentation
1 parent 4f22c60 commit 736fa34

File tree

7 files changed

+196
-27
lines changed

7 files changed

+196
-27
lines changed

docs/api.html

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,31 +91,47 @@ <h2> Attributes</h2>
9191
<table class="m-table">
9292
<tr>
9393
<td class=" attr-col mono bold right">theme </td>
94-
<td class="gray"> <span class='bold dark-gray'>Allowed:<span class='blue'> light, dark</span></span> </td>
95-
<td class='default-col'>light</td>
94+
<td class="gray"> <span class='bold dark-gray'>Allowed:<span class='blue'> light, dark</span></span>
95+
<br/> Is the base theme, which is used for calculating colors for various UI components.
96+
'theme', 'bg-color' and 'text-color' are the base attributes for generating a custom theme
97+
</td>
98+
<td class='default-col' style="min-width:150px">light</td>
9699
</tr>
100+
101+
<tr>
102+
<td class="mono bold right">bg-color </td>
103+
<td class="gray">Hex color code for main background</td>
104+
<td class='small-font mono'>Dark Theme: #333 <br/>Light Theme: #fff</td>
105+
</tr>
106+
107+
<tr>
108+
<td class="mono bold right">text-color </td>
109+
<td class="gray">Hex color code for text</td>
110+
<td class='small-font mono'> Dark Theme: #bbb <br/>Light Theme: #444</td>
111+
</tr>
112+
97113
<tr>
98114
<td class="mono bold right">header-color </td>
99115
<td class="gray">Hex color code for the header's background</td>
100-
<td>#444444</td>
116+
<td class='small-font mono'>#444444</td>
101117
</tr>
102118

103119
<tr>
104120
<td class="mono bold right">primary-color</td>
105121
<td class="gray">Hex color code on various controls such as buttons, tabs </td>
106-
<td>#FF791A</td>
122+
<td class='small-font mono'>#FF791A</td>
107123
</tr>
108124

109125
<tr>
110126
<td class="mono bold right">regular-font </td>
111127
<td class="gray">Font Name(s) to be used for regular text </td>
112-
<td>rapidoc, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif</td>
128+
<td class='small-font'>rapidoc, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif</td>
113129
</tr>
114130

115131
<tr>
116132
<td class="mono bold right">mono-font </td>
117133
<td class="gray">Font Name(s) to be used for monospaced text </td>
118-
<td>Monaco, 'Andale Mono', 'Roboto Mono', 'Consolas'</td>
134+
<td class='small-font'>Monaco, 'Andale Mono', 'Roboto Mono', 'Consolas'</td>
119135
</tr>
120136
</table>
121137

@@ -332,12 +348,12 @@ <h2> Methods </h2>
332348
<div class="table-block">
333349
<table class="m-table">
334350
<tr>
335-
<th class="attr-col">Method</th>
351+
<th>Method</th>
336352
<th style="text-align:left">Description </th>
337353
<th class="default-col"></th>
338354
</tr>
339355
<tr>
340-
<td class="mono bold right">loadSpec() </td>
356+
<td class="attr-col mono bold right">loadSpec() </td>
341357
<td class="gray">To programatically load spec. The method takes
342358
<ul>
343359
<li> either a string containing the url of the specs</li>

docs/examples/markdown.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
<script type="text/javascript" src="../rapidoc-min.js"></script>
1616
</head>
1717
<body>
18-
<rapi-doc spec-url="../specs/markdown.yaml" render-style="read" allow-server-selection="false"> </rapi-doc>
18+
<rapi-doc spec-url="../specs/markdown.yaml" render-style="read" allow-server-selection="false" theme='dark'> </rapi-doc>
1919
</body>
2020
</html>

docs/examples/themes.html

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<!doctype html>
2+
<head>
3+
<!-- Global site tag (gtag.js) - Google Analytics -->
4+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-1"></script>
5+
<script>
6+
window.dataLayer = window.dataLayer || [];
7+
function gtag(){dataLayer.push(arguments);}
8+
gtag('js', new Date());
9+
gtag('config', 'UA-132775238-1');
10+
</script>
11+
<meta charset="utf-8">
12+
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
13+
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
14+
<style>
15+
.btn{
16+
width: 70px;
17+
height: 70px;
18+
background-color: #47AFE8;
19+
color: #fff;
20+
font-size: 12px;
21+
display: block;
22+
border: none;
23+
margin: 2px;
24+
border-radius: 2px;
25+
cursor:pointer;
26+
outline:none;
27+
}
28+
rapi-doc{
29+
width:100%;
30+
}
31+
</style>
32+
<script type="text/javascript" src="../rapidoc-min.js"></script>
33+
<script>
34+
function getRapiDoc(){
35+
return document.getElementById("thedoc");
36+
}
37+
38+
function changeSchemaStyle() {
39+
let docEl = getRapiDoc();
40+
if (docEl.getAttribute('schema-style') === 'table'){
41+
docEl.setAttribute('schema-style',"tree");
42+
}
43+
else{
44+
docEl.setAttribute('schema-style',"table");
45+
}
46+
}
47+
48+
function changeTheme(themeName){
49+
let docEl = getRapiDoc();
50+
if (themeName === 'dark'){
51+
docEl.setAttribute('theme','dark');
52+
docEl.setAttribute('bg-color','#333');
53+
docEl.setAttribute('text-color','#BBB');
54+
} else if (themeName === 'light'){
55+
docEl.setAttribute('theme','light');
56+
docEl.setAttribute('bg-color','#FFF');
57+
docEl.setAttribute('text-color','#444');
58+
} else if (themeName === 'night') {
59+
docEl.setAttribute('theme','dark');
60+
docEl.setAttribute('bg-color','#14191f');
61+
docEl.setAttribute('text-color','#aec2e0');
62+
} else if (themeName === 'mud') {
63+
docEl.setAttribute('theme','dark');
64+
docEl.setAttribute('bg-color','#403635');
65+
docEl.setAttribute('text-color','#c3b8b7');
66+
} else if (themeName === 'cofee') {
67+
docEl.setAttribute('theme','dark');
68+
docEl.setAttribute('bg-color','#36312C');
69+
docEl.setAttribute('text-color','#ceb8a0');
70+
} else if (themeName === 'forest') {
71+
docEl.setAttribute('theme','dark');
72+
docEl.setAttribute('bg-color','#323b3d');
73+
docEl.setAttribute('text-color','#BDD6DB');
74+
} else if (themeName === 'olive') {
75+
docEl.setAttribute('theme','dark');
76+
docEl.setAttribute('bg-color','#2a2f31');
77+
docEl.setAttribute('text-color','#acc7c8');
78+
} else if (themeName === 'outerspace') {
79+
docEl.setAttribute('theme','dark');
80+
docEl.setAttribute('bg-color','#2D3133');
81+
docEl.setAttribute('text-color','#CAD9E3');
82+
} else if (themeName === 'ebony') {
83+
docEl.setAttribute('theme','dark');
84+
docEl.setAttribute('bg-color','#2B303B');
85+
docEl.setAttribute('text-color','#dee3ec');
86+
} else if (themeName === 'snow') {
87+
docEl.setAttribute('theme','light');
88+
docEl.setAttribute('bg-color','#FAFAFA');
89+
docEl.setAttribute('text-color','#555');
90+
} else if (themeName === 'green') {
91+
docEl.setAttribute('theme','light');
92+
docEl.setAttribute('bg-color','#f9fdf7');
93+
docEl.setAttribute('text-color','#375F1B');
94+
} else if (themeName === 'blue') {
95+
docEl.setAttribute('theme','light');
96+
docEl.setAttribute('bg-color','#ecf1f7');
97+
docEl.setAttribute('text-color','#133863');
98+
} else if (themeName === 'beige') {
99+
docEl.setAttribute('theme','light');
100+
docEl.setAttribute('bg-color','#fdf8ed');
101+
docEl.setAttribute('text-color','#342809');
102+
}
103+
104+
}
105+
106+
function changeSpec(){
107+
let docEl = getRapiDoc();
108+
if (docEl.getAttribute('spec-url').includes('bitbucket')){
109+
docEl.setAttribute('spec-url',"../specs/petstore_extended.yaml");
110+
}
111+
else{
112+
docEl.setAttribute('spec-url',"../specs/bitbucket.json");
113+
}
114+
}
115+
116+
function changeRenderStyle() {
117+
let currRender = getRapiDoc().getAttribute('render-style');
118+
let newRender = currRender === "read" ? "view" : "read";
119+
getRapiDoc().setAttribute('render-style', newRender );
120+
}
121+
122+
</script>
123+
</head>
124+
<body>
125+
<rapi-doc id="thedoc" spec-url="https://petstore.swagger.io/v2/swagger.json">
126+
<div style="display:flex; margin:10px; justify-content:center;flex-wrap: wrap;">
127+
<button class="btn" onclick="changeSpec()">API Spec</button>
128+
<button class="btn" onclick="changeRenderStyle()">Render Style</button>
129+
<button class="btn" onclick="changeSchemaStyle()">Schema Style</button>
130+
131+
<div style="width:40px;"> </div>
132+
<button class="btn" onclick="changeTheme('dark')">Dark</button>
133+
<button class="btn" onclick="changeTheme('night')">Night</button>
134+
<button class="btn" onclick="changeTheme('mud')">Mud</button>
135+
<button class="btn" onclick="changeTheme('cofee')">Cofee</button>
136+
<button class="btn" onclick="changeTheme('forest')">Forest</button>
137+
<button class="btn" onclick="changeTheme('olive')">Olive</button>
138+
<button class="btn" onclick="changeTheme('outerspace')">Outer Space</button>
139+
<button class="btn" onclick="changeTheme('ebony')">Ebony</button>
140+
141+
<div style="width:40px;"> </div>
142+
<button class="btn" onclick="changeTheme('light')">Light</button>
143+
<button class="btn" onclick="changeTheme('snow')">Snow</button>
144+
<button class="btn" onclick="changeTheme('green')"> Green</button>
145+
<button class="btn" onclick="changeTheme('blue')"> Blue</button>
146+
<button class="btn" onclick="changeTheme('beige')"> Beige</button>
147+
148+
</div>
149+
</rapi-doc>
150+
</body>
151+
</html>

docs/index.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ h1,h2,h3 { font-weight:300; }
2525
.right{ text-align: right; }
2626
.gray { color:#777; }
2727
.dark-gray { color:#444; }
28+
.light-gray { color:#aaa; }
2829
.blue { color:steelblue; }
30+
.small-font {font-size:12px;}
2931
.table-title { margin: 12px 0 5px 0; font-weight:bold; }
3032
.descr {
3133
font-size:13px;

docs/rapidoc-min.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/welcome.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ <h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
180180
</div>
181181

182182
<div class="section" style="flex-direction: column;align-items: center;">
183-
<h2 style="text-align: center;"> Comes with two themes - Dark and Light</h2>
183+
<h2 style="text-align: center;"> Crteate your own themes with simplicity </h2>
184184

185185
<div style="display:flex;justify-content: space-around;">
186186
<div id="slider" class="beer-slider shadow3" data-beer-label="">

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"openapi themes",
2626
"swagger themes"
2727
],
28-
"main": ".src/rapidoc.js",
29-
"module": ".src/rapidoc.js",
28+
"main": "dist/rapidoc-min.js",
29+
"module": "dist/rapidoc-min.js",
3030
"dependencies": {
3131
"json-refs": "^3.0.13",
3232
"lit-element": "2.2.1",
@@ -48,7 +48,7 @@
4848
"clean-webpack-plugin": "^3.0.0",
4949
"compression-webpack-plugin": "^3.0.0",
5050
"css-loader": "^3.2.0",
51-
"eslint": "^6.5.1",
51+
"eslint": "^6.6.0",
5252
"eslint-config-airbnb": "^18.0.1",
5353
"eslint-loader": "^3.0.2",
5454
"eslint-import-resolver-webpack":"^0.11.1",
@@ -63,6 +63,6 @@
6363
"webpack": "^4.41.2",
6464
"webpack-bundle-analyzer": "^3.6.0",
6565
"webpack-cli": "^3.3.9",
66-
"webpack-dev-server": "^3.8.2"
66+
"webpack-dev-server": "^3.9.0"
6767
}
6868
}

0 commit comments

Comments
 (0)