Skip to content

Commit

Permalink
feat: show whether the property is reflected
Browse files Browse the repository at this point in the history
  • Loading branch information
bendera committed Oct 22, 2023
1 parent c38cd89 commit 174b47a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/api-common/src/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {
Attribute,
ClassField as ManifestClassField,
ClassLike,
ClassMember,
ClassMethod,
Expand All @@ -12,12 +11,13 @@ import type {
Event,
Export,
Package,
Slot
Slot,
CustomElementField
} from 'custom-elements-manifest/schema';

// FIXME: remove once new custom-elements-manifest version is released
// https://github.com/webcomponents/custom-elements-manifest/pull/118
type ClassField = ManifestClassField & {
type ClassField = CustomElementField & {
/**
* Whether the property is read-only.
*/
Expand Down
21 changes: 16 additions & 5 deletions packages/api-docs/src/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ const renderItem = (
valueType?: string,
value?: unknown,
attribute?: string,
isStatic?: boolean
isStatic?: boolean,
reflects?: boolean
): TemplateResult => html`
<div part="docs-item">
${isStatic
? html`<div part="docs-row"><div part="docs-tag">static</div></div>`
${isStatic || reflects
? html`<div part="docs-row">
${isStatic ? html`<div part="docs-tag">static</div>` : nothing}
${reflects ? html`<div part="docs-tag">reflected</div>` : nothing}
</div>`
: nothing}
<div part="docs-row">
<div part="docs-column" class="column-name-${prefix}">
Expand Down Expand Up @@ -164,7 +168,13 @@ class ApiDocsLayout extends LitElement {
props,
html`
${props.map((prop) => {
const { name, description, type, static: isStatic } = prop;
const {
name,
description,
type,
static: isStatic,
reflects
} = prop;
const attribute = attrs.find((x) => x.fieldName === name);
return renderItem(
'prop',
Expand All @@ -173,7 +183,8 @@ class ApiDocsLayout extends LitElement {
type?.text,
prop.default,
attribute?.name,
isStatic
isStatic,
reflects
);
})}
`
Expand Down

0 comments on commit 174b47a

Please sign in to comment.