api-render-ui 1.1.8 → 1.1.9
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/package.json +1 -5
- package/scripts/inline-styles.mjs +0 -34
- package/src/api-render-ui.css +0 -302
- package/src/api-render-ui.ts +0 -1793
- package/src/index.ts +0 -1
- package/src/inlined-styles.ts +0 -303
- package/src/model.ts +0 -45
- package/tsconfig.json +0 -18
- package/tsup.config.ts +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "api-render-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "api-render-ui is a UI library that pursues simple and efficient data rendering for openapi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,12 +44,8 @@
|
|
|
44
44
|
"files": [
|
|
45
45
|
"dist",
|
|
46
46
|
"example",
|
|
47
|
-
"scripts",
|
|
48
|
-
"src",
|
|
49
47
|
"Readme.md",
|
|
50
48
|
"package.json",
|
|
51
|
-
"tsconfig.json",
|
|
52
|
-
"tsup.config.ts",
|
|
53
49
|
"LICENSE"
|
|
54
50
|
]
|
|
55
51
|
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// scripts/inline-styles.mjs
|
|
2
|
-
//当本项目导出为依赖时,需要处理全局styles.css在第三方应应用中无法加载的问题,解决方案是将styles.css转换为内联style添加到DOM树中,在此
|
|
3
|
-
//第一步需要转换成ts文件中的字符串文本,方便后续处理
|
|
4
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { dirname, join } from 'node:path';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
|
|
11
|
-
const cssPath = join(__dirname, '..', 'src', 'api-render-ui.css');
|
|
12
|
-
const outputPath = join(__dirname, '..', 'src', 'inlined-styles.ts');
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
// 读取 CSS 文件
|
|
16
|
-
const cssContent = await readFile(cssPath, 'utf8');
|
|
17
|
-
|
|
18
|
-
// 转义反引号和换行(确保能安全放入模板字符串)
|
|
19
|
-
const escapedCss = cssContent
|
|
20
|
-
.replace(/\\/g, '\\\\') // 转义反斜杠
|
|
21
|
-
.replace(/`/g, '\\`') // 转义反引号
|
|
22
|
-
.replace(/\$/g, '\\$'); // 转义 $(避免模板字符串插值)
|
|
23
|
-
|
|
24
|
-
// 生成 TS 文件内容
|
|
25
|
-
const tsContent = `// Auto-generated by inline-styles.mjs\nexport const GLOBAL_STYLES = \`${escapedCss}\`;\n`;
|
|
26
|
-
|
|
27
|
-
// 写入文件
|
|
28
|
-
await writeFile(outputPath, tsContent, 'utf8');
|
|
29
|
-
|
|
30
|
-
console.log('✅ Successfully inlined styles.css into inlined-styles.ts');
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.error('❌ Failed to inline styles:', err);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
package/src/api-render-ui.css
DELETED
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
.codigma-apioperatorlist {
|
|
2
|
-
align-items: flex-start;
|
|
3
|
-
background: var(--surface, white);
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
gap: 5px;
|
|
7
|
-
justify-content: flex-start;
|
|
8
|
-
width: 100%
|
|
9
|
-
}
|
|
10
|
-
/* Theme variables and mappings */
|
|
11
|
-
:root {
|
|
12
|
-
--Labels---Vibrant---Controls-Primary-√: #404040;
|
|
13
|
-
--primary: #404040;
|
|
14
|
-
--main-color: #404040; /* main / primary color */
|
|
15
|
-
--aux-color: #a9c7ef; /* auxiliary color for hover / accents */
|
|
16
|
-
--embellish-color: #ced8e7; /* embellishment color for active states */
|
|
17
|
-
--surface: white;
|
|
18
|
-
--text: black;
|
|
19
|
-
--even-bg: rgb(235, 239, 244);
|
|
20
|
-
--odd-bg: rgb(250, 246, 246);
|
|
21
|
-
--hover-bg: var(--aux-color, rgb(169, 199, 239));
|
|
22
|
-
--active-bg: var(--embellish-color, rgb(206, 216, 231));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.codigma-theme-light {
|
|
26
|
-
--main-color: #404040;
|
|
27
|
-
--aux-color: #a9c7ef;
|
|
28
|
-
--embellish-color: #ced8e7;
|
|
29
|
-
--primary: var(--main-color);
|
|
30
|
-
--Labels---Vibrant---Controls-Primary-√: var(--main-color);
|
|
31
|
-
--surface: white;
|
|
32
|
-
--text: black;
|
|
33
|
-
--even-bg: rgb(235, 239, 244);
|
|
34
|
-
--odd-bg: rgb(250, 246, 246);
|
|
35
|
-
--hover-bg: var(--aux-color);
|
|
36
|
-
--active-bg: var(--embellish-color);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.codigma-theme-dark {
|
|
40
|
-
--main-color: #9fb8ff;
|
|
41
|
-
--aux-color: #334155;
|
|
42
|
-
--embellish-color: #22303a;
|
|
43
|
-
--primary: var(--main-color);
|
|
44
|
-
--Labels---Vibrant---Controls-Primary-√: var(--main-color);
|
|
45
|
-
--surface: #1f1f1f;
|
|
46
|
-
--text: #e6e6e6;
|
|
47
|
-
--even-bg: #2a2a2a;
|
|
48
|
-
--odd-bg: #222222;
|
|
49
|
-
--hover-bg: var(--aux-color);
|
|
50
|
-
--active-bg: var(--embellish-color);
|
|
51
|
-
}
|
|
52
|
-
.codigma-apioperator {
|
|
53
|
-
align-items: center;
|
|
54
|
-
align-self: stretch;
|
|
55
|
-
display: inline-flex;
|
|
56
|
-
gap: 10px;
|
|
57
|
-
/* border-radius: 8px; */
|
|
58
|
-
height: 32px;
|
|
59
|
-
justify-content: flex-start
|
|
60
|
-
}
|
|
61
|
-
.codigma-apioperator:nth-child(even) {
|
|
62
|
-
color: var(--main-color, var(--primary, #404040));
|
|
63
|
-
}
|
|
64
|
-
.codigma-apioperator:nth-child(odd) {
|
|
65
|
-
color: var(--main-color, var(--primary, #404040));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.codigma-apioperator:hover {
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
color: var(--text, black);
|
|
71
|
-
background-color: var(--hover-bg, rgba(169,199,239,0.12));
|
|
72
|
-
transition: background-color .12s ease, color .12s ease;
|
|
73
|
-
border-radius: 4px;
|
|
74
|
-
}
|
|
75
|
-
.codigma-apioperator:active {
|
|
76
|
-
color: var(--main-color, var(--primary, #404040));
|
|
77
|
-
}
|
|
78
|
-
.codigma-method {
|
|
79
|
-
align-items: center;
|
|
80
|
-
display: flex;
|
|
81
|
-
gap: 5px;
|
|
82
|
-
justify-content: center;
|
|
83
|
-
width: 64px
|
|
84
|
-
}
|
|
85
|
-
.codigma-methodtype {
|
|
86
|
-
align-items: center;
|
|
87
|
-
display: flex;
|
|
88
|
-
gap: 10px;
|
|
89
|
-
justify-content: center
|
|
90
|
-
}
|
|
91
|
-
.codigma-get {
|
|
92
|
-
color: var(--main-color, var(--primary, #404040));
|
|
93
|
-
word-wrap: break-word
|
|
94
|
-
}
|
|
95
|
-
.codigma-requrl {
|
|
96
|
-
color: var(--text, black);
|
|
97
|
-
flex: 1 1 0;
|
|
98
|
-
word-wrap: break-word
|
|
99
|
-
}
|
|
100
|
-
/**********************apiunit css style*************************/
|
|
101
|
-
.codigma-apiunit {
|
|
102
|
-
align-items: flex-start;
|
|
103
|
-
background: var(--surface, white);
|
|
104
|
-
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
105
|
-
display: inline-flex;
|
|
106
|
-
flex-direction: column;
|
|
107
|
-
gap: 8px;
|
|
108
|
-
justify-content: flex-start;
|
|
109
|
-
width: 100%
|
|
110
|
-
}
|
|
111
|
-
.codigma-apiunit-apioperator {
|
|
112
|
-
align-items: center;
|
|
113
|
-
align-self: stretch;
|
|
114
|
-
border-bottom: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
115
|
-
border-top: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
116
|
-
display: inline-flex;
|
|
117
|
-
gap: 10px;
|
|
118
|
-
height: 48px;
|
|
119
|
-
justify-content: flex-start
|
|
120
|
-
}
|
|
121
|
-
.codigma-apiunit-method {
|
|
122
|
-
align-items: center;
|
|
123
|
-
display: flex;
|
|
124
|
-
gap: 5px;
|
|
125
|
-
height: 48px;
|
|
126
|
-
justify-content: center;
|
|
127
|
-
width: 100px
|
|
128
|
-
}
|
|
129
|
-
.codigma-apiunit-methodtype {
|
|
130
|
-
align-items: center;
|
|
131
|
-
display: flex;
|
|
132
|
-
gap: 10px;
|
|
133
|
-
justify-content: center
|
|
134
|
-
}
|
|
135
|
-
.codigma-apiunit-post {
|
|
136
|
-
color: var(--main-color, var(--primary, #404040));
|
|
137
|
-
word-wrap: break-word
|
|
138
|
-
}
|
|
139
|
-
.codigma-apiunit-requrl {
|
|
140
|
-
color: var(--text, black);
|
|
141
|
-
flex: 1 1 0;
|
|
142
|
-
word-wrap: break-word;
|
|
143
|
-
border-left: 0;
|
|
144
|
-
border-right: 0;
|
|
145
|
-
border-top: 0;
|
|
146
|
-
border-bottom: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
147
|
-
height: 70%;
|
|
148
|
-
}
|
|
149
|
-
.codigma-apiunit-send-button {
|
|
150
|
-
align-items: center;
|
|
151
|
-
display: flex;
|
|
152
|
-
gap: 10px;
|
|
153
|
-
height: 32px;
|
|
154
|
-
justify-content: center;
|
|
155
|
-
width: 88px
|
|
156
|
-
}
|
|
157
|
-
.codigma-apiunit-send {
|
|
158
|
-
color: var(--text, black);
|
|
159
|
-
word-wrap: break-word
|
|
160
|
-
}
|
|
161
|
-
.codigma-apiunit-send-button:hover {
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
}
|
|
164
|
-
.codigma-apiunit-send-button:active {
|
|
165
|
-
background-color: gray;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.codigma-apiunit-reqcontent {
|
|
169
|
-
align-items: flex-start;
|
|
170
|
-
align-self: stretch;
|
|
171
|
-
display: flex;
|
|
172
|
-
flex-direction: column;
|
|
173
|
-
flex: 1 1 0;
|
|
174
|
-
gap: 5px;
|
|
175
|
-
justify-content: flex-start;
|
|
176
|
-
padding-left: 5px;
|
|
177
|
-
}
|
|
178
|
-
.codigma-apiunit-paramters-section {
|
|
179
|
-
align-items: center;
|
|
180
|
-
align-self: stretch;
|
|
181
|
-
display: inline-flex;
|
|
182
|
-
flex: 1 1 0;
|
|
183
|
-
justify-content: flex-start
|
|
184
|
-
}
|
|
185
|
-
.codigma-apiunit-parameters-cnr {
|
|
186
|
-
align-items: center;
|
|
187
|
-
background: var(--surface, white);
|
|
188
|
-
display: flex;
|
|
189
|
-
height: 42px;
|
|
190
|
-
justify-content: space-between;
|
|
191
|
-
width: 122px
|
|
192
|
-
}
|
|
193
|
-
.codigma-apiunit-parakeyvalues {
|
|
194
|
-
align-items: flex-start;
|
|
195
|
-
align-self: stretch;
|
|
196
|
-
background: var(--surface, white);
|
|
197
|
-
display: inline-flex;
|
|
198
|
-
flex-direction: column;
|
|
199
|
-
flex: 1 1 0;
|
|
200
|
-
gap: 10px;
|
|
201
|
-
justify-content: flex-start;
|
|
202
|
-
overflow: hidden;
|
|
203
|
-
padding: 10px
|
|
204
|
-
}
|
|
205
|
-
.codigma-apiunit-keyvalue {
|
|
206
|
-
align-items: center;
|
|
207
|
-
display: inline-flex;
|
|
208
|
-
flex: 1 1 0;
|
|
209
|
-
gap: 10px;
|
|
210
|
-
justify-content: flex-start
|
|
211
|
-
}
|
|
212
|
-
.codigma-apiunit-valuetext {
|
|
213
|
-
align-self: stretch;
|
|
214
|
-
background: var(--surface, white);
|
|
215
|
-
border-left: 0;
|
|
216
|
-
border-right: 0;
|
|
217
|
-
border-top: 0;
|
|
218
|
-
border-bottom: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
219
|
-
padding: 10px;
|
|
220
|
-
width: 161px
|
|
221
|
-
}
|
|
222
|
-
/* .codigma-apiunit-keyvalue {
|
|
223
|
-
align-items: center;
|
|
224
|
-
display: inline-flex;
|
|
225
|
-
flex: 1 1 0;
|
|
226
|
-
gap: 10px;
|
|
227
|
-
justify-content: flex-start;
|
|
228
|
-
width: 211px
|
|
229
|
-
} */
|
|
230
|
-
.codigma-apiunit-request-body-section {
|
|
231
|
-
align-items: center;
|
|
232
|
-
align-self: stretch;
|
|
233
|
-
display: inline-flex;
|
|
234
|
-
justify-content: flex-start;
|
|
235
|
-
padding-right: 5px
|
|
236
|
-
}
|
|
237
|
-
.codigma-apiunit-request-body-info {
|
|
238
|
-
align-self: stretch;
|
|
239
|
-
}
|
|
240
|
-
.codigma-apiunit-parakeyvalues {
|
|
241
|
-
align-items: flex-start;
|
|
242
|
-
align-self: stretch;
|
|
243
|
-
background: var(--surface, white);
|
|
244
|
-
display: flex;
|
|
245
|
-
flex: 1 1 0;
|
|
246
|
-
gap: 10px;
|
|
247
|
-
justify-content: flex-start;
|
|
248
|
-
outline-offset: -1px;
|
|
249
|
-
outline: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
250
|
-
overflow: hidden;
|
|
251
|
-
padding: 10px
|
|
252
|
-
}
|
|
253
|
-
.codigma-apiunit-reqresponse {
|
|
254
|
-
align-items: flex-start;
|
|
255
|
-
align-self: stretch;
|
|
256
|
-
background: var(--surface, white);
|
|
257
|
-
border-top: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
258
|
-
display: flex;
|
|
259
|
-
flex-direction: column;
|
|
260
|
-
flex: 1 1 0;
|
|
261
|
-
gap: 10px;
|
|
262
|
-
justify-content: flex-start;
|
|
263
|
-
padding-left: 5px;
|
|
264
|
-
padding-right: 5px
|
|
265
|
-
}
|
|
266
|
-
.codigma-apiunit-responsedesc {
|
|
267
|
-
align-items: center;
|
|
268
|
-
align-self: stretch;
|
|
269
|
-
display: inline-flex;
|
|
270
|
-
justify-content: space-between;
|
|
271
|
-
padding-right: 32px
|
|
272
|
-
}
|
|
273
|
-
.codigma-apiunit-responsetitle {
|
|
274
|
-
align-items: center;
|
|
275
|
-
border-bottom: 1px var(--main-color, var(--primary, #404040)) solid;
|
|
276
|
-
display: flex;
|
|
277
|
-
height: 42px;
|
|
278
|
-
justify-content: space-between;
|
|
279
|
-
width: 122px
|
|
280
|
-
}
|
|
281
|
-
.codigma-apiunit-response-cnr {
|
|
282
|
-
align-items: center;
|
|
283
|
-
align-self: stretch;
|
|
284
|
-
background: var(--surface, white);
|
|
285
|
-
display: flex;
|
|
286
|
-
justify-content: space-between;
|
|
287
|
-
padding-top: 2px;
|
|
288
|
-
width: 122px
|
|
289
|
-
}
|
|
290
|
-
.codigma-apiunit-responsebody {
|
|
291
|
-
position: relative;
|
|
292
|
-
align-self: stretch;
|
|
293
|
-
min-height: 5rem;
|
|
294
|
-
flex-shrink: 0;
|
|
295
|
-
/* padding: 2px */
|
|
296
|
-
}
|
|
297
|
-
.codigma-apiunit-apioperator:hover {
|
|
298
|
-
cursor: pointer;
|
|
299
|
-
color: var(--text, black);
|
|
300
|
-
background-color: var(--hover-bg, rgba(169,199,239,0.08));
|
|
301
|
-
transition: background-color .12s ease, color .12s ease;
|
|
302
|
-
}
|