Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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: SelectionDirection | 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?: SelectionDirection): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42478,6 +42478,7 @@ type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBY
type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type ReportList = Report[];
type RequestInfo = Request | string;
type SelectionDirection = "forward" | "backward" | "none";
type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | VideoFrame;
type TimerHandler = string | Function;
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | MediaSourceHandle | ReadableStream | WritableStream | TransformStream | AudioData | VideoFrame | RTCDataChannel | ArrayBuffer;
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: SelectionDirection | 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?: SelectionDirection): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42452,6 +42452,7 @@ type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBY
type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type ReportList = Report[];
type RequestInfo = Request | string;
type SelectionDirection = "forward" | "backward" | "none";
type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | VideoFrame;
type TimerHandler = string | Function;
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | MediaSourceHandle | ReadableStream | WritableStream | TransformStream | AudioData | VideoFrame | RTCDataChannel | ArrayBuffer;
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: SelectionDirection | 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?: SelectionDirection): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42475,6 +42475,7 @@ type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBY
type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type ReportList = Report[];
type RequestInfo = Request | string;
type SelectionDirection = "forward" | "backward" | "none";
type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | VideoFrame;
type TimerHandler = string | Function;
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | MediaSourceHandle | ReadableStream | WritableStream | TransformStream | AudioData | VideoFrame | RTCDataChannel | ArrayBuffer;
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: SelectionDirection | 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?: SelectionDirection): void;
/**
* The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element.
*
Expand Down Expand Up @@ -42475,6 +42475,7 @@ type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBY
type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type ReportList = Report[];
type RequestInfo = Request | string;
type SelectionDirection = "forward" | "backward" | "none";
type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | VideoFrame;
type TimerHandler = string | Function;
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | MediaSourceHandle | ReadableStream | WritableStream | TransformStream | AudioData | VideoFrame | RTCDataChannel | ArrayBuffer;
Expand Down
9 changes: 0 additions & 9 deletions inputfiles/addedTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,6 @@
}
}
},
"HTMLInputElement": {
"properties": {
"property": {
"labels": {
"overrideType": "NodeListOf<HTMLLabelElement>"
}
}
}
},
"RuntimeError": {
"name": "RuntimeError",
"extends": "Error",
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
18 changes: 18 additions & 0 deletions inputfiles/patches/html.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ interface HTMLImageElement {
property loading overrideType=#""eager" | "lazy""#
}

interface HTMLInputElement {
property labels {
type NodeListOf {
type HTMLLabelElement
}
}
property autocomplete type=AutoFill
property valueAsDate type=Date
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure this should be allowed, Date is not an IDL type. But maybe not worth disallowing it... Let's see.

property selectionDirection type=SelectionDirection
method setSelectionRange signatureIndex=0 {
param start nullable=#true
param end nullable=#true
param direction type=SelectionDirection
}
}

typedef SelectionDirection overrideType=#""forward" | "backward" | "none""#

dictionary StructuredSerializeOptions {
member transfer {
type {
Expand Down
2 changes: 2 additions & 0 deletions src/build/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ function handleParam(node: Node) {
name,
...optionalMember("type", "string", node.properties?.type),
...optionalMember("overrideType", "string", node.properties?.overrideType),
...optionalMember("nullable", "boolean", node.properties?.nullable),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is part of Typed and that should be handled by type node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

additionalTypes,
};
}
Expand Down Expand Up @@ -452,6 +453,7 @@ function handleTypedef(node: Node): DeepPartial<TypeDef> {
"string",
node.properties?.legacyNamespace,
),
...optionalMember("overrideType", "string", node.properties?.overrideType),
};
}

Expand Down