@t0.labs/daxta 0.4.23 → 0.5.0
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/assets/empty.html +4 -20
- package/assets/example.html +3699 -0
- package/assets/favicon.png +0 -0
- package/assets/favicon.svg +16 -0
- package/assets/logo.png +0 -0
- package/assets/viewer.html +155 -128
- package/dist/build/build-spec.js +5 -2
- package/dist/serve/paths.js +4 -1
- package/package.json +1 -1
package/assets/favicon.png
CHANGED
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
2
|
+
<style>
|
|
3
|
+
.bg { fill: #ffffff; }
|
|
4
|
+
.fg { fill: #111111; }
|
|
5
|
+
.ring { fill: none; stroke: #111111; stroke-width: 1.25; }
|
|
6
|
+
@media (prefers-color-scheme: dark) {
|
|
7
|
+
.bg { fill: #111111; }
|
|
8
|
+
.fg { fill: #ffffff; }
|
|
9
|
+
.ring { stroke: #ffffff; }
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
12
|
+
<rect class="bg" width="32" height="32" rx="7"/>
|
|
13
|
+
<rect class="ring" x="0.6" y="0.6" width="30.8" height="30.8" rx="6.4"/>
|
|
14
|
+
<path class="fg" d="M4.2 5.2 14.2 8.8v4.2A4.2 4.2 0 0 1 14.2 21.4v4L4.2 26.8Z"/>
|
|
15
|
+
<path class="fg" d="M27.8 5.2 17.8 8.8v4.2A4.2 4.2 0 0 0 17.8 21.4v4L27.8 26.8Z"/>
|
|
16
|
+
</svg>
|
package/assets/logo.png
ADDED
|
Binary file
|
package/assets/viewer.html
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>
|
|
7
|
-
<link rel="icon"
|
|
6
|
+
<title>DAxTA</title>
|
|
7
|
+
<link rel="icon" href="__FAVICON_DATA_URI__" />
|
|
8
8
|
<link rel="apple-touch-icon" href="__FAVICON_DATA_URI__" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
10
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
--stone: #666666;
|
|
24
24
|
--charcoal: #333333;
|
|
25
25
|
--obsidian: #111111;
|
|
26
|
-
--accent: #
|
|
27
|
-
--ok: #
|
|
28
|
-
--ok-bg: #
|
|
26
|
+
--accent: #6f7d3c;
|
|
27
|
+
--ok: #15803d;
|
|
28
|
+
--ok-bg: #e8f8ee;
|
|
29
|
+
--get: #16a34a;
|
|
29
30
|
--err: #b42318;
|
|
30
31
|
--err-bg: #fbeaea;
|
|
31
32
|
--sans: Geist, Inter, ui-sans-serif, system-ui, sans-serif;
|
|
@@ -47,10 +48,10 @@
|
|
|
47
48
|
.topnav {
|
|
48
49
|
height: 44px;
|
|
49
50
|
display: grid;
|
|
50
|
-
grid-template-columns: 1fr minmax(
|
|
51
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
|
|
51
52
|
align-items: center;
|
|
52
|
-
gap:
|
|
53
|
-
padding: 0
|
|
53
|
+
gap: 12px;
|
|
54
|
+
padding: 0 14px;
|
|
54
55
|
background: var(--nav);
|
|
55
56
|
border-bottom: 1px solid var(--hairline);
|
|
56
57
|
position: sticky;
|
|
@@ -59,29 +60,25 @@
|
|
|
59
60
|
}
|
|
60
61
|
body.searching .topnav { z-index: 30; }
|
|
61
62
|
.brand-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; justify-self: start; }
|
|
62
|
-
.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
.workspace { display: none; }
|
|
64
|
+
.brand { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--charcoal); }
|
|
65
|
+
.ep-nav {
|
|
66
|
+
justify-self: center;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
max-width: 100%;
|
|
71
72
|
}
|
|
72
|
-
.
|
|
73
|
-
font-size:
|
|
73
|
+
.ep-name {
|
|
74
|
+
font-size: 14px;
|
|
74
75
|
font-weight: 600;
|
|
75
76
|
letter-spacing: -0.02em;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
color: var(--obsidian);
|
|
76
81
|
}
|
|
77
|
-
.nav-divider {
|
|
78
|
-
width: 1px;
|
|
79
|
-
height: 16px;
|
|
80
|
-
background: var(--hairline);
|
|
81
|
-
flex: none;
|
|
82
|
-
}
|
|
83
|
-
.workspace { display: none; }
|
|
84
|
-
.brand { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--charcoal); }
|
|
85
82
|
.ver-select {
|
|
86
83
|
height: 24px;
|
|
87
84
|
border: 1px solid var(--hairline);
|
|
@@ -128,10 +125,11 @@
|
|
|
128
125
|
transform: translateX(-50%) translateY(0);
|
|
129
126
|
}
|
|
130
127
|
.search-wrap {
|
|
131
|
-
justify-self: center;
|
|
132
128
|
position: relative;
|
|
133
129
|
width: 100%;
|
|
130
|
+
flex: none;
|
|
134
131
|
z-index: 30;
|
|
132
|
+
margin-bottom: 8px;
|
|
135
133
|
}
|
|
136
134
|
.search {
|
|
137
135
|
width: 100%;
|
|
@@ -140,8 +138,8 @@
|
|
|
140
138
|
border-radius: var(--radius);
|
|
141
139
|
box-shadow: none;
|
|
142
140
|
background: var(--white);
|
|
143
|
-
padding: 0
|
|
144
|
-
font-size:
|
|
141
|
+
padding: 0 28px 0 10px;
|
|
142
|
+
font-size: 12px;
|
|
145
143
|
}
|
|
146
144
|
.search-kbd {
|
|
147
145
|
position: absolute;
|
|
@@ -376,13 +374,26 @@
|
|
|
376
374
|
.app {
|
|
377
375
|
display: grid;
|
|
378
376
|
grid-template-columns: var(--sidebar-w, 320px) 6px minmax(0, 1fr);
|
|
377
|
+
grid-template-rows: minmax(0, 1fr) auto;
|
|
379
378
|
height: calc(100vh - 44px);
|
|
380
379
|
}
|
|
381
380
|
.app.sidebar-collapsed {
|
|
382
381
|
grid-template-columns: 0 28px minmax(0, 1fr);
|
|
383
382
|
}
|
|
384
|
-
.sidebar
|
|
385
|
-
|
|
383
|
+
.sidebar {
|
|
384
|
+
grid-row: 1 / -1;
|
|
385
|
+
}
|
|
386
|
+
.sidebar-resizer {
|
|
387
|
+
grid-row: 1 / -1;
|
|
388
|
+
}
|
|
389
|
+
.workbench {
|
|
390
|
+
grid-column: 3;
|
|
391
|
+
grid-row: 1;
|
|
392
|
+
min-height: 0;
|
|
393
|
+
overflow: auto;
|
|
394
|
+
padding: 14px 18px 16px;
|
|
395
|
+
background: var(--paper);
|
|
396
|
+
}
|
|
386
397
|
.sidebar {
|
|
387
398
|
position: relative;
|
|
388
399
|
min-width: 0;
|
|
@@ -415,14 +426,13 @@
|
|
|
415
426
|
.tree-scroll { flex: 1; min-height: 0; overflow: auto; }
|
|
416
427
|
.nav-foot {
|
|
417
428
|
flex: none;
|
|
418
|
-
margin-top:
|
|
419
|
-
padding: 8px;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
429
|
+
margin-top: 8px;
|
|
430
|
+
padding: 8px 2px 0;
|
|
431
|
+
display: flex;
|
|
432
|
+
justify-content: space-between;
|
|
433
|
+
gap: 8px;
|
|
423
434
|
font-size: 11px;
|
|
424
|
-
color: var(--
|
|
425
|
-
line-height: 1.35;
|
|
435
|
+
color: var(--smoke);
|
|
426
436
|
}
|
|
427
437
|
.sidebar-resizer {
|
|
428
438
|
position: relative;
|
|
@@ -778,59 +788,62 @@
|
|
|
778
788
|
letter-spacing: 0.04em;
|
|
779
789
|
text-transform: uppercase;
|
|
780
790
|
box-shadow: none;
|
|
781
|
-
|
|
782
|
-
|
|
791
|
+
border: 0;
|
|
792
|
+
background: #e4e4e7;
|
|
793
|
+
color: #27272a;
|
|
794
|
+
}
|
|
795
|
+
.method.get { background: #f4f4f5; color: #52525b; }
|
|
796
|
+
.method.patch { background: #d4d4d8; color: #18181b; }
|
|
797
|
+
.method.put { background: #a1a1aa; color: #fafafa; }
|
|
798
|
+
.method.post { background: #3f3f46; color: #fafafa; }
|
|
799
|
+
.method.delete { background: #111111; color: #ffffff; }
|
|
800
|
+
.schema-block {
|
|
801
|
+
padding: 10px 12px 12px;
|
|
802
|
+
border-top: 1px solid var(--hairline);
|
|
783
803
|
}
|
|
784
|
-
.
|
|
785
|
-
.method.delete { background: var(--white); color: var(--charcoal); border: 1px solid var(--hairline); }
|
|
804
|
+
.schema-block .meta-label { margin-bottom: 8px; display: block; }
|
|
786
805
|
|
|
787
|
-
.
|
|
788
|
-
.
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
.meta-line {
|
|
797
|
-
display: flex;
|
|
798
|
-
align-items: center;
|
|
799
|
-
gap: 8px;
|
|
800
|
-
color: var(--stone);
|
|
801
|
-
font: 12px/1.4 var(--mono);
|
|
802
|
-
margin: 8px 0 0;
|
|
803
|
-
}
|
|
804
|
-
.open-editor {
|
|
805
|
-
height: 28px;
|
|
806
|
-
font-size: 12px;
|
|
806
|
+
.ex-block { margin: 0; position: relative; }
|
|
807
|
+
.ex-dock {
|
|
808
|
+
grid-column: 3;
|
|
809
|
+
grid-row: 2;
|
|
810
|
+
position: relative;
|
|
811
|
+
z-index: 100;
|
|
812
|
+
padding: 8px 16px 10px;
|
|
813
|
+
background: var(--white);
|
|
814
|
+
border-top: 1px solid var(--hairline);
|
|
807
815
|
}
|
|
808
|
-
|
|
809
|
-
.ex-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
text-transform: uppercase;
|
|
814
|
-
color: var(--stone);
|
|
815
|
-
margin-bottom: 6px;
|
|
816
|
+
.ex-dock:empty { display: none; }
|
|
817
|
+
.ex-dock .dd-menu {
|
|
818
|
+
top: auto;
|
|
819
|
+
bottom: calc(100% + 4px);
|
|
820
|
+
max-height: min(380px, 45vh);
|
|
816
821
|
}
|
|
817
822
|
.dd { position: relative; width: 100%; }
|
|
818
823
|
.dd-toggle {
|
|
819
824
|
width: 100%;
|
|
820
|
-
|
|
825
|
+
height: 28px;
|
|
826
|
+
min-height: 28px;
|
|
821
827
|
border: 1px solid var(--hairline);
|
|
822
828
|
border-radius: var(--radius);
|
|
823
829
|
box-shadow: none;
|
|
824
830
|
background: var(--white);
|
|
825
|
-
padding:
|
|
831
|
+
padding: 0 28px 0 8px;
|
|
826
832
|
text-align: left;
|
|
827
833
|
cursor: pointer;
|
|
828
|
-
font-size:
|
|
829
|
-
line-height: 1
|
|
834
|
+
font-size: 12px;
|
|
835
|
+
line-height: 1;
|
|
830
836
|
position: relative;
|
|
831
837
|
display: flex;
|
|
832
838
|
align-items: center;
|
|
833
|
-
gap:
|
|
839
|
+
gap: 8px;
|
|
840
|
+
}
|
|
841
|
+
.dd-kicker {
|
|
842
|
+
font: 600 10px/1 var(--mono);
|
|
843
|
+
letter-spacing: 0.06em;
|
|
844
|
+
text-transform: uppercase;
|
|
845
|
+
color: var(--stone);
|
|
846
|
+
flex: none;
|
|
834
847
|
}
|
|
835
848
|
.dd-status {
|
|
836
849
|
font: 600 11px/1 var(--mono);
|
|
@@ -852,10 +865,10 @@
|
|
|
852
865
|
.dd-toggle::after {
|
|
853
866
|
content: "";
|
|
854
867
|
position: absolute;
|
|
855
|
-
right:
|
|
868
|
+
right: 10px;
|
|
856
869
|
top: 50%;
|
|
857
|
-
width:
|
|
858
|
-
height:
|
|
870
|
+
width: 5px;
|
|
871
|
+
height: 5px;
|
|
859
872
|
border-right: 1px solid var(--obsidian);
|
|
860
873
|
border-bottom: 1px solid var(--obsidian);
|
|
861
874
|
transform: translateY(-70%) rotate(45deg);
|
|
@@ -967,6 +980,7 @@
|
|
|
967
980
|
color: var(--charcoal);
|
|
968
981
|
white-space: nowrap;
|
|
969
982
|
font-size: 12px;
|
|
983
|
+
text-decoration: none;
|
|
970
984
|
}
|
|
971
985
|
.btn:hover { color: var(--obsidian); }
|
|
972
986
|
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; }
|
|
@@ -1131,7 +1145,7 @@
|
|
|
1131
1145
|
font: 12px/1.5 var(--mono);
|
|
1132
1146
|
}
|
|
1133
1147
|
.k { color: #111111; }
|
|
1134
|
-
.s { color:
|
|
1148
|
+
.s { color: var(--accent); }
|
|
1135
1149
|
.n { color: #111111; }
|
|
1136
1150
|
.p { color: #666666; }
|
|
1137
1151
|
.empty { color: var(--stone); font-size: 13px; padding: 14px 16px; }
|
|
@@ -1205,12 +1219,16 @@
|
|
|
1205
1219
|
@media (max-width: 960px) {
|
|
1206
1220
|
.app {
|
|
1207
1221
|
grid-template-columns: 1fr;
|
|
1222
|
+
grid-template-rows: auto 1fr auto;
|
|
1208
1223
|
height: auto;
|
|
1224
|
+
min-height: calc(100vh - 44px);
|
|
1209
1225
|
}
|
|
1210
1226
|
.app.sidebar-collapsed {
|
|
1211
1227
|
grid-template-columns: 1fr;
|
|
1212
1228
|
}
|
|
1229
|
+
.sidebar, .workbench, .ex-dock { grid-column: 1; grid-row: auto; }
|
|
1213
1230
|
.sidebar { max-height: 40vh; opacity: 1 !important; pointer-events: auto !important; padding: 16px 12px 24px !important; }
|
|
1231
|
+
.ex-dock { position: sticky; bottom: 0; }
|
|
1214
1232
|
.sidebar-resizer { display: none; }
|
|
1215
1233
|
.pair, .schemas { grid-template-columns: 1fr; }
|
|
1216
1234
|
.search-wrap { width: min(280px, 70vw); }
|
|
@@ -1220,16 +1238,11 @@
|
|
|
1220
1238
|
<body>
|
|
1221
1239
|
<header class="topnav">
|
|
1222
1240
|
<div class="brand-wrap">
|
|
1223
|
-
<span class="logo-mark">N</span>
|
|
1224
|
-
<span class="logo-name">Notary</span>
|
|
1225
|
-
<span class="nav-divider"></span>
|
|
1226
1241
|
<div class="brand" id="brand">API</div>
|
|
1227
1242
|
<select class="ver-select" id="ver-select" aria-label="API version"></select>
|
|
1228
1243
|
</div>
|
|
1229
|
-
<div class="
|
|
1230
|
-
<
|
|
1231
|
-
<span class="search-kbd">⌘K</span>
|
|
1232
|
-
<div class="search-panel" id="search-panel" role="listbox"></div>
|
|
1244
|
+
<div class="ep-nav" id="ep-nav">
|
|
1245
|
+
<span class="ep-name" id="ep-name"></span>
|
|
1233
1246
|
</div>
|
|
1234
1247
|
<div class="nav-tools">
|
|
1235
1248
|
<button class="btn icon" id="export-openapi" type="button" data-tip="Export" aria-label="Export">
|
|
@@ -1268,9 +1281,18 @@
|
|
|
1268
1281
|
</div>
|
|
1269
1282
|
</div>
|
|
1270
1283
|
<div class="app" id="app">
|
|
1271
|
-
<aside class="sidebar"
|
|
1284
|
+
<aside class="sidebar">
|
|
1285
|
+
<div class="search-wrap" id="search-wrap">
|
|
1286
|
+
<input class="search" id="search" placeholder="Search endpoints..." autocomplete="off" spellcheck="false" />
|
|
1287
|
+
<span class="search-kbd">/</span>
|
|
1288
|
+
<div class="search-panel" id="search-panel" role="listbox"></div>
|
|
1289
|
+
</div>
|
|
1290
|
+
<div class="tree-scroll" id="nav"></div>
|
|
1291
|
+
<div class="nav-foot"><span>Generated by DAxTA</span><span id="nav-version"></span></div>
|
|
1292
|
+
</aside>
|
|
1272
1293
|
<button type="button" class="sidebar-resizer" id="sidebar-resizer" aria-label="Resize sidebar" title="Drag to resize · double-click to collapse"></button>
|
|
1273
1294
|
<main class="workbench" id="main"></main>
|
|
1295
|
+
<div class="ex-dock" id="ex-dock"></div>
|
|
1274
1296
|
</div>
|
|
1275
1297
|
<script>
|
|
1276
1298
|
window.__SPEC__ = __SPEC_JSON__;
|
|
@@ -2034,8 +2056,12 @@
|
|
|
2034
2056
|
};
|
|
2035
2057
|
};
|
|
2036
2058
|
|
|
2037
|
-
document.title = "
|
|
2038
|
-
document.getElementById("brand")
|
|
2059
|
+
document.title = title ? "DAxTA · " + title : "DAxTA";
|
|
2060
|
+
const brandEl = document.getElementById("brand");
|
|
2061
|
+
if (brandEl) brandEl.textContent = title;
|
|
2062
|
+
const specVersion = (spec.info && spec.info.version) || "";
|
|
2063
|
+
const navVersion = document.getElementById("nav-version");
|
|
2064
|
+
if (navVersion) navVersion.textContent = specVersion ? (specVersion.startsWith("v") ? specVersion : "v" + specVersion) : "";
|
|
2039
2065
|
|
|
2040
2066
|
const envWrap = document.getElementById("env-wrap");
|
|
2041
2067
|
document.getElementById("env-trigger").addEventListener("click", (event) => {
|
|
@@ -2774,6 +2800,7 @@
|
|
|
2774
2800
|
const ok = current ? statusOk(current.status) : false;
|
|
2775
2801
|
return `<div class="dd ${exampleOpen ? "open" : ""}" id="scenario-dd">
|
|
2776
2802
|
<button type="button" class="dd-toggle" id="scenario-toggle">
|
|
2803
|
+
<span class="dd-kicker">Example</span>
|
|
2777
2804
|
<span class="dd-status ${ok ? "ok" : "err"}">${escapeHtml(String(current?.status ?? ""))}</span>
|
|
2778
2805
|
<span class="dd-kind">${escapeHtml(kind)}</span>
|
|
2779
2806
|
<span class="dd-toggle-label">${escapeHtml(current?.name || "Example")}</span>
|
|
@@ -2933,6 +2960,7 @@
|
|
|
2933
2960
|
|
|
2934
2961
|
const renderNav = () => {
|
|
2935
2962
|
const nav = document.getElementById("nav");
|
|
2963
|
+
const q = navQuery.trim().toLowerCase();
|
|
2936
2964
|
if (!ops.length) {
|
|
2937
2965
|
nav.innerHTML = `<div class="tree-empty">No endpoints recorded</div>`;
|
|
2938
2966
|
return;
|
|
@@ -2941,22 +2969,7 @@
|
|
|
2941
2969
|
const active = ops.find((item) => item.id === currentId);
|
|
2942
2970
|
if (active) expandPathToItem(active);
|
|
2943
2971
|
}
|
|
2944
|
-
|
|
2945
|
-
nav.innerHTML = `
|
|
2946
|
-
<input class="nav-filter" id="nav-filter" placeholder="Search endpoints..." value="${escapeAttr(navQuery)}" autocomplete="off" spellcheck="false" />
|
|
2947
|
-
<div class="tree-scroll"><div class="tree-root">${renderTreeNode(buildPathTree(visibleOps()), "", q)}</div></div>
|
|
2948
|
-
<div class="nav-foot">Generated by Notary</div>
|
|
2949
|
-
`;
|
|
2950
|
-
const filter = document.getElementById("nav-filter");
|
|
2951
|
-
if (filter) {
|
|
2952
|
-
filter.oninput = (event) => {
|
|
2953
|
-
navQuery = event.target.value;
|
|
2954
|
-
renderNav();
|
|
2955
|
-
document.getElementById("nav-filter")?.focus();
|
|
2956
|
-
const el = document.getElementById("nav-filter");
|
|
2957
|
-
if (el) el.selectionStart = el.selectionEnd = el.value.length;
|
|
2958
|
-
};
|
|
2959
|
-
}
|
|
2972
|
+
nav.innerHTML = `<div class="tree-root">${renderTreeNode(buildPathTree(visibleOps()), "", q)}</div>`;
|
|
2960
2973
|
nav.querySelectorAll(".nav-item").forEach((button) => {
|
|
2961
2974
|
button.onclick = () => select(button.dataset.id);
|
|
2962
2975
|
});
|
|
@@ -3041,7 +3054,11 @@
|
|
|
3041
3054
|
wrap.classList.remove("open");
|
|
3042
3055
|
document.body.classList.remove("searching");
|
|
3043
3056
|
searchActiveIndex = 0;
|
|
3044
|
-
if (clear)
|
|
3057
|
+
if (clear) {
|
|
3058
|
+
input.value = "";
|
|
3059
|
+
navQuery = "";
|
|
3060
|
+
renderNav();
|
|
3061
|
+
}
|
|
3045
3062
|
};
|
|
3046
3063
|
|
|
3047
3064
|
const openSearch = () => {
|
|
@@ -3051,6 +3068,8 @@
|
|
|
3051
3068
|
|
|
3052
3069
|
const renderSearchPanel = (query = "") => {
|
|
3053
3070
|
const q = query.trim().toLowerCase();
|
|
3071
|
+
navQuery = query;
|
|
3072
|
+
renderNav();
|
|
3054
3073
|
const panel = document.getElementById("search-panel");
|
|
3055
3074
|
if (!q) {
|
|
3056
3075
|
closeSearch();
|
|
@@ -3147,25 +3166,23 @@
|
|
|
3147
3166
|
.join("");
|
|
3148
3167
|
};
|
|
3149
3168
|
|
|
3150
|
-
const
|
|
3169
|
+
const schemasInline = (fields, resBody) => {
|
|
3151
3170
|
const requestFields = fields.filter((field) => field.in === "body" || field.in === "path" || field.in === "query" || field.in === "header");
|
|
3152
3171
|
const responseFields = schemaFromValue(resBody);
|
|
3153
|
-
return
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
</section>
|
|
3158
|
-
<section>
|
|
3159
|
-
<h2>Response schema</h2>
|
|
3160
|
-
${schemaRows(responseFields)}
|
|
3161
|
-
</section>
|
|
3162
|
-
</div>`;
|
|
3172
|
+
return {
|
|
3173
|
+
request: `<div class="schema-block"><span class="meta-label">Request schema</span>${schemaRows(requestFields, { showLoc: true })}</div>`,
|
|
3174
|
+
response: `<div class="schema-block"><span class="meta-label">Response schema</span>${schemaRows(responseFields)}</div>`,
|
|
3175
|
+
};
|
|
3163
3176
|
};
|
|
3164
3177
|
|
|
3165
3178
|
const renderMain = () => {
|
|
3166
3179
|
const item = ops.find((entry) => entry.id === currentId);
|
|
3167
3180
|
if (!item) {
|
|
3168
3181
|
document.getElementById("main").innerHTML = `<div class="empty">No operations in this workspace yet.</div>`;
|
|
3182
|
+
const dock = document.getElementById("ex-dock");
|
|
3183
|
+
if (dock) dock.innerHTML = "";
|
|
3184
|
+
const epName = document.getElementById("ep-name");
|
|
3185
|
+
if (epName) epName.textContent = "";
|
|
3169
3186
|
return;
|
|
3170
3187
|
}
|
|
3171
3188
|
if (scenarioIndex >= item.scenarios.length) scenarioIndex = 0;
|
|
@@ -3209,14 +3226,12 @@
|
|
|
3209
3226
|
? `<div class="empty">Empty body</div>`
|
|
3210
3227
|
: jsonBlock(displayBody, resPretty);
|
|
3211
3228
|
|
|
3229
|
+
const schemas = schemasInline(fields, displayEmpty ? undefined : displayBody);
|
|
3230
|
+
const epName = document.getElementById("ep-name");
|
|
3231
|
+
if (epName) epName.textContent = item.title;
|
|
3232
|
+
document.title = item.title + (title ? " · " + title : "");
|
|
3233
|
+
|
|
3212
3234
|
document.getElementById("main").innerHTML = `
|
|
3213
|
-
<div class="ep-head">
|
|
3214
|
-
<div class="ep-head-top">
|
|
3215
|
-
<h1 class="title">${item.title}</h1>
|
|
3216
|
-
</div>
|
|
3217
|
-
<p class="meta-line"><span class="method ${item.method}">${item.method}</span><span>${item.path}</span></p>
|
|
3218
|
-
</div>
|
|
3219
|
-
${item.scenarios.length ? `<div class="ex-block"><div class="ex-kicker">Example</div>${groupedDropdown(item.scenarios, scenarioIndex)}</div>` : ""}
|
|
3220
3235
|
<div class="urlbar">
|
|
3221
3236
|
<div class="url"><span class="method ${item.method}">${item.method}</span><span>${resolvedUrl(item, scenario)}</span></div>
|
|
3222
3237
|
<button class="btn" id="copy-curl" type="button">Copy cURL</button>
|
|
@@ -3239,6 +3254,7 @@
|
|
|
3239
3254
|
${metaBlock("Path", pathParamsHtml)}
|
|
3240
3255
|
${metaBlock("Query", queryHtml)}
|
|
3241
3256
|
${metaBlock("Body", bodyHtml, "", { always: true })}
|
|
3257
|
+
${schemas.request}
|
|
3242
3258
|
</div>
|
|
3243
3259
|
</section>
|
|
3244
3260
|
<section class="card response-card" id="response-card">
|
|
@@ -3257,13 +3273,17 @@
|
|
|
3257
3273
|
<button class="btn sm icon" id="copy-res" type="button" title="Copy body" aria-label="Copy body" ${resCopyText ? "" : "disabled"}>${copyIcon}</button>
|
|
3258
3274
|
</div>
|
|
3259
3275
|
</div>
|
|
3260
|
-
<div class="card-body"
|
|
3276
|
+
<div class="card-body">
|
|
3277
|
+
<div id="response-body">${resHtml}</div>
|
|
3278
|
+
${schemas.response}
|
|
3279
|
+
</div>
|
|
3261
3280
|
</section>
|
|
3262
3281
|
</div>
|
|
3263
|
-
${schemasPanel(fields, displayEmpty ? undefined : displayBody)}
|
|
3264
|
-
<div class="work-foot">Generated by Notary</div>
|
|
3265
3282
|
`;
|
|
3266
3283
|
|
|
3284
|
+
const dock = document.getElementById("ex-dock");
|
|
3285
|
+
if (dock) dock.innerHTML = item.scenarios.length ? groupedDropdown(item.scenarios, scenarioIndex) : "";
|
|
3286
|
+
|
|
3267
3287
|
const scenarioToggle = document.getElementById("scenario-toggle");
|
|
3268
3288
|
if (scenarioToggle) {
|
|
3269
3289
|
const root = document.getElementById("scenario-dd");
|
|
@@ -3433,6 +3453,13 @@
|
|
|
3433
3453
|
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
|
|
3434
3454
|
event.preventDefault();
|
|
3435
3455
|
document.getElementById("search")?.focus();
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
if (event.key === "/" && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
|
3459
|
+
const tag = (event.target && event.target.tagName) || "";
|
|
3460
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || event.target?.isContentEditable) return;
|
|
3461
|
+
event.preventDefault();
|
|
3462
|
+
document.getElementById("search")?.focus();
|
|
3436
3463
|
}
|
|
3437
3464
|
});
|
|
3438
3465
|
|
package/dist/build/build-spec.js
CHANGED
|
@@ -720,8 +720,11 @@ function countOperations(spec) {
|
|
|
720
720
|
}
|
|
721
721
|
function toStandaloneHtml(spec) {
|
|
722
722
|
const template = (0, fs_1.readFileSync)((0, paths_1.getViewerAssetPath)(), 'utf8');
|
|
723
|
-
const
|
|
724
|
-
|
|
723
|
+
const faviconPath = (0, paths_1.getFaviconAssetPath)();
|
|
724
|
+
const faviconUri = (0, fs_1.existsSync)(faviconPath)
|
|
725
|
+
? faviconPath.endsWith('.svg')
|
|
726
|
+
? `data:image/svg+xml;base64,${(0, fs_1.readFileSync)(faviconPath).toString('base64')}`
|
|
727
|
+
: `data:image/png;base64,${(0, fs_1.readFileSync)(faviconPath).toString('base64')}`
|
|
725
728
|
: '';
|
|
726
729
|
return template
|
|
727
730
|
.replace('__SPEC_JSON__', JSON.stringify(spec).replace(/</g, '\\u003c'))
|
package/dist/serve/paths.js
CHANGED
|
@@ -68,7 +68,7 @@ function getViewerAssetPath() {
|
|
|
68
68
|
function getEmptyViewerAssetPath() {
|
|
69
69
|
return path.join(__dirname, '..', '..', 'assets', 'empty.html');
|
|
70
70
|
}
|
|
71
|
-
const EMPTY_DOCS_FALLBACK = `<!doctype html><html lang="en"><head><meta charset="utf-8"/><title>
|
|
71
|
+
const EMPTY_DOCS_FALLBACK = `<!doctype html><html lang="en"><head><meta charset="utf-8"/><title>DAxTA</title></head><body style="font:13px/1.45 system-ui;background:#fafafa;color:#111;margin:0;padding:48px 24px">
|
|
72
72
|
<p style="font:600 10px/1 ui-monospace,monospace;letter-spacing:.08em;text-transform:uppercase;color:#666">Waiting</p>
|
|
73
73
|
<h1 style="font-size:22px;letter-spacing:-.04em">No documentation yet</h1>
|
|
74
74
|
<p>Run your integration tests, then refresh this page.</p>
|
|
@@ -80,6 +80,9 @@ function readEmptyDocsHtml() {
|
|
|
80
80
|
return Buffer.from(EMPTY_DOCS_FALLBACK);
|
|
81
81
|
}
|
|
82
82
|
function getFaviconAssetPath() {
|
|
83
|
+
const svg = path.join(__dirname, '..', '..', 'assets', 'favicon.svg');
|
|
84
|
+
if ((0, fs_1.existsSync)(svg))
|
|
85
|
+
return svg;
|
|
83
86
|
return path.join(__dirname, '..', '..', 'assets', 'favicon.png');
|
|
84
87
|
}
|
|
85
88
|
function getDocsBasePath() {
|