Skip to content

Commit

Permalink
Improve generated docs to more clearly link to options object for que…
Browse files Browse the repository at this point in the history
…ryAssignedNodes.

Raised in lit/lit.dev#623
  • Loading branch information
AndrewJakubowicz committed Dec 14, 2021
1 parent 4839430 commit e84a576
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ import {decorateProperty} from './base.js';
import type {ReactiveElement} from '../reactive-element.js';
import type {QueryAssignedNodesOptions} from './query-assigned-nodes.js';

/**
* Options for the [[`queryAssignedElements`]] decorator. Extends from the
* options that can be passed into
* [HTMLSlotElement.assignedElements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).
*/
export interface QueryAssignedElementsOptions
extends QueryAssignedNodesOptions {
/**
* CSS selector used to filter the elements returned.
* CSS selector used to filter the elements returned. For example, a selector
* of `".item"` will only include elements with the `item` class.
*/
selector?: string;
}
Expand Down Expand Up @@ -50,9 +56,7 @@ export interface QueryAssignedElementsOptions
* Note, the type of this property should be annotated as `Array<HTMLElement>`.
*
* @param options Object that sets options for nodes to be returned. See
* [MDN parameters section](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements#parameters)
* for available options. Also accepts two more optional properties,
* `slot` and `selector`.
* [[`QueryAssignedElementsOptions`]] for all available options.
* @param options.slot Name of the slot. Undefined or empty string for the
* default slot.
* @param options.selector Element results are filtered such that they match the
Expand Down
10 changes: 7 additions & 3 deletions packages/reactive-element/src/decorators/query-assigned-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ import {decorateProperty} from './base.js';

import type {ReactiveElement} from '../reactive-element.js';

/**
* Options for the [[`queryAssignedNodes`]] decorator. Extends from the
* options that can be passed into
* [HTMLSlotElement.assignedNodes](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedNodes).
*/
export interface QueryAssignedNodesOptions extends AssignedNodesOptions {
/**
* Name of the slot. Leave empty for the default slot.
* Name of the slot to query. Leave empty for the default slot.
*/
slot?: string;
}
Expand Down Expand Up @@ -47,8 +52,7 @@ type TSDecoratorReturnType = void | any;
* Note the type of this property should be annotated as `Array<Node>`.
*
* @param options Object that sets options for nodes to be returned. See
* [MDN parameters section](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedNodes#parameters)
* for available options.
* [[`QueryAssignedNodesOptions`]] for all available options.
* @param options.slot Name of the slot. Undefined or empty string for the
* default slot.
*
Expand Down

0 comments on commit e84a576

Please sign in to comment.