diff --git a/lib/bom.js b/lib/bom.js index 0f1eed349fc..389ce200963 100644 --- a/lib/bom.js +++ b/lib/bom.js @@ -1476,3 +1476,123 @@ declare interface CredMgmtCredentialsContainer { ): Promise; preventSilentAccess(): Promise; } + +declare class DOMPointInit { + x: number; + y: number; + z: number; + w: number; +} + +declare class DOMPointReadOnly { + constructor(x?: number, y?: number, z?: number, w?: number): void; + static fromPoint(other?: DOMPointInit): DOMPointReadOnly; + +x: number; + +y: number; + +z: number; + +w: number; + matrixTransform(DOMMatrixInit?: DOMMatrixInit): DOMPoint; + toJSON(): string; +} + +declare class DOMPoint extends DOMPointReadOnly { + constructor(x?: number, y?: number, z?: number, w?: number): void; + static fromPoint(other?: DOMPointInit): DOMPoint; +} + +declare class DOMMatrix2DInit { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m21: number; + m22: number; + m41: number; + m42: number; +} + +declare class DOMMatrixInit extends DOMMatrix2DInit { + m13: number; + m14: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m43: number; + m44: number; + is2D: boolean; +} + +declare class DOMMatrixReadOnly { + constructor(init?: string): void; + static fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly; + static fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; + static fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; + +a: number; + +b: number; + +c: number; + +d: number; + +e: number; + +f: number; + +m11: number; + +m12: number; + +m13: number; + +m14: number; + +m21: number; + +m22: number; + +m23: number; + +m24: number; + +m31: number; + +m32: number; + +m33: number; + +m34: number; + +m41: number; + +m42: number; + +m43: number; + +m44: number; + +is2D: boolean; + +isIdentity: boolean; + translate(tx?: number, ty?: number, tz?: number): DOMMatrix; + scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix; + scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + rotateFromVector(x?: number, y?: number): DOMMatrix; + rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + skewX(sx?: number): DOMMatrix; + skewY(sy?: number): DOMMatrix; + multiply(other?: DOMMatrix): DOMMatrix; + flipX(): DOMMatrix; + flipY(): DOMMatrix; + invert(): DOMMatrix; + transformPoint(other?: DOMPointInit: DOMPoint; + toFloat32Array(): Float32Array; + toFloat64Array(): Float64Array; + toJSON(): string; + toString(): string; +} + +declare class DOMMatrix extends DOMMatrixReadOnly { + constructor(init?: string): void; + static fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly; + static fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; + static fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; + multiplySelf(other?: DOMMatrix): DOMMatrix; + preMultiplySelf(other?: DOMMatrix): DOMMatrix; + translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix; + scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + rotateFromVectorSelf(x?: number, y?: number): DOMMatrix; + rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + skewXSelf(sx?: number): DOMMatrix; + skewYSelf(sy?: number): DOMMatrix; + invertSelf(): DOMMatrix; + setMatrixValue(transformList: string): void; +} \ No newline at end of file diff --git a/lib/dom.js b/lib/dom.js index e1f84b0b23f..2754fa1b77f 100644 --- a/lib/dom.js +++ b/lib/dom.js @@ -3973,3 +3973,187 @@ declare class Notification extends EventTarget { close(): void; } + +declare class SVGElement extends Element { + +dataset: DOMStringMap; + +id: string; + +xmlbase: string; + +ownerSVGElement: SVGElement | null; + +viewportElement: SVGElement | null; +} + +declare class SVGTransform { + +type: number; + +angle: number; + +matrix: SVGMatrix; + setMatrix(matrix: SVGMatrix): void; + setTranslate(tx: number, ty: number): void; + setScale(sx: number, sy: number): void; + setRotate(angle: number, cx: number, cy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + static SVG_TRANSFORM_UNKNOWN: 0; + static SVG_TRANSFORM_MATRIX: 1; + static SVG_TRANSFORM_TRANSLATE: 2; + static SVG_TRANSFORM_SCALE: 3; + static SVG_TRANSFORM_ROTATE: 4; + static SVG_TRANSFORM_SKEWX: 5; + static SVG_TRANSFORM_SKEWY: 6; +} + +declare class SVGTransformList { + +numberOfItems: number; + +length: number; + clear(): void; + initialize(newItem: SVGTransform): SVGTransform; + getItem(index: number): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform ; + appendItem(newItem: SVGTransform): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + consolidate(): SVGTransform; +} + +declare class SVGAnimatedTransformList { + +baseVal: SVGTransformList; + +animVal: SVGTransformList; +} + +declare class SVGGraphicsElement extends SVGElement { + +transform: SVGTransformList; + getBBox(): DOMRect; + getCTM(): DOMMatrix; + getScreenCTM(): DOMMatrix; +} + +declare class SVGLength { + +unitType: number; + value: number; + valueInSpecifiedUnits: number; + valueAsString: string; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + convertToSpecifiedUnits(unitType: number): void; + static SVG_LENGTHTYPE_UNKNOWN: 0; + static SVG_LENGTHTYPE_NUMBER: 1; + static SVG_LENGTHTYPE_PERCENTAGE: 2; + static SVG_LENGTHTYPE_EMS: 3; + static SVG_LENGTHTYPE_EXS: 4; + static SVG_LENGTHTYPE_PX: 5; + static SVG_LENGTHTYPE_CM: 6; + static SVG_LENGTHTYPE_MM: 7; + static SVG_LENGTHTYPE_IN: 8; + static SVG_LENGTHTYPE_PT: 9; + static SVG_LENGTHTYPE_PC: 10; +} + +declare class SVGAnimatedLength { + +baseVal: SVGLength; + +animVal: SVGLength; +} + +declare class SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + static SVG_PRESERVEASPECTRATIO_UNKNOWN: 0; + static SVG_PRESERVEASPECTRATIO_NONE: 1; + static SVG_PRESERVEASPECTRATIO_XMINYMIN: 2; + static SVG_PRESERVEASPECTRATIO_XMIDYMIN: 3; + static SVG_PRESERVEASPECTRATIO_XMAXYMIN: 4; + static SVG_PRESERVEASPECTRATIO_XMINYMID: 5; + static SVG_PRESERVEASPECTRATIO_XMIDYMID: 6; + static SVG_PRESERVEASPECTRATIO_XMAXYMID: 7; + static SVG_PRESERVEASPECTRATIO_XMINYMAX: 8; + static SVG_PRESERVEASPECTRATIO_XMIDYMAX: 9; + static SVG_PRESERVEASPECTRATIO_XMAXYMAX: 10; + static SVG_MEETORSLICE_UNKNOWN: 0; + static SVG_MEETORSLICE_MEET: 1; + static SVG_MEETORSLICE_SLICE: 2; +} + +declare class SVGAnimatedPreserveAspectRatio { + +baseVal: SVGPreserveAspectRatio; + +animVal: SVGPreserveAspectRatio; +} + +declare class SVGImageElement extends SVGGraphicsElement { + crossOrigin: string; + decoding: string; + +height: SVGAnimatedLength; + +preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + +width: SVGAnimatedLength; + +x: SVGAnimatedLength; + +y: SVGAnimatedLength; + decode(): Promise; +} + +type OffscreenCanvasContextId = + '2d' | + 'webgl' | + 'webgl2' | + 'bitmaprenderer'; + +type ContextOptions2D = { + alpha: boolean, + willReadFrequently: boolean, + storage: string +} + +type ContextOptionsWebGL = { + alpha: boolean, + depth: boolean, + stencil: boolean, + antialias: boolean, + premultipliedAlpha: boolean, + preserveDrawingBuffer: boolean, + failIfMajorPerformanceCaveat: boolean +} + +type ContextOptions = ContextOptions2D | ContextOptionsWebGL; + +type BlobOptions = { + type: string, + quality: number +} + +declare class OffscreenCanvas { + constructor(width: number, height: number): void; + height: number; + width: number; + getContext(contextId: OffscreenCanvasContextId , options?: ContextOptions): RenderingContext; + convertToBlob(options?: BlobOptions): Promise; + transferToImageBitmap(): ImageBitmap; +} + +type CreateImageBitmapSource = + HTMLImageElement | + SVGImageElement | + HTMLVideoElement | + HTMLCanvasElement | + Blob | + ImageData | + ImageBitmap | + OffscreenCanvas; + +type CreateImageBitmapOptions = { + imageOrientation: 'none' | 'flipY', + premultiplyAlpha: 'none' | 'default' | 'premultiply', + colorSpaceConversion: 'none' | 'default', + resizeWidth: number, + resizeHeight: number, + resizeQuality: 'pixelated' | 'low' | 'medium' | 'high' +} + +declare function createImageBitmap( + image: CreateImageBitmapSource, + sx: number, + sy: number, + sw: number, + sh: number, + options?: CreateImageBitmapOptions +): Promise; + +declare function createImageBitmap( + image: CreateImageBitmapSource, + options?: CreateImageBitmapOptions +): Promise;