Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- ### Removed -->
<!-- ### Fixed -->

## Unreleased

### Added

- Added `commands` array to `CustomElementDeclaration` and `CustomElementMixinDeclaration` to document [Invoker Commands](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API) that a custom element responds to. ([#144](https://github.com/webcomponents/custom-elements-manifest/issues/144))

## [2.1.0] - 2024-05-16

### Added
Expand Down
6 changes: 6 additions & 0 deletions examples/simple-element.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
"name": "disabled"
}
],
"commands": [
{
"name": "--show-modal",
"description": "Calls `showModal()` on the `<dialog>` element when invoked."
}
],
"superclass": {
"name": "HTMLElement"
}
Expand Down
35 changes: 35 additions & 0 deletions schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ export interface CustomElement extends ClassLike {

cssStates?: CssCustomState[];

/**
* The commands this element responds to.
* https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API
*/
commands?: Command[];

demos?: Demo[];

/**
Expand Down Expand Up @@ -402,6 +408,35 @@ export interface CssCustomState {
deprecated?: boolean | string;
}

/**
* The description of a command that a custom element responds to.
* https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API
*/
export interface Command {
/**
* The name of the command, e.g. `--show-modal`.
*/
name: string;

/**
* A markdown summary suitable for display in a listing.
*/
summary?: string;

/**
* A markdown description what the command does when invoked.
*/
description?: string;

inheritedFrom?: Reference;

/**
* Whether the command is deprecated.
* If the value is a string, it's the reason for the deprecation.
*/
deprecated?: boolean | string;
}

export interface CssCustomProperty {
/**
* The name of the property, including leading `--`.
Expand Down
45 changes: 45 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,37 @@
],
"type": "object"
},
"Command": {
"description": "The description of a command that a custom element responds to.\nhttps://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API",
"properties": {
"deprecated": {
"description": "Whether the command is deprecated.\nIf the value is a string, it's the reason for the deprecation.",
"type": [
"string",
"boolean"
]
},
"description": {
"description": "A markdown description what the command does when invoked.",
"type": "string"
},
"inheritedFrom": {
"$ref": "#/definitions/Reference"
},
"name": {
"description": "The name of the command, e.g. `--show-modal`.",
"type": "string"
},
"summary": {
"description": "A markdown summary suitable for display in a listing.",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"CssCustomProperty": {
"properties": {
"default": {
Expand Down Expand Up @@ -323,6 +354,13 @@
},
"type": "array"
},
"commands": {
"description": "The commands this element responds to.\nhttps://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API",
"items": {
"$ref": "#/definitions/Command"
},
"type": "array"
},
"cssParts": {
"items": {
"$ref": "#/definitions/CssPart"
Expand Down Expand Up @@ -473,6 +511,13 @@
},
"type": "array"
},
"commands": {
"description": "The commands this element responds to.\nhttps://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API",
"items": {
"$ref": "#/definitions/Command"
},
"type": "array"
},
"cssParts": {
"items": {
"$ref": "#/definitions/CssPart"
Expand Down