@emeryld/rrroutes-contract 2.2.4 → 2.2.6
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/dist/index.cjs +17 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +17 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -668,6 +668,15 @@ body {
|
|
|
668
668
|
font-weight: 700;
|
|
669
669
|
margin-right: 4px;
|
|
670
670
|
}
|
|
671
|
+
.schema-indent {
|
|
672
|
+
display: inline-block;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
.schema-branch {
|
|
676
|
+
opacity: 0.6;
|
|
677
|
+
font-family: var(--font-mono);
|
|
678
|
+
margin-right: 2px;
|
|
679
|
+
}
|
|
671
680
|
|
|
672
681
|
/* Chips/Pills */
|
|
673
682
|
.pill-checkbox { cursor: pointer; user-select: none; }
|
|
@@ -1202,12 +1211,14 @@ var DOCS_JS = `
|
|
|
1202
1211
|
);
|
|
1203
1212
|
}
|
|
1204
1213
|
|
|
1214
|
+
// Recursive schema renderer with proper depth-based indentation.
|
|
1205
1215
|
|
|
1206
1216
|
function renderSchemaTable(node, title) {
|
|
1207
1217
|
let rows = '';
|
|
1208
1218
|
|
|
1209
1219
|
if (node.kind === 'object' && node.properties) {
|
|
1210
|
-
|
|
1220
|
+
// Start at depth -1 so first level of properties shows at depth 0
|
|
1221
|
+
rows = renderObjectChildren(node, -1);
|
|
1211
1222
|
} else {
|
|
1212
1223
|
rows = renderNodeRow('(root)', node, 0);
|
|
1213
1224
|
}
|
|
@@ -1222,27 +1233,21 @@ function renderSchemaTable(node, title) {
|
|
|
1222
1233
|
);
|
|
1223
1234
|
}
|
|
1224
1235
|
|
|
1225
|
-
/**
|
|
1226
|
-
* Render all children of an object node (at a given depth).
|
|
1227
|
-
*/
|
|
1228
1236
|
function renderObjectChildren(node, depth) {
|
|
1229
1237
|
if (!node.properties) return '';
|
|
1230
1238
|
|
|
1231
1239
|
let rows = '';
|
|
1232
1240
|
Object.keys(node.properties).forEach(function (key) {
|
|
1233
|
-
rows += renderNodeRow(key, node.properties[key], depth);
|
|
1241
|
+
rows += renderNodeRow(key, node.properties[key], depth + 1);
|
|
1234
1242
|
});
|
|
1235
1243
|
return rows;
|
|
1236
1244
|
}
|
|
1237
1245
|
|
|
1238
|
-
/**
|
|
1239
|
-
* Render a single row for a property / node, then recursively render nested structure.
|
|
1240
|
-
*/
|
|
1241
1246
|
function renderNodeRow(name, node, depth) {
|
|
1242
1247
|
const reqClass = node.optional ? 'req-false' : 'req-true';
|
|
1243
1248
|
const reqText = node.optional ? 'OPT' : 'REQ';
|
|
1244
1249
|
|
|
1245
|
-
const indentPx = depth * 16;
|
|
1250
|
+
const indentPx = depth * 16; // increase this if you want more spacing per level
|
|
1246
1251
|
const nameCell =
|
|
1247
1252
|
'<span class="schema-indent" style="padding-left:' +
|
|
1248
1253
|
indentPx +
|
|
@@ -1263,13 +1268,14 @@ function renderNodeRow(name, node, depth) {
|
|
|
1263
1268
|
|
|
1264
1269
|
// 1) Object properties
|
|
1265
1270
|
if (node.kind === 'object' && node.properties) {
|
|
1266
|
-
rows += renderObjectChildren(node, depth
|
|
1271
|
+
rows += renderObjectChildren(node, depth);
|
|
1267
1272
|
}
|
|
1268
1273
|
|
|
1269
1274
|
// 2) Array element type
|
|
1270
1275
|
if (node.kind === 'array' && node.element) {
|
|
1271
1276
|
const element = node.element;
|
|
1272
1277
|
if (isComplexNode(element)) {
|
|
1278
|
+
// element rendered one level deeper than the array itself
|
|
1273
1279
|
rows += renderNodeRow('[items]', element, depth + 1);
|
|
1274
1280
|
}
|
|
1275
1281
|
}
|
|
@@ -1407,6 +1413,7 @@ function escapeHtml(str) {
|
|
|
1407
1413
|
.replace(/'/g, ''');
|
|
1408
1414
|
}
|
|
1409
1415
|
|
|
1416
|
+
|
|
1410
1417
|
function getTypeLabel(node) {
|
|
1411
1418
|
if (!node) return 'any';
|
|
1412
1419
|
if (node.kind === 'array') return getTypeLabel(node.element) + '[]';
|