@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.mjs CHANGED
@@ -622,6 +622,15 @@ body {
622
622
  font-weight: 700;
623
623
  margin-right: 4px;
624
624
  }
625
+ .schema-indent {
626
+ display: inline-block;
627
+ }
628
+
629
+ .schema-branch {
630
+ opacity: 0.6;
631
+ font-family: var(--font-mono);
632
+ margin-right: 2px;
633
+ }
625
634
 
626
635
  /* Chips/Pills */
627
636
  .pill-checkbox { cursor: pointer; user-select: none; }
@@ -1156,12 +1165,14 @@ var DOCS_JS = `
1156
1165
  );
1157
1166
  }
1158
1167
 
1168
+ // Recursive schema renderer with proper depth-based indentation.
1159
1169
 
1160
1170
  function renderSchemaTable(node, title) {
1161
1171
  let rows = '';
1162
1172
 
1163
1173
  if (node.kind === 'object' && node.properties) {
1164
- rows = renderObjectChildren(node, 0);
1174
+ // Start at depth -1 so first level of properties shows at depth 0
1175
+ rows = renderObjectChildren(node, -1);
1165
1176
  } else {
1166
1177
  rows = renderNodeRow('(root)', node, 0);
1167
1178
  }
@@ -1176,27 +1187,21 @@ function renderSchemaTable(node, title) {
1176
1187
  );
1177
1188
  }
1178
1189
 
1179
- /**
1180
- * Render all children of an object node (at a given depth).
1181
- */
1182
1190
  function renderObjectChildren(node, depth) {
1183
1191
  if (!node.properties) return '';
1184
1192
 
1185
1193
  let rows = '';
1186
1194
  Object.keys(node.properties).forEach(function (key) {
1187
- rows += renderNodeRow(key, node.properties[key], depth);
1195
+ rows += renderNodeRow(key, node.properties[key], depth + 1);
1188
1196
  });
1189
1197
  return rows;
1190
1198
  }
1191
1199
 
1192
- /**
1193
- * Render a single row for a property / node, then recursively render nested structure.
1194
- */
1195
1200
  function renderNodeRow(name, node, depth) {
1196
1201
  const reqClass = node.optional ? 'req-false' : 'req-true';
1197
1202
  const reqText = node.optional ? 'OPT' : 'REQ';
1198
1203
 
1199
- const indentPx = depth * 16;
1204
+ const indentPx = depth * 16; // increase this if you want more spacing per level
1200
1205
  const nameCell =
1201
1206
  '<span class="schema-indent" style="padding-left:' +
1202
1207
  indentPx +
@@ -1217,13 +1222,14 @@ function renderNodeRow(name, node, depth) {
1217
1222
 
1218
1223
  // 1) Object properties
1219
1224
  if (node.kind === 'object' && node.properties) {
1220
- rows += renderObjectChildren(node, depth + 1);
1225
+ rows += renderObjectChildren(node, depth);
1221
1226
  }
1222
1227
 
1223
1228
  // 2) Array element type
1224
1229
  if (node.kind === 'array' && node.element) {
1225
1230
  const element = node.element;
1226
1231
  if (isComplexNode(element)) {
1232
+ // element rendered one level deeper than the array itself
1227
1233
  rows += renderNodeRow('[items]', element, depth + 1);
1228
1234
  }
1229
1235
  }
@@ -1361,6 +1367,7 @@ function escapeHtml(str) {
1361
1367
  .replace(/'/g, '&#39;');
1362
1368
  }
1363
1369
 
1370
+
1364
1371
  function getTypeLabel(node) {
1365
1372
  if (!node) return 'any';
1366
1373
  if (node.kind === 'array') return getTypeLabel(node.element) + '[]';