diff --git a/docs/_includes/doi-template/tabs.html b/docs/_includes/doi-template/tabs.html index eb70a48b..da97ab81 100644 --- a/docs/_includes/doi-template/tabs.html +++ b/docs/_includes/doi-template/tabs.html @@ -6,7 +6,16 @@
{% assign deprecated_items = page.deprecated_items | strip %}
-

Schema

+
+

Schema

+
+
+ Types: + Text field + Allowable value + Radio + Numeric +
{{ page.schema_items | strip | markdownify }}
diff --git a/docs/css/doi-template.css b/docs/css/doi-template.css index e38b21d6..f2731036 100644 --- a/docs/css/doi-template.css +++ b/docs/css/doi-template.css @@ -378,6 +378,25 @@ h1 { margin-top: 22px; } +.schema-heading { + display: block; +} + +.schema-type-legend { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 5px 14px; + margin: 0 0 8px; + color: #4c566a; + font-size: 12px; +} + +.schema-type-legend i { + width: 14px; + text-align: center; +} + .schema-section, .deprecated-section { margin-top: 0; diff --git a/docs/css/hm-code.css b/docs/css/hm-code.css index 589619a6..2fa7b721 100644 --- a/docs/css/hm-code.css +++ b/docs/css/hm-code.css @@ -34,6 +34,13 @@ pre code { max-width: 95% !important; } +/* Keep assay names comfortably readable on the metadata index. */ +.assay-metadata-index th:first-child, +.assay-metadata-index td:first-child { + width: 24%; + min-width: 13rem; +} + /* inline code badges inside table cells */ .altStyle .requiredNote { font-size: 0.75rem; @@ -47,6 +54,45 @@ pre code { padding-bottom: 0; } +.schema-type-legend { + width: fit-content; + margin: 0 0 0.65rem auto; + font-size: 0.75rem; + color: #444a65; +} + +.schema-type-legend summary { + cursor: pointer; + font-weight: 600; + margin: 0; + padding: 0; + background: transparent; + color: #2a6fb8; +} + +.schema-type-legend ul { + display: flex; + flex-wrap: wrap; + gap: 0.4rem 1rem; + margin: 0.45rem 0 0; + padding: 0.55rem 0.7rem; + list-style: none; + border: 1px solid #c4c8dc; + border-radius: 4px; + background: #f7f8fc; +} + +.schema-type-legend li { + display: inline-flex; + align-items: center; + gap: 0.35rem; +} + +.schema-type-legend .fa-solid { + width: 1rem; + text-align: center; +} + .altStyle table thead th { background: linear-gradient(rgb(88, 94, 122), rgb(68, 74, 101)) !important; color: #fff; @@ -262,4 +308,4 @@ table.hmTable { .c-header__main { max-width: 87% !important; } -} \ No newline at end of file +} diff --git a/docs/js/alt-collapse.js b/docs/js/alt-collapse.js index dea1baef..d625b3dd 100644 --- a/docs/js/alt-collapse.js +++ b/docs/js/alt-collapse.js @@ -23,6 +23,45 @@ return (text || '').replace(/\s+/g, ' ').trim(); } + function setupSchemaTypeLegend() { + var firstTable = document.querySelector('.altStyle table'); + if (!firstTable || !firstTable.querySelector('td:nth-child(2) .fa-solid')) return; + if (document.querySelector('.schema-type-legend')) return; + + var schemaTypes = [ + { icon: 'fa-font', label: 'Text field' }, + { icon: 'fa-hashtag', label: 'Numeric' }, + { icon: 'fa-circle-nodes', label: 'Allowable value' }, + { icon: 'fa-calendar', label: 'Date/time' }, + { icon: 'fa-circle-dot', label: 'Radio' } + ]; + var typesOnPage = schemaTypes.filter(function(type) { + return document.querySelector('.altStyle table td:nth-child(2) .' + type.icon); + }); + + var legend = document.createElement('details'); + legend.className = 'schema-type-legend'; + + var summary = document.createElement('summary'); + summary.textContent = 'Schema type legend'; + legend.appendChild(summary); + + var list = document.createElement('ul'); + list.setAttribute('aria-label', 'Schema types'); + typesOnPage.forEach(function(type) { + var item = document.createElement('li'); + var icon = document.createElement('i'); + icon.className = 'fa-solid ' + type.icon; + icon.setAttribute('aria-hidden', 'true'); + item.appendChild(icon); + item.appendChild(document.createTextNode(type.label)); + list.appendChild(item); + }); + legend.appendChild(list); + + firstTable.parentNode.insertBefore(legend, firstTable); + } + function getUsableCellWidth(cell, extraPx) { var rect = cell.getBoundingClientRect(); var cs = window.getComputedStyle(cell); @@ -360,6 +399,8 @@ return; } + setupSchemaTypeLegend(); + // Description: 3rd column (index 2) — hard clamp to 2 lines using text replacement + inline suffix setupDescriptionInlineClamp();