Skip to content

Commit

Permalink
Adds CSSCustomState to schema (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow authored May 6, 2024
1 parent efaf2fc commit 2570079
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
34 changes: 32 additions & 2 deletions schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface JavaScriptModule {
kind: 'javascript-module';

/**
* Path to the javascript file needed to be imported.
* Path to the javascript file needed to be imported.
* (not the path for example to a typescript file.)
*/
path: string;
Expand Down Expand Up @@ -250,6 +250,8 @@ export interface CustomElement extends ClassLike {

cssProperties?: CssCustomProperty[];

cssStates?: CssCustomState[];

demos?: Demo[];

/**
Expand Down Expand Up @@ -372,6 +374,34 @@ export interface CssPart {
deprecated?: boolean | string;
}

/**
* The description of a CSS Custom State
* https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet
*/
export interface CssCustomState {
/**
* The name of the state. Note: Unlike CSS custom properties, custom states
* do not have a leading `--`.
*/
name: string;

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

/**
* A markdown description.
*/
description?: string;

/**
* Whether the CSS custom state 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 Expand Up @@ -573,7 +603,7 @@ export interface ClassField extends PropertyLike {
export interface CustomElementField extends ClassField {
/**
* The corresponding attribute name if there is one.
*
*
* If this property is defined, the attribute must be listed in the classes'
* `attributes` array.
*/
Expand Down
42 changes: 41 additions & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,34 @@
],
"type": "object"
},
"CssCustomState": {
"description": "The description of a CSS Custom State\nhttps://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet",
"properties": {
"deprecated": {
"description": "Whether the CSS custom state is deprecated.\nIf the value is a string, it's the reason for the deprecation.",
"type": [
"string",
"boolean"
]
},
"description": {
"description": "A markdown description.",
"type": "string"
},
"name": {
"description": "The name of the state. Note: Unlike CSS custom properties, custom states\ndo not have a leading `--`.",
"type": "string"
},
"summary": {
"description": "A markdown summary suitable for display in a listing.",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"CssPart": {
"description": "The description of a CSS Part",
"properties": {
Expand Down Expand Up @@ -307,6 +335,12 @@
},
"type": "array"
},
"cssStates": {
"items": {
"$ref": "#/definitions/CssCustomState"
},
"type": "array"
},
"customElement": {
"description": "Distinguishes a regular JavaScript class from a\ncustom element class",
"enum": [
Expand Down Expand Up @@ -451,6 +485,12 @@
},
"type": "array"
},
"cssStates": {
"items": {
"$ref": "#/definitions/CssCustomState"
},
"type": "array"
},
"customElement": {
"description": "Distinguishes a regular JavaScript class from a\ncustom element class",
"enum": [
Expand Down Expand Up @@ -765,7 +805,7 @@
"type": "string"
},
"path": {
"description": "Path to the javascript file needed to be imported. \n(not the path for example to a typescript file.)",
"description": "Path to the javascript file needed to be imported.\n(not the path for example to a typescript file.)",
"type": "string"
},
"summary": {
Expand Down

0 comments on commit 2570079

Please sign in to comment.