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
5 changes: 3 additions & 2 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17341,7 +17341,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection)
*/
selectionDirection: "forward" | "backward" | "none" | null;
selectionDirection: Directions | null;
/**
* The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position.
*
Expand Down Expand Up @@ -17470,7 +17470,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange)
*/
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
setSelectionRange(start: number | null, end: number | null, direction?: Directions): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42434,6 +42434,7 @@ type ConstrainDouble = number | ConstrainDoubleRange;
type ConstrainULong = number | ConstrainULongRange;
type CookieList = CookieListItem[];
type DOMHighResTimeStamp = number;
type Directions = "forward" | "backward" | "none";
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
Expand Down
5 changes: 3 additions & 2 deletions baselines/ts5.5/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17323,7 +17323,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection)
*/
selectionDirection: "forward" | "backward" | "none" | null;
selectionDirection: Directions | null;
/**
* The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position.
*
Expand Down Expand Up @@ -17452,7 +17452,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange)
*/
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
setSelectionRange(start: number | null, end: number | null, direction?: Directions): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42408,6 +42408,7 @@ type ConstrainDouble = number | ConstrainDoubleRange;
type ConstrainULong = number | ConstrainULongRange;
type CookieList = CookieListItem[];
type DOMHighResTimeStamp = number;
type Directions = "forward" | "backward" | "none";
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
Expand Down
5 changes: 3 additions & 2 deletions baselines/ts5.6/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17338,7 +17338,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection)
*/
selectionDirection: "forward" | "backward" | "none" | null;
selectionDirection: Directions | null;
/**
* The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position.
*
Expand Down Expand Up @@ -17467,7 +17467,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange)
*/
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
setSelectionRange(start: number | null, end: number | null, direction?: Directions): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42431,6 +42431,7 @@ type ConstrainDouble = number | ConstrainDoubleRange;
type ConstrainULong = number | ConstrainULongRange;
type CookieList = CookieListItem[];
type DOMHighResTimeStamp = number;
type Directions = "forward" | "backward" | "none";
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
Expand Down
5 changes: 3 additions & 2 deletions baselines/ts5.9/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17338,7 +17338,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection)
*/
selectionDirection: "forward" | "backward" | "none" | null;
selectionDirection: Directions | null;
/**
* The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position.
*
Expand Down Expand Up @@ -17467,7 +17467,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange)
*/
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
setSelectionRange(start: number | null, end: number | null, direction?: Directions): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42431,6 +42431,7 @@ type ConstrainDouble = number | ConstrainDoubleRange;
type ConstrainULong = number | ConstrainULongRange;
type CookieList = CookieListItem[];
type DOMHighResTimeStamp = number;
type Directions = "forward" | "backward" | "none";
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
Expand Down
13 changes: 4 additions & 9 deletions inputfiles/addedTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,6 @@
"name": "IDBOpenDBRequest",
"extends": "IDBRequest<IDBDatabase>"
},
"HTMLInputElement": {
"properties": {
"property": {
"labels": {
"overrideType": "NodeListOf<HTMLLabelElement>"
}
}
}
},
// The spec removed `timestamp` but browsers still have it.
// https://github.com/w3c/webrtc-encoded-transform/pull/204
"RTCEncodedAudioFrame": {
Expand Down Expand Up @@ -606,6 +597,10 @@
// Full spec at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill.
"name": "AutoFill",
"overrideType": "AutoFillBase | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<AutoFillAddressKind>}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`"
},
{
"name": "Directions",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a plan to remove that again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, let's keep it in the JSON until we migrate because we still don't have support for type defs in KDL

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Maybe something like SelectionDirection to prevent future conflict.
  2. Maybe do the KDL work first to prevent back and forth?

"overrideType": "\"forward\" | \"backward\" | \"none\""
}
]
}
Expand Down
1 change: 0 additions & 1 deletion inputfiles/knownTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"AutoFillContactField",
"AutoFillField",
"AutoFillCredentialField",
"AutoFill",
"BigInteger",
"ClientQueryOptions",
"ClientTypes",
Expand Down
42 changes: 0 additions & 42 deletions inputfiles/overridingTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -1445,48 +1445,6 @@
}
}
},
"HTMLInputElement": {
"properties": {
"property": {
"autocomplete": {
"name": "autocomplete",
"overrideType": "AutoFill"
},
"selectionDirection": {
"name": "selectionDirection",
"overrideType": "\"forward\" | \"backward\" | \"none\""
},
"valueAsDate": {
"name": "valueAsDate",
"overrideType": "Date"
}
}
},
"methods": {
"method": {
"setSelectionRange": {
"signature": {
"0": {
"param": [
{
"name": "start",
"nullable": true
},
{
"name": "end",
"nullable": true
},
{
"name": "direction",
"overrideType": "\"forward\" | \"backward\" | \"none\""
}
]
}
}
}
}
}
},
"MouseEvent": {
"methods": {
"method": {
Expand Down
16 changes: 16 additions & 0 deletions inputfiles/patches/html.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ interface HTMLImageElement {
property loading overrideType=#""eager" | "lazy""#
}

interface HTMLInputElement {
property labels {
type NodeListOf {
type HTMLLabelElement
}
}
property autocomplete type=AutoFill
property valueAsDate type=Date
property selectionDirection type=Directions
method setSelectionRange signatureIndex=0 {
param start nullable=#true
param end nullable=#true
param direction type=Directions
}
}

dictionary StructuredSerializeOptions {
member transfer {
type {
Expand Down
1 change: 1 addition & 0 deletions src/build/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ function handleParam(node: Node) {
name,
...optionalMember("type", "string", node.properties?.type),
...optionalMember("overrideType", "string", node.properties?.overrideType),
...optionalMember("nullable", "boolean", node.properties?.nullable),
additionalTypes,
};
}
Expand Down