api-render-ui 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/Readme.md +79 -0
- package/api-render-ui.css +20 -4
- package/api-render-ui.js +622 -158
- package/package.json +16 -5
- package/test.html +1124 -123
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 tyy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/Readme.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
api-render-ui is a UI library that pursues simple and efficient data rendering for openapi.
|
|
2
|
+
|
|
3
|
+
## Table of contents
|
|
4
|
+
|
|
5
|
+
* [Installation](#Installation)
|
|
6
|
+
* [Features](#Features)
|
|
7
|
+
* [Docs & Community](#docs--community)
|
|
8
|
+
* [Quick Start](#Quick-Start)
|
|
9
|
+
* [Philosophy](#Philosophy)
|
|
10
|
+
* [Examples](#Examples)
|
|
11
|
+
* [License](#license)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
[![NPM Version][npm-version-image]][npm-url]
|
|
15
|
+
[![NPM Downloads][npm-downloads-image]][npm-downloads-url]
|
|
16
|
+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<head>
|
|
21
|
+
<title>API Renderer Demo</title>
|
|
22
|
+
<link rel="stylesheet" href="./api-render-ui.css">
|
|
23
|
+
</head>
|
|
24
|
+
<head>
|
|
25
|
+
<title>API Renderer Demo</title>
|
|
26
|
+
<link rel="stylesheet" href="./api-render-ui.css">
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<div id="apiContainer"></div>
|
|
30
|
+
<script src="./api-render-ui.js"></script>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
const apiRenderer = new ApiRenderer({
|
|
34
|
+
mountPoint: '#apiContainer',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const openapiSpec = {...};
|
|
38
|
+
|
|
39
|
+
apiRenderer.render(openapiSpec);
|
|
40
|
+
</script>
|
|
41
|
+
</body>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
47
|
+
[npm registry](https://www.npmjs.com/).
|
|
48
|
+
|
|
49
|
+
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
|
|
50
|
+
Node.js 18 or higher is required.
|
|
51
|
+
|
|
52
|
+
If this is a brand new project, make sure to create a `package.json` first with
|
|
53
|
+
the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).
|
|
54
|
+
|
|
55
|
+
Installation is done using the
|
|
56
|
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install api-render-ui
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
* convert openapi spec data to api list.Only openapi 3.0+ is supported now.
|
|
66
|
+
* Api unit UI.
|
|
67
|
+
|
|
68
|
+
## Docs & Community
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Quick Start
|
|
72
|
+
|
|
73
|
+
## Philosophy
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
[MIT](LICENSE)
|
package/api-render-ui.css
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
gap: 5px;
|
|
78
78
|
height: 48px;
|
|
79
79
|
justify-content: center;
|
|
80
|
-
width:
|
|
80
|
+
width: 100px
|
|
81
81
|
}
|
|
82
82
|
.codigma-apiunit-methodtype {
|
|
83
83
|
align-items: center;
|
|
@@ -98,13 +98,17 @@
|
|
|
98
98
|
font-family: Inter;
|
|
99
99
|
font-size: 16px;
|
|
100
100
|
font-weight: 400;
|
|
101
|
-
word-wrap: break-word
|
|
101
|
+
word-wrap: break-word;
|
|
102
|
+
border-left: 0;
|
|
103
|
+
border-right: 0;
|
|
104
|
+
border-top: 0;
|
|
105
|
+
border-bottom: 1px solid black;
|
|
102
106
|
}
|
|
103
107
|
.codigma-apiunit-send-button {
|
|
104
108
|
align-items: center;
|
|
105
109
|
display: flex;
|
|
106
110
|
gap: 10px;
|
|
107
|
-
height:
|
|
111
|
+
height: 32px;
|
|
108
112
|
justify-content: center;
|
|
109
113
|
width: 88px
|
|
110
114
|
}
|
|
@@ -115,6 +119,13 @@
|
|
|
115
119
|
font-weight: 400;
|
|
116
120
|
word-wrap: break-word
|
|
117
121
|
}
|
|
122
|
+
.codigma-apiunit-send-button:hover {
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
}
|
|
125
|
+
.codigma-apiunit-send-button:active {
|
|
126
|
+
background-color: gray;
|
|
127
|
+
}
|
|
128
|
+
|
|
118
129
|
.codigma-apiunit-reqcontent {
|
|
119
130
|
align-items: flex-start;
|
|
120
131
|
align-self: stretch;
|
|
@@ -161,6 +172,9 @@
|
|
|
161
172
|
.codigma-apiunit-valuetext {
|
|
162
173
|
align-self: stretch;
|
|
163
174
|
background: white;
|
|
175
|
+
border-left: 0;
|
|
176
|
+
border-right: 0;
|
|
177
|
+
border-top: 0;
|
|
164
178
|
border-bottom: 1px var(--Labels---Vibrant---Controls-Primary-√, #404040) solid;
|
|
165
179
|
padding: 10px;
|
|
166
180
|
width: 161px
|
|
@@ -232,7 +246,9 @@
|
|
|
232
246
|
width: 122px
|
|
233
247
|
}
|
|
234
248
|
.codigma-apiunit-responsebody {
|
|
249
|
+
position: relative;
|
|
235
250
|
align-self: stretch;
|
|
236
251
|
flex: 1 1 0;
|
|
237
|
-
|
|
252
|
+
min-height: 5rem;
|
|
253
|
+
/* padding: 2px */
|
|
238
254
|
}
|