From 1b56f294fcecebf313797df5fc6387aaa1796e78 Mon Sep 17 00:00:00 2001 From: Ruslan Lekhman Date: Mon, 13 Oct 2025 19:14:50 -0600 Subject: [PATCH] docs: improve properties and methods template close #32060 --- docs/src/styles/_api.scss | 1 + docs/src/styles/_tables.scss | 32 ++++ tools/dgeni/templates/method.template.html | 146 +++++++++--------- .../templates/property-list.template.html | 20 +-- tools/dgeni/templates/property.template.html | 2 +- 5 files changed, 122 insertions(+), 79 deletions(-) diff --git a/docs/src/styles/_api.scss b/docs/src/styles/_api.scss index a6a4cebbaa6a..edac76cc0f79 100644 --- a/docs/src/styles/_api.scss +++ b/docs/src/styles/_api.scss @@ -98,6 +98,7 @@ .docs-api-method-parameters-header-cell, .docs-api-method-returns-header-cell { font-size: 14px; + padding-bottom: 0; } .docs-api-input-marker, diff --git a/docs/src/styles/_tables.scss b/docs/src/styles/_tables.scss index c9084474be8b..aee301ef45e1 100644 --- a/docs/src/styles/_tables.scss +++ b/docs/src/styles/_tables.scss @@ -52,6 +52,38 @@ height: 56px; } + .docs-api-method-card, + .docs-api-properties-card { + background-color: var(--mat-sys-surface-container-lowest); + border: solid 1px var(--mat-sys-outline-variant); + border-radius: 12px; + margin: 0 0 32px; + } + + .docs-api-method-table, + .docs-api-properties-table { + margin: 0 !important; + } + + .docs-api-method-table tr { + border-bottom: 0; + + th.docs-api-method-name-cell .docs-api-method-parameter-name { + color: var(--mat-sys-on-surface); + } + } + + .docs-api-properties-table { + .docs-api-properties-row:last-of-type { + border-bottom: 0; + } + + .docs-api-property-type { + color: var(--mat-sys-primary); + } + } + + @media (max-width: constants.$small-breakpoint-width) { .docs-api table, .docs-markdown > table { diff --git a/tools/dgeni/templates/method.template.html b/tools/dgeni/templates/method.template.html index 392f544861b5..771953ef73ca 100644 --- a/tools/dgeni/templates/method.template.html +++ b/tools/dgeni/templates/method.template.html @@ -1,77 +1,85 @@ {% import "macros.html" as macros %} - - - -
- {%- if method.isDeprecated -%} -
- Deprecated +
+ + + + + {%- endif -%} + {%- if method.isAsync -%} +
+ async +
+ {%- endif -%} + {$ method.name $} + ({%- for param in method.params -%} + {$ param.name $}{% if param.isOptional %}?{% endif %}: + + {$ param.type $}{% if not loop.last %}, {% endif %} + {%- endfor -%} + ): {$ method.type $} + + + + {%- if method.description -%} + + - - {%- if method.description -%} - - - - {%- endif -%} + {%- endif -%} - {%- if method.params.length -%} - - - + {%- if method.params.length -%} + + + + + + {% for parameter in method.params %} + + + - - {% for parameter in method.params %} - - - - - {% endfor %} - {%- endif -%} + {% endfor %} + {%- endif -%} - {%- if method.type and method.type !== "void" -%} - - - + {%- if method.type and method.type !== "void" -%} + + + + + + + + - - - - - - {%- endif -%} -
+ {%- if method.isDeprecated -%} +
+ Deprecated +
+ {%- endif -%} + {%- if method.isStatic -%} +
+ static
- {%- endif -%} - {%- if method.isStatic -%} -
- static -
- {%- endif -%} - {%- if method.isAsync -%} -
- async -
- {%- endif -%} - {$ method.name $} -
+ {$ method.description | marked | safe $} +
- {$ method.description | marked | safe $} -
Parameters
Parameters
+

+ {$ parameter.name $} + {%- if parameter.isOptional -%} + ? + {%- endif -%} +

+ {$ parameter.type $} +
+

+ {$ parameter.description | marked | safe $} +

+
-

- {$ parameter.name $} - {%- if parameter.isOptional -%} - ? - {%- endif -%} -

- {$ parameter.type $} -
-

- {$ parameter.description | marked | safe $} -

-
Returns
Returns
+ {$ method.type $} + +

+ {$ method.returns.description | marked | safe $} +

+
- {$ method.type $} - -

- {$ method.returns.description | marked | safe $} -

-
+ {%- endif -%} +
+ diff --git a/tools/dgeni/templates/property-list.template.html b/tools/dgeni/templates/property-list.template.html index 0a54b03a629d..874c2cc91c96 100644 --- a/tools/dgeni/templates/property-list.template.html +++ b/tools/dgeni/templates/property-list.template.html @@ -1,12 +1,14 @@ {%- if propertyList.length -%}
Properties
- - - - - - {% for p in propertyList %} - {$ property(p) $} - {% endfor %} -
NameDescription
+
+ + + + + + {% for p in propertyList %} + {$ property(p) $} + {% endfor %} +
NameDescription
+
{%- endif -%} diff --git a/tools/dgeni/templates/property.template.html b/tools/dgeni/templates/property.template.html index c9e94d06a564..155bb6348330 100644 --- a/tools/dgeni/templates/property.template.html +++ b/tools/dgeni/templates/property.template.html @@ -27,7 +27,7 @@ {%- endif -%}

- {%- if property.isStatic -%}static {%- endif -%}{$ property.name $}: {$ property.type $} + {%- if property.isStatic -%}static {%- endif -%}{$ property.name $}: {$ property.type $}

{$ property.description | marked | safe $}