diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 402a90131..431be556d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: scalaversion: ["2.11.12", "2.12.15", "2.13.6", "3.1.3"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Scala uses: japgolly/setup-everything-scala@v3.1 @@ -34,7 +34,7 @@ jobs: readme: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: japgolly/setup-everything-scala@v3.1 - name: Readme generation run: sbt readme/run diff --git a/.github/workflows/ghpages.yml b/.github/workflows/ghpages.yml index b0dc80832..07fbed981 100644 --- a/.github/workflows/ghpages.yml +++ b/.github/workflows/ghpages.yml @@ -10,7 +10,7 @@ jobs: build-and-deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Scala uses: japgolly/setup-everything-scala@v3.1 @@ -19,7 +19,7 @@ jobs: run: sbt readme/run - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4.4.1 + uses: JamesIves/github-pages-deploy-action@v4.4.3 with: token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3717059d9..4a6da22ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.scalafmt.conf b/.scalafmt.conf index 8f8fcffb5..05fae5991 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.7.3 +version = 3.7.4 runner.dialect = scala213source3 project.git = true style = Scala.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f1437a618..18737f53b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,6 +54,13 @@ Please: * Use `def` for read-only properties unless there is a compelling reason it should be a `val` (i.e., the spec definitively states it is constant) * Use `Double` for integer-values that can fall outside the range of `Int` +* Prefer adding overloads instead of using union `|` types for method and constructor parameters. For example: +```diff +- def createElement(tagName: String, options: String | ElementCreationOptions = js.native): Element = js.native ++ def createElement(tagName: String): Element = js.native ++ def createElement(tagName: String, options: String): Element = js.native ++ def createElement(tagName: String, options: ElementCreationOptions): Element = js.native +``` * Add scaladocs via copy-paste from MDN diff --git a/api-reports/2_12.txt b/api-reports/2_12.txt index 0d273a2be..b9f9637ca 100644 --- a/api-reports/2_12.txt +++ b/api-reports/2_12.txt @@ -1348,6 +1348,12 @@ CompositionEventInit[JT] var detail: js.UndefOr[Int] CompositionEventInit[JT] var locale: js.UndefOr[String] CompositionEventInit[JT] var scoped: js.UndefOr[Boolean] CompositionEventInit[JT] var view: js.UndefOr[Window] +CompressionFormat[JT] +CompressionFormat[SO] val deflate: CompressionFormat +CompressionFormat[SO] val `deflate-raw`: CompressionFormat +CompressionFormat[SO] val gzip: CompressionFormat +CompressionStream[JC] def readable: ReadableStream[Uint8Array] +CompressionStream[JC] def writable: WriteableStream[Uint8Array] ConcatParams[JT] val algorithmId: BufferSource ConcatParams[JT] val hash: HashAlgorithmIdentifier ConcatParams[JT] val name: String @@ -1496,6 +1502,10 @@ DOMRect[JC] def x: Double DOMRect[JC] def x_ = (x: Double): Unit DOMRect[JC] def y: Double DOMRect[JC] def y_ = (y: Double): Unit +DOMRectInit[JT] var height: js.UndefOr[Double] +DOMRectInit[JT] var width: js.UndefOr[Double] +DOMRectInit[JT] var x: js.UndefOr[Double] +DOMRectInit[JT] var y: js.UndefOr[Double] DOMRectList[JC] @JSBracketAccess def apply(index: Int): T DOMRectList[JC] def length: Int DOMRectReadOnly[JT] def bottom: Double @@ -1561,6 +1571,8 @@ DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): D DataTransferItemList[JC] def clear(): Unit DataTransferItemList[JC] def length: Int DataTransferItemList[JC] def remove(index: Int): Unit +DecompressionStream[JC] def readable: ReadableStream[Uint8Array] +DecompressionStream[JC] def writable: WriteableStream[Uint8Array] DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit @@ -1725,7 +1737,11 @@ Document[JC] def createCDATASection(data: String): CDATASection Document[JC] def createComment(data: String): Comment Document[JC] def createDocumentFragment(): DocumentFragment Document[JC] def createElement(tagName: String): Element +Document[JC] def createElement(tagName: String, options: ElementCreationOptions): Element +Document[JC] def createElement(tagName: String, options: String): Element Document[JC] def createElementNS(namespaceURI: String, qualifiedName: String): Element +Document[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element +Document[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element Document[JC] def createEvent(eventInterface: String): Event Document[JC] def createNSResolver(node: Node): XPathNSResolver Document[JC] def createNodeIterator(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): NodeIterator @@ -2065,6 +2081,7 @@ Element[JC] def setAttributeNodeNS(newAttr: Attr): Attr Element[JC] def shadowRoot: ShadowRoot Element[JC] def tagName: String Element[JC] var textContent: String +ElementCreationOptions[JT] var is: js.UndefOr[String] ElementDefinitionOptions[JT] var `extends`: js.UndefOr[String] EndOfStreamError[JT] EndOfStreamError[SO] val decode: EndOfStreamError @@ -2286,7 +2303,18 @@ FocusEventInit[JT] var scoped: js.UndefOr[Boolean] FocusEventInit[JT] var view: js.UndefOr[Window] FocusOptions[JT] var focusVisible: js.UndefOr[Boolean] FocusOptions[JT] var preventScroll: js.UndefOr[Boolean] -FormData[JC] def append(name: js.Any, value: js.Any, blobName: String?): Unit +FormData[JC] def append(name: String, value: Blob, blobName: String?): Unit +FormData[JC] def append(name: String, value: String): Unit +FormData[JC] def delete(name: String): Unit +FormData[JC] def entries(): js.Iterator[js.Tuple2[String, String | Blob]] +FormData[JC] def get(name: String): String | Blob +FormData[JC] def getAll(name: String): js.Array[String | Blob] +FormData[JC] def has(name: String): Boolean +FormData[JC] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[String, String | Blob]] +FormData[JC] def keys(): js.Iterator[String] +FormData[JC] def set(name: String, value: Blob, blobName: String?): Unit +FormData[JC] def set(name: String, value: String): Unit +FormData[JC] def values(): js.Iterator[String | Blob] FormData[JO] FrameType[JT] FrameType[SO] val auxiliary: FrameType @@ -2380,6 +2408,7 @@ HTMLAnchorElement[JC] var contentEditable: String HTMLAnchorElement[JC] def dataset: js.Dictionary[String] HTMLAnchorElement[JC] var dir: String HTMLAnchorElement[JC] def dispatchEvent(evt: Event): Boolean +HTMLAnchorElement[JC] var download: String HTMLAnchorElement[JC] var draggable: Boolean HTMLAnchorElement[JC] var filters: Object HTMLAnchorElement[JC] def firstChild: Node @@ -4901,7 +4930,11 @@ HTMLDocument[JC] def createCDATASection(data: String): CDATASection HTMLDocument[JC] def createComment(data: String): Comment HTMLDocument[JC] def createDocumentFragment(): DocumentFragment HTMLDocument[JC] def createElement(tagName: String): Element +HTMLDocument[JC] def createElement(tagName: String, options: ElementCreationOptions): Element +HTMLDocument[JC] def createElement(tagName: String, options: String): Element HTMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String): Element +HTMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element +HTMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element HTMLDocument[JC] def createEvent(eventInterface: String): Event HTMLDocument[JC] def createNSResolver(node: Node): XPathNSResolver HTMLDocument[JC] def createNodeIterator(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): NodeIterator @@ -15502,6 +15535,30 @@ InputType[SO] val insertReplacementText: InputType InputType[SO] val insertText: InputType InputType[SO] val insertTranspose: InputType InputType[SO] val insertUnorderedList: InputType +IntersectionObserver[JC] def disconnect(): Unit +IntersectionObserver[JC] def observe(target: Element): Unit +IntersectionObserver[JC] def root: Document | Element +IntersectionObserver[JC] def rootMargin: String +IntersectionObserver[JC] def takeRecords(): js.Array[IntersectionObserverEntry] +IntersectionObserver[JC] def thresholds: FrozenArray[Double] +IntersectionObserver[JC] def unobserve(target: Element): Unit +IntersectionObserverEntry[JC] def boundingClientRect: DOMRectReadOnly +IntersectionObserverEntry[JC] def intersectionRatio: Double +IntersectionObserverEntry[JC] def intersectionRect: DOMRectReadOnly +IntersectionObserverEntry[JC] def isIntersecting: Boolean +IntersectionObserverEntry[JC] def rootBounds: DOMRectReadOnly +IntersectionObserverEntry[JC] def target: Element +IntersectionObserverEntry[JC] def time: Double +IntersectionObserverEntryInit[JT] var boundingClientRect: DOMRectInit +IntersectionObserverEntryInit[JT] var intersectionRatio: Double +IntersectionObserverEntryInit[JT] var intersectionRect: DOMRectInit +IntersectionObserverEntryInit[JT] var isIntersecting: Boolean +IntersectionObserverEntryInit[JT] var rootBounds: DOMRectInit +IntersectionObserverEntryInit[JT] var target: Element +IntersectionObserverEntryInit[JT] var time: Double +IntersectionObserverInit[JT] var root: js.UndefOr[Document | Element] +IntersectionObserverInit[JT] var rootMargin: js.UndefOr[String] +IntersectionObserverInit[JT] var threshold: js.UndefOr[Double | js.Array[Double]] JsonWebKey[JT] var alg: js.Array[String] JsonWebKey[JT] var crv: String JsonWebKey[JT] var d: String @@ -16420,13 +16477,20 @@ Navigator[JC] def mediaDevices: MediaDevices Navigator[JC] def onLine: Boolean Navigator[JC] val permissions: Permissions Navigator[JC] def platform: String +Navigator[JC] def registerProtocolHandler(scheme: String, url: String): Unit +Navigator[JC] def registerProtocolHandler(scheme: String, url: URL): Unit Navigator[JC] def sendBeacon(url: String, data: BodyInit?): Boolean Navigator[JC] val serviceWorker: ServiceWorkerContainer Navigator[JC] def storage: StorageManager +Navigator[JC] def unregisterProtocolHandler(scheme: String, url: String): Unit +Navigator[JC] def unregisterProtocolHandler(scheme: String, url: URL): Unit Navigator[JC] def userAgent: String Navigator[JC] def vibrate(duration: Double): Boolean Navigator[JC] def vibrate(pattern: js.Array[Double]): Boolean -NavigatorContentUtils[JT] +NavigatorContentUtils[JT] def registerProtocolHandler(scheme: String, url: String): Unit +NavigatorContentUtils[JT] def registerProtocolHandler(scheme: String, url: URL): Unit +NavigatorContentUtils[JT] def unregisterProtocolHandler(scheme: String, url: String): Unit +NavigatorContentUtils[JT] def unregisterProtocolHandler(scheme: String, url: URL): Unit NavigatorGeolocation[JT] def geolocation: Geolocation NavigatorID[JT] def appName: String NavigatorID[JT] def appVersion: String @@ -26181,6 +26245,7 @@ URL[JC] var search: String URL[JC] var searchParams: URLSearchParams URL[JC] var username: String URL[JO] def createObjectURL(blob: Blob): String +URL[JO] def createObjectURL(src: MediaSource): String URL[JO] def revokeObjectURL(url: String): Unit URLSearchParams[JC] def append(name: String, value: String): Unit URLSearchParams[JC] def delete(name: String): Unit @@ -27071,6 +27136,97 @@ WriteableStream[JT] val closed: js.Promise[WriteableStream[T]] WriteableStream[JT] val ready: js.Promise[WriteableStream[T]] WriteableStream[JT] def state: WriteableState WriteableStream[JT] def write(chunk: Chunk[T]): js.Promise[Any] +XMLDocument[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +XMLDocument[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +XMLDocument[JC] def adoptNode(source: Node): Node +XMLDocument[JC] def appendChild(newChild: Node): Node +XMLDocument[JC] def baseURI: String +XMLDocument[JC] def characterSet: String +XMLDocument[JC] def childElementCount: Int +XMLDocument[JC] def childNodes: NodeList[Node] +XMLDocument[JC] def children: HTMLCollection[Element] +XMLDocument[JC] def cloneNode(deep: Boolean?): Node +XMLDocument[JC] def compareDocumentPosition(other: Node): Int +XMLDocument[JC] def contains(otherNode: Node): Boolean +XMLDocument[JC] def createAttribute(name: String): Attr +XMLDocument[JC] def createAttributeNS(namespaceURI: String, qualifiedName: String): Attr +XMLDocument[JC] def createCDATASection(data: String): CDATASection +XMLDocument[JC] def createComment(data: String): Comment +XMLDocument[JC] def createDocumentFragment(): DocumentFragment +XMLDocument[JC] def createElement(tagName: String): Element +XMLDocument[JC] def createElement(tagName: String, options: ElementCreationOptions): Element +XMLDocument[JC] def createElement(tagName: String, options: String): Element +XMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String): Element +XMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element +XMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element +XMLDocument[JC] def createEvent(eventInterface: String): Event +XMLDocument[JC] def createNSResolver(node: Node): XPathNSResolver +XMLDocument[JC] def createNodeIterator(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): NodeIterator +XMLDocument[JC] def createProcessingInstruction(target: String, data: String): ProcessingInstruction +XMLDocument[JC] def createRange(): Range +XMLDocument[JC] def createStyleSheet(href: String?, index: Int?): CSSStyleSheet +XMLDocument[JC] def createTextNode(data: String): Text +XMLDocument[JC] def createTreeWalker(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): TreeWalker +XMLDocument[JC] def dispatchEvent(evt: Event): Boolean +XMLDocument[JC] def doctype: DocumentType +XMLDocument[JC] def documentElement: Element +XMLDocument[JC] def documentURI: String +XMLDocument[JC] def elementFromPoint(x: Double, y: Double): Element +XMLDocument[JC] def evaluate(xpathExpression: String, contextNode: Node, namespaceResolver: XPathNSResolver, resultType: Int, result: XPathResult): XPathResult +XMLDocument[JC] def evaluate(xpathExpression: String, contextNode: Node, namespaceResolver: js.Function1[String, String], resultType: Int, result: XPathResult): XPathResult +XMLDocument[JC] def exitFullscreen(): js.Promise[Unit] +XMLDocument[JC] def exitPointerLock(): Unit +XMLDocument[JC] def firstChild: Node +XMLDocument[JC] def firstElementChild: Element +XMLDocument[JC] def fullscreenElement: Element +XMLDocument[JC] def fullscreenEnabled: Boolean +XMLDocument[JC] def getElementById(elementId: String): Element +XMLDocument[JC] def getElementsByClassName(classNames: String): HTMLCollection[Element] +XMLDocument[JC] def getElementsByName(elementName: String): NodeList[Node] +XMLDocument[JC] def getElementsByTagName(name: String): HTMLCollection[Element] +XMLDocument[JC] def getElementsByTagNameNS(namespaceURI: String, localName: String): HTMLCollection[Element] +XMLDocument[JC] def hasChildNodes(): Boolean +XMLDocument[JC] def hidden: Boolean +XMLDocument[JC] def implementation: DOMImplementation +XMLDocument[JC] def importNode(importedNode: Node, deep: Boolean): Node +XMLDocument[JC] var innerText: String +XMLDocument[JC] def insertBefore(newChild: Node, refChild: Node): Node +XMLDocument[JC] def isConnected: Boolean +XMLDocument[JC] def isDefaultNamespace(namespaceURI: String): Boolean +XMLDocument[JC] def isEqualNode(arg: Node): Boolean +XMLDocument[JC] def isSameNode(other: Node): Boolean +XMLDocument[JC] def isSupported(feature: String, version: String): Boolean +XMLDocument[JC] def lastChild: Node +XMLDocument[JC] def lastElementChild: Element +XMLDocument[JC] def lastModified: String +XMLDocument[JC] def localName: String +XMLDocument[JC] def lookupNamespaceURI(prefix: String): String +XMLDocument[JC] def lookupPrefix(namespaceURI: String): String +XMLDocument[JC] def namespaceURI: String +XMLDocument[JC] def nextSibling: Node +XMLDocument[JC] def nodeName: String +XMLDocument[JC] def nodeType: Int +XMLDocument[JC] var nodeValue: String +XMLDocument[JC] def normalize(): Unit +XMLDocument[JC] var onfullscreenchange: js.Function1[Event, _] +XMLDocument[JC] var onfullscreenerror: js.Function1[Event, _] +XMLDocument[JC] var onpointerlockchange: js.Function1[Event, _] +XMLDocument[JC] var onpointerlockerror: js.Function1[Event, _] +XMLDocument[JC] def ownerDocument: Document +XMLDocument[JC] def parentNode: Node +XMLDocument[JC] def pointerLockElement: Element +XMLDocument[JC] def previousSibling: Node +XMLDocument[JC] def querySelector(selectors: String): Element +XMLDocument[JC] def querySelectorAll(selectors: String): NodeList[Element] +XMLDocument[JC] def removeChild(oldChild: Node): Node +XMLDocument[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +XMLDocument[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +XMLDocument[JC] def replaceChild(newChild: Node, oldChild: Node): Node +XMLDocument[JC] def replaceChildren(nodes: Node | String*): Unit +XMLDocument[JC] def styleSheets: StyleSheetList +XMLDocument[JC] var textContent: String +XMLDocument[JC] def visibilityState: VisibilityState | String +XMLDocument[JC] var visibilitychange: js.Function1[Event, _] XMLHttpRequest[JC] def abort(): Unit XMLHttpRequest[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit XMLHttpRequest[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit @@ -27647,6 +27803,7 @@ intl/DateTimeFormat[JC] def supportedLocalesOf(locales: String | js.Array[String intl/DateTimeFormatOptions[JT] var day: js.UndefOr[String] intl/DateTimeFormatOptions[JT] var era: js.UndefOr[String] intl/DateTimeFormatOptions[JT] var formatMatcher: js.UndefOr[String] +intl/DateTimeFormatOptions[JT] var fractionalSecondDigits: js.UndefOr[Int] intl/DateTimeFormatOptions[JT] var hour: js.UndefOr[String] intl/DateTimeFormatOptions[JT] var hour12: js.UndefOr[Boolean] intl/DateTimeFormatOptions[JT] var localeMatcher: js.UndefOr[String] diff --git a/api-reports/2_13.txt b/api-reports/2_13.txt index 0d273a2be..b9f9637ca 100644 --- a/api-reports/2_13.txt +++ b/api-reports/2_13.txt @@ -1348,6 +1348,12 @@ CompositionEventInit[JT] var detail: js.UndefOr[Int] CompositionEventInit[JT] var locale: js.UndefOr[String] CompositionEventInit[JT] var scoped: js.UndefOr[Boolean] CompositionEventInit[JT] var view: js.UndefOr[Window] +CompressionFormat[JT] +CompressionFormat[SO] val deflate: CompressionFormat +CompressionFormat[SO] val `deflate-raw`: CompressionFormat +CompressionFormat[SO] val gzip: CompressionFormat +CompressionStream[JC] def readable: ReadableStream[Uint8Array] +CompressionStream[JC] def writable: WriteableStream[Uint8Array] ConcatParams[JT] val algorithmId: BufferSource ConcatParams[JT] val hash: HashAlgorithmIdentifier ConcatParams[JT] val name: String @@ -1496,6 +1502,10 @@ DOMRect[JC] def x: Double DOMRect[JC] def x_ = (x: Double): Unit DOMRect[JC] def y: Double DOMRect[JC] def y_ = (y: Double): Unit +DOMRectInit[JT] var height: js.UndefOr[Double] +DOMRectInit[JT] var width: js.UndefOr[Double] +DOMRectInit[JT] var x: js.UndefOr[Double] +DOMRectInit[JT] var y: js.UndefOr[Double] DOMRectList[JC] @JSBracketAccess def apply(index: Int): T DOMRectList[JC] def length: Int DOMRectReadOnly[JT] def bottom: Double @@ -1561,6 +1571,8 @@ DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): D DataTransferItemList[JC] def clear(): Unit DataTransferItemList[JC] def length: Int DataTransferItemList[JC] def remove(index: Int): Unit +DecompressionStream[JC] def readable: ReadableStream[Uint8Array] +DecompressionStream[JC] def writable: WriteableStream[Uint8Array] DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit @@ -1725,7 +1737,11 @@ Document[JC] def createCDATASection(data: String): CDATASection Document[JC] def createComment(data: String): Comment Document[JC] def createDocumentFragment(): DocumentFragment Document[JC] def createElement(tagName: String): Element +Document[JC] def createElement(tagName: String, options: ElementCreationOptions): Element +Document[JC] def createElement(tagName: String, options: String): Element Document[JC] def createElementNS(namespaceURI: String, qualifiedName: String): Element +Document[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element +Document[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element Document[JC] def createEvent(eventInterface: String): Event Document[JC] def createNSResolver(node: Node): XPathNSResolver Document[JC] def createNodeIterator(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): NodeIterator @@ -2065,6 +2081,7 @@ Element[JC] def setAttributeNodeNS(newAttr: Attr): Attr Element[JC] def shadowRoot: ShadowRoot Element[JC] def tagName: String Element[JC] var textContent: String +ElementCreationOptions[JT] var is: js.UndefOr[String] ElementDefinitionOptions[JT] var `extends`: js.UndefOr[String] EndOfStreamError[JT] EndOfStreamError[SO] val decode: EndOfStreamError @@ -2286,7 +2303,18 @@ FocusEventInit[JT] var scoped: js.UndefOr[Boolean] FocusEventInit[JT] var view: js.UndefOr[Window] FocusOptions[JT] var focusVisible: js.UndefOr[Boolean] FocusOptions[JT] var preventScroll: js.UndefOr[Boolean] -FormData[JC] def append(name: js.Any, value: js.Any, blobName: String?): Unit +FormData[JC] def append(name: String, value: Blob, blobName: String?): Unit +FormData[JC] def append(name: String, value: String): Unit +FormData[JC] def delete(name: String): Unit +FormData[JC] def entries(): js.Iterator[js.Tuple2[String, String | Blob]] +FormData[JC] def get(name: String): String | Blob +FormData[JC] def getAll(name: String): js.Array[String | Blob] +FormData[JC] def has(name: String): Boolean +FormData[JC] @JSName(js.Symbol.iterator) override def jsIterator(): js.Iterator[js.Tuple2[String, String | Blob]] +FormData[JC] def keys(): js.Iterator[String] +FormData[JC] def set(name: String, value: Blob, blobName: String?): Unit +FormData[JC] def set(name: String, value: String): Unit +FormData[JC] def values(): js.Iterator[String | Blob] FormData[JO] FrameType[JT] FrameType[SO] val auxiliary: FrameType @@ -2380,6 +2408,7 @@ HTMLAnchorElement[JC] var contentEditable: String HTMLAnchorElement[JC] def dataset: js.Dictionary[String] HTMLAnchorElement[JC] var dir: String HTMLAnchorElement[JC] def dispatchEvent(evt: Event): Boolean +HTMLAnchorElement[JC] var download: String HTMLAnchorElement[JC] var draggable: Boolean HTMLAnchorElement[JC] var filters: Object HTMLAnchorElement[JC] def firstChild: Node @@ -4901,7 +4930,11 @@ HTMLDocument[JC] def createCDATASection(data: String): CDATASection HTMLDocument[JC] def createComment(data: String): Comment HTMLDocument[JC] def createDocumentFragment(): DocumentFragment HTMLDocument[JC] def createElement(tagName: String): Element +HTMLDocument[JC] def createElement(tagName: String, options: ElementCreationOptions): Element +HTMLDocument[JC] def createElement(tagName: String, options: String): Element HTMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String): Element +HTMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element +HTMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element HTMLDocument[JC] def createEvent(eventInterface: String): Event HTMLDocument[JC] def createNSResolver(node: Node): XPathNSResolver HTMLDocument[JC] def createNodeIterator(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): NodeIterator @@ -15502,6 +15535,30 @@ InputType[SO] val insertReplacementText: InputType InputType[SO] val insertText: InputType InputType[SO] val insertTranspose: InputType InputType[SO] val insertUnorderedList: InputType +IntersectionObserver[JC] def disconnect(): Unit +IntersectionObserver[JC] def observe(target: Element): Unit +IntersectionObserver[JC] def root: Document | Element +IntersectionObserver[JC] def rootMargin: String +IntersectionObserver[JC] def takeRecords(): js.Array[IntersectionObserverEntry] +IntersectionObserver[JC] def thresholds: FrozenArray[Double] +IntersectionObserver[JC] def unobserve(target: Element): Unit +IntersectionObserverEntry[JC] def boundingClientRect: DOMRectReadOnly +IntersectionObserverEntry[JC] def intersectionRatio: Double +IntersectionObserverEntry[JC] def intersectionRect: DOMRectReadOnly +IntersectionObserverEntry[JC] def isIntersecting: Boolean +IntersectionObserverEntry[JC] def rootBounds: DOMRectReadOnly +IntersectionObserverEntry[JC] def target: Element +IntersectionObserverEntry[JC] def time: Double +IntersectionObserverEntryInit[JT] var boundingClientRect: DOMRectInit +IntersectionObserverEntryInit[JT] var intersectionRatio: Double +IntersectionObserverEntryInit[JT] var intersectionRect: DOMRectInit +IntersectionObserverEntryInit[JT] var isIntersecting: Boolean +IntersectionObserverEntryInit[JT] var rootBounds: DOMRectInit +IntersectionObserverEntryInit[JT] var target: Element +IntersectionObserverEntryInit[JT] var time: Double +IntersectionObserverInit[JT] var root: js.UndefOr[Document | Element] +IntersectionObserverInit[JT] var rootMargin: js.UndefOr[String] +IntersectionObserverInit[JT] var threshold: js.UndefOr[Double | js.Array[Double]] JsonWebKey[JT] var alg: js.Array[String] JsonWebKey[JT] var crv: String JsonWebKey[JT] var d: String @@ -16420,13 +16477,20 @@ Navigator[JC] def mediaDevices: MediaDevices Navigator[JC] def onLine: Boolean Navigator[JC] val permissions: Permissions Navigator[JC] def platform: String +Navigator[JC] def registerProtocolHandler(scheme: String, url: String): Unit +Navigator[JC] def registerProtocolHandler(scheme: String, url: URL): Unit Navigator[JC] def sendBeacon(url: String, data: BodyInit?): Boolean Navigator[JC] val serviceWorker: ServiceWorkerContainer Navigator[JC] def storage: StorageManager +Navigator[JC] def unregisterProtocolHandler(scheme: String, url: String): Unit +Navigator[JC] def unregisterProtocolHandler(scheme: String, url: URL): Unit Navigator[JC] def userAgent: String Navigator[JC] def vibrate(duration: Double): Boolean Navigator[JC] def vibrate(pattern: js.Array[Double]): Boolean -NavigatorContentUtils[JT] +NavigatorContentUtils[JT] def registerProtocolHandler(scheme: String, url: String): Unit +NavigatorContentUtils[JT] def registerProtocolHandler(scheme: String, url: URL): Unit +NavigatorContentUtils[JT] def unregisterProtocolHandler(scheme: String, url: String): Unit +NavigatorContentUtils[JT] def unregisterProtocolHandler(scheme: String, url: URL): Unit NavigatorGeolocation[JT] def geolocation: Geolocation NavigatorID[JT] def appName: String NavigatorID[JT] def appVersion: String @@ -26181,6 +26245,7 @@ URL[JC] var search: String URL[JC] var searchParams: URLSearchParams URL[JC] var username: String URL[JO] def createObjectURL(blob: Blob): String +URL[JO] def createObjectURL(src: MediaSource): String URL[JO] def revokeObjectURL(url: String): Unit URLSearchParams[JC] def append(name: String, value: String): Unit URLSearchParams[JC] def delete(name: String): Unit @@ -27071,6 +27136,97 @@ WriteableStream[JT] val closed: js.Promise[WriteableStream[T]] WriteableStream[JT] val ready: js.Promise[WriteableStream[T]] WriteableStream[JT] def state: WriteableState WriteableStream[JT] def write(chunk: Chunk[T]): js.Promise[Any] +XMLDocument[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +XMLDocument[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +XMLDocument[JC] def adoptNode(source: Node): Node +XMLDocument[JC] def appendChild(newChild: Node): Node +XMLDocument[JC] def baseURI: String +XMLDocument[JC] def characterSet: String +XMLDocument[JC] def childElementCount: Int +XMLDocument[JC] def childNodes: NodeList[Node] +XMLDocument[JC] def children: HTMLCollection[Element] +XMLDocument[JC] def cloneNode(deep: Boolean?): Node +XMLDocument[JC] def compareDocumentPosition(other: Node): Int +XMLDocument[JC] def contains(otherNode: Node): Boolean +XMLDocument[JC] def createAttribute(name: String): Attr +XMLDocument[JC] def createAttributeNS(namespaceURI: String, qualifiedName: String): Attr +XMLDocument[JC] def createCDATASection(data: String): CDATASection +XMLDocument[JC] def createComment(data: String): Comment +XMLDocument[JC] def createDocumentFragment(): DocumentFragment +XMLDocument[JC] def createElement(tagName: String): Element +XMLDocument[JC] def createElement(tagName: String, options: ElementCreationOptions): Element +XMLDocument[JC] def createElement(tagName: String, options: String): Element +XMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String): Element +XMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element +XMLDocument[JC] def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element +XMLDocument[JC] def createEvent(eventInterface: String): Event +XMLDocument[JC] def createNSResolver(node: Node): XPathNSResolver +XMLDocument[JC] def createNodeIterator(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): NodeIterator +XMLDocument[JC] def createProcessingInstruction(target: String, data: String): ProcessingInstruction +XMLDocument[JC] def createRange(): Range +XMLDocument[JC] def createStyleSheet(href: String?, index: Int?): CSSStyleSheet +XMLDocument[JC] def createTextNode(data: String): Text +XMLDocument[JC] def createTreeWalker(root: Node, whatToShow: Int, filter: NodeFilter, entityReferenceExpansion: Boolean): TreeWalker +XMLDocument[JC] def dispatchEvent(evt: Event): Boolean +XMLDocument[JC] def doctype: DocumentType +XMLDocument[JC] def documentElement: Element +XMLDocument[JC] def documentURI: String +XMLDocument[JC] def elementFromPoint(x: Double, y: Double): Element +XMLDocument[JC] def evaluate(xpathExpression: String, contextNode: Node, namespaceResolver: XPathNSResolver, resultType: Int, result: XPathResult): XPathResult +XMLDocument[JC] def evaluate(xpathExpression: String, contextNode: Node, namespaceResolver: js.Function1[String, String], resultType: Int, result: XPathResult): XPathResult +XMLDocument[JC] def exitFullscreen(): js.Promise[Unit] +XMLDocument[JC] def exitPointerLock(): Unit +XMLDocument[JC] def firstChild: Node +XMLDocument[JC] def firstElementChild: Element +XMLDocument[JC] def fullscreenElement: Element +XMLDocument[JC] def fullscreenEnabled: Boolean +XMLDocument[JC] def getElementById(elementId: String): Element +XMLDocument[JC] def getElementsByClassName(classNames: String): HTMLCollection[Element] +XMLDocument[JC] def getElementsByName(elementName: String): NodeList[Node] +XMLDocument[JC] def getElementsByTagName(name: String): HTMLCollection[Element] +XMLDocument[JC] def getElementsByTagNameNS(namespaceURI: String, localName: String): HTMLCollection[Element] +XMLDocument[JC] def hasChildNodes(): Boolean +XMLDocument[JC] def hidden: Boolean +XMLDocument[JC] def implementation: DOMImplementation +XMLDocument[JC] def importNode(importedNode: Node, deep: Boolean): Node +XMLDocument[JC] var innerText: String +XMLDocument[JC] def insertBefore(newChild: Node, refChild: Node): Node +XMLDocument[JC] def isConnected: Boolean +XMLDocument[JC] def isDefaultNamespace(namespaceURI: String): Boolean +XMLDocument[JC] def isEqualNode(arg: Node): Boolean +XMLDocument[JC] def isSameNode(other: Node): Boolean +XMLDocument[JC] def isSupported(feature: String, version: String): Boolean +XMLDocument[JC] def lastChild: Node +XMLDocument[JC] def lastElementChild: Element +XMLDocument[JC] def lastModified: String +XMLDocument[JC] def localName: String +XMLDocument[JC] def lookupNamespaceURI(prefix: String): String +XMLDocument[JC] def lookupPrefix(namespaceURI: String): String +XMLDocument[JC] def namespaceURI: String +XMLDocument[JC] def nextSibling: Node +XMLDocument[JC] def nodeName: String +XMLDocument[JC] def nodeType: Int +XMLDocument[JC] var nodeValue: String +XMLDocument[JC] def normalize(): Unit +XMLDocument[JC] var onfullscreenchange: js.Function1[Event, _] +XMLDocument[JC] var onfullscreenerror: js.Function1[Event, _] +XMLDocument[JC] var onpointerlockchange: js.Function1[Event, _] +XMLDocument[JC] var onpointerlockerror: js.Function1[Event, _] +XMLDocument[JC] def ownerDocument: Document +XMLDocument[JC] def parentNode: Node +XMLDocument[JC] def pointerLockElement: Element +XMLDocument[JC] def previousSibling: Node +XMLDocument[JC] def querySelector(selectors: String): Element +XMLDocument[JC] def querySelectorAll(selectors: String): NodeList[Element] +XMLDocument[JC] def removeChild(oldChild: Node): Node +XMLDocument[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit +XMLDocument[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit +XMLDocument[JC] def replaceChild(newChild: Node, oldChild: Node): Node +XMLDocument[JC] def replaceChildren(nodes: Node | String*): Unit +XMLDocument[JC] def styleSheets: StyleSheetList +XMLDocument[JC] var textContent: String +XMLDocument[JC] def visibilityState: VisibilityState | String +XMLDocument[JC] var visibilitychange: js.Function1[Event, _] XMLHttpRequest[JC] def abort(): Unit XMLHttpRequest[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit XMLHttpRequest[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit @@ -27647,6 +27803,7 @@ intl/DateTimeFormat[JC] def supportedLocalesOf(locales: String | js.Array[String intl/DateTimeFormatOptions[JT] var day: js.UndefOr[String] intl/DateTimeFormatOptions[JT] var era: js.UndefOr[String] intl/DateTimeFormatOptions[JT] var formatMatcher: js.UndefOr[String] +intl/DateTimeFormatOptions[JT] var fractionalSecondDigits: js.UndefOr[Int] intl/DateTimeFormatOptions[JT] var hour: js.UndefOr[String] intl/DateTimeFormatOptions[JT] var hour12: js.UndefOr[Boolean] intl/DateTimeFormatOptions[JT] var localeMatcher: js.UndefOr[String] diff --git a/dom/src/main/scala-2/org/scalajs/dom/CompressionFormat.scala b/dom/src/main/scala-2/org/scalajs/dom/CompressionFormat.scala new file mode 100644 index 000000000..220dcc8f4 --- /dev/null +++ b/dom/src/main/scala-2/org/scalajs/dom/CompressionFormat.scala @@ -0,0 +1,14 @@ +package org.scalajs.dom + +import scala.scalajs.js + +@js.native +sealed trait CompressionFormat extends js.Any + +object CompressionFormat { + val deflate: CompressionFormat = "deflate".asInstanceOf[CompressionFormat] + + val `deflate-raw`: CompressionFormat = "deflate-raw".asInstanceOf[CompressionFormat] + + val gzip: CompressionFormat = "gzip".asInstanceOf[CompressionFormat] +} diff --git a/dom/src/main/scala-3/org/scalajs/dom/CompressionFormat.scala b/dom/src/main/scala-3/org/scalajs/dom/CompressionFormat.scala new file mode 100644 index 000000000..cd5d630bc --- /dev/null +++ b/dom/src/main/scala-3/org/scalajs/dom/CompressionFormat.scala @@ -0,0 +1,13 @@ +package org.scalajs.dom + +import scala.scalajs.js + +opaque type CompressionFormat <: String = String + +object CompressionFormat { + val deflate: CompressionFormat = "deflate" + + val `deflate-raw`: CompressionFormat = "deflate-raw" + + val gzip: CompressionFormat = "gzip" +} diff --git a/dom/src/main/scala/org/scalajs/dom/CompressionStream.scala b/dom/src/main/scala/org/scalajs/dom/CompressionStream.scala new file mode 100644 index 000000000..7842b46a4 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/CompressionStream.scala @@ -0,0 +1,19 @@ +/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API + * and available under the Creative Commons Attribution-ShareAlike v2.5 or later. + * http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ +import scala.scalajs.js.typedarray.Uint8Array + +/** An API for compressing a stream of data. */ +@js.native +@JSGlobal +class CompressionStream(format: CompressionFormat) extends js.Object { + def readable: ReadableStream[Uint8Array] = js.native + def writable: WriteableStream[Uint8Array] = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/DOMRectInit.scala b/dom/src/main/scala/org/scalajs/dom/DOMRectInit.scala new file mode 100644 index 000000000..5677ebba2 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/DOMRectInit.scala @@ -0,0 +1,13 @@ +package org.scalajs.dom + +import scala.scalajs.js + +trait DOMRectInit extends js.Object { + var x: js.UndefOr[Double] = js.undefined + + var y: js.UndefOr[Double] = js.undefined + + var width: js.UndefOr[Double] = js.undefined + + var height: js.UndefOr[Double] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/DecompressionStream.scala b/dom/src/main/scala/org/scalajs/dom/DecompressionStream.scala new file mode 100644 index 000000000..8eb1f9ccb --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/DecompressionStream.scala @@ -0,0 +1,19 @@ +/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API + * and available under the Creative Commons Attribution-ShareAlike v2.5 or later. + * http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ +import scala.scalajs.js.typedarray.Uint8Array + +/** An API for decompressing a stream of data. */ +@js.native +@JSGlobal +class DecompressionStream(format: CompressionFormat) extends js.Object { + def readable: ReadableStream[Uint8Array] = js.native + def writable: WriteableStream[Uint8Array] = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/Document.scala b/dom/src/main/scala/org/scalajs/dom/Document.scala index e3fc43f27..691270fe3 100644 --- a/dom/src/main/scala/org/scalajs/dom/Document.scala +++ b/dom/src/main/scala/org/scalajs/dom/Document.scala @@ -126,9 +126,17 @@ abstract class Document extends Node with NodeSelector with DocumentEvent with P */ def createElement(tagName: String): Element = js.native + def createElement(tagName: String, options: String): Element = js.native + + def createElement(tagName: String, options: ElementCreationOptions): Element = js.native + /** Creates an element with the specified namespace URI and qualified name. */ def createElementNS(namespaceURI: String, qualifiedName: String): Element = js.native + def createElementNS(namespaceURI: String, qualifiedName: String, options: String): Element = js.native + + def createElementNS(namespaceURI: String, qualifiedName: String, options: ElementCreationOptions): Element = js.native + /** createAttribute creates a new attribute node, and returns it. */ def createAttribute(name: String): Attr = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/ElementCreationOptions.scala b/dom/src/main/scala/org/scalajs/dom/ElementCreationOptions.scala new file mode 100644 index 000000000..c16e82ac2 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/ElementCreationOptions.scala @@ -0,0 +1,7 @@ +package org.scalajs.dom + +import scala.scalajs.js + +trait ElementCreationOptions extends js.Object { + var is: js.UndefOr[String] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/FormData.scala b/dom/src/main/scala/org/scalajs/dom/FormData.scala index 6e0735561..fe73f6633 100644 --- a/dom/src/main/scala/org/scalajs/dom/FormData.scala +++ b/dom/src/main/scala/org/scalajs/dom/FormData.scala @@ -8,6 +8,7 @@ package org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.annotation._ +import scala.scalajs.js.| /** XMLHttpRequest Level 2 adds support for the new FormData interface. FormData objects provide a way to easily * construct a set of key/value pairs representing form fields and their values, which can then be easily sent using @@ -15,10 +16,108 @@ import scala.scalajs.js.annotation._ */ @js.native @JSGlobal -class FormData(form: HTMLFormElement = js.native) extends js.Object { +class FormData extends js.Iterable[js.Tuple2[String, String | Blob]] { - /** Appends a key/value pair to the FormData object. */ - def append(name: js.Any, value: js.Any, blobName: String = js.native): Unit = js.native + def this(form: HTMLFormElement) = this() + + def this(form: HTMLFormElement, submitter: HTMLElement) = this() + + /** The `append()` method of the `FormData` interface appends a new value onto an existing key inside a `FormData` + * object, or adds the key if it does not already exist. + * + * @param name + * The name of the field whose data is contained in value. + * @param value + * The field's value. This can be a string or `Blob` (including subclasses such as File). If none of these are + * specified the value is converted to a string. + */ + def append(name: String, value: String): Unit = js.native + + /** The `append()` method of the `FormData` interface appends a new value onto an existing key inside a `FormData` + * object, or adds the key if it does not already exist. + * + * @param name + * The name of the field whose data is contained in value. + * @param value + * The field's value. This can be a string or `Blob` (including subclasses such as File). If none of these are + * specified the value is converted to a string. + * @param blobName + * The filename reported to the server (a string), when a `Blob` or `File` is passed as the second parameter. The + * default filename for `Blob` objects is "blob". The default filename for `File` objects is the file's filename. + */ + def append(name: String, value: Blob, blobName: String = js.native): Unit = js.native + + /** The `delete()` method of the `FormData` interface deletes a key and its value(s) from a `FormData` object. + * @param name + * The name of the key you want to delete. + */ + def delete(name: String): Unit = js.native + + /** The `get()` method of the `FormData` interface returns the first value associated with a given key from within a + * `FormData` object. If you expect multiple values and want all of them, use the `getAll()` method instead. + * + * @param name + * A string representing the name of the key you want to retrieve. + * @return + * A value whose key matches the specified name. Otherwise, `null`. + */ + def get(name: String): String | Blob = js.native + + /** The `has()` method of the `FormData` interface returns whether a `FormData` object contains a certain key. + * + * @param name + * A string representing the name of the key you want to test for. + * @return + * `true` if a key of `FormData` matches the specified name. Otherwise, `false`. + */ + def has(name: String): Boolean = js.native + + /** The `set()` method of the `FormData` interface sets a new value for an existing key inside a `FormData` object, or + * adds the key/value if it does not already exist. + * + * @param name + * The name of the field whose data is contained in value. + * @param value + * The field's value. + */ + def set( + name: String, value: String + ): Unit = js.native + + /** The `set()` method of the `FormData` interface sets a new value for an existing key inside a `FormData` object, or + * adds the key/value if it does not already exist. + * + * @param name + * The name of the field whose data is contained in value. + * @param value + * The field's value. + */ + def set( + name: String, value: Blob, blobName: String = js.native + ): Unit = js.native + + @JSName(js.Symbol.iterator) + override def jsIterator(): js.Iterator[js.Tuple2[String, String | Blob]] = js.native + + /** The `FormData.entries()` method returns an iterator which iterates through all key/value pairs contained in the + * `FormData`. The key of each pair is a string object, and the value is either a string or a `Blob`. + */ + def entries(): js.Iterator[js.Tuple2[String, String | Blob]] = js.native + + /** The `getAll()` method of the `FormData` interface returns all the values associated with a given key from within a + * `FormData` object. + */ + def getAll(name: String): js.Array[String | Blob] = js.native + + /** The `FormData.keys()` method returns an iterator which iterates through all keys contained in the `FormData`. The + * keys are strings. + */ + def keys(): js.Iterator[String] = js.native + + /** The `FormData.values()` method returns an iterator which iterates through all values contained in the `FormData`. + * The values are strings or `Blob` objects. + */ + def values(): js.Iterator[String | Blob] = js.native } @js.native diff --git a/dom/src/main/scala/org/scalajs/dom/HTMLAnchorElement.scala b/dom/src/main/scala/org/scalajs/dom/HTMLAnchorElement.scala index 3a030755f..9c1c08ae3 100644 --- a/dom/src/main/scala/org/scalajs/dom/HTMLAnchorElement.scala +++ b/dom/src/main/scala/org/scalajs/dom/HTMLAnchorElement.scala @@ -17,6 +17,12 @@ import scala.scalajs.js.annotation._ @JSGlobal abstract class HTMLAnchorElement extends HTMLElement { + /** A string indicating that the linked resource is intended to be downloaded rather than displayed in the browser. + * The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, + * browser will adapt it. + */ + var download: String = js.native + /** Is a DOMString that reflects the rel HTML attribute, specifying the relationship of the target object to the link * object. */ @@ -25,7 +31,7 @@ abstract class HTMLAnchorElement extends HTMLElement { /** Is a DOMString representing the protocol component, including trailing colon (':'), of the referenced URL. */ var protocol: String = js.native - /** Is a DOMString representing tThe search element, including leading question mark ('?'), if any, of the referenced + /** Is a DOMString representing the search element, including leading question mark ('?'), if any, of the referenced * URL. */ var search: String = js.native diff --git a/dom/src/main/scala/org/scalajs/dom/IntersectionObserver.scala b/dom/src/main/scala/org/scalajs/dom/IntersectionObserver.scala new file mode 100644 index 000000000..bc7f40158 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/IntersectionObserver.scala @@ -0,0 +1,46 @@ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation.JSGlobal +import scala.scalajs.js.| + +/** The IntersectionObserver interface of the Intersection Observer API provides a way to asynchronously observe changes + * in the intersection of a target element with an ancestor element or with a top-level document's viewport. + */ +@js.native +@JSGlobal +class IntersectionObserver( + callback: js.Function2[js.Array[IntersectionObserverEntry], IntersectionObserver, Unit], + options: IntersectionObserverInit = js.native +) extends js.Object { + + /** The Element or Document whose bounds are used as the bounding box when testing for intersection. If no root value + * was passed to the constructor or its value is null, the top-level document's viewport is used. + */ + def root: Document | Element = js.native + + /** An offset rectangle applied to the root's bounding box when calculating intersections, effectively shrinking or + * growing the root for calculation purposes. The value returned by this property may not be the same as the one + * specified when calling the constructor as it may be changed to match internal requirements. Each offset can be + * expressed in pixels (px) or as a percentage (%). The default is "0px 0px 0px 0px". + */ + def rootMargin: String = js.native + + /** A list of thresholds, sorted in increasing numeric order, where each threshold is a ratio of intersection area to + * bounding box area of an observed target. Notifications for a target are generated when any of the thresholds are + * crossed for that target. If no value was passed to the constructor, 0 is used. + */ + def thresholds: FrozenArray[Double] = js.native + + /** Stops the IntersectionObserver object from observing any target. */ + def disconnect(): Unit = js.native + + /** Tells the IntersectionObserver a target element to observe. */ + def observe(target: Element): Unit = js.native + + /** Returns an array of IntersectionObserverEntry objects for all observed targets. */ + def takeRecords(): js.Array[IntersectionObserverEntry] = js.native + + /** Tells the IntersectionObserver to stop observing a particular target element. */ + def unobserve(target: Element): Unit = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/IntersectionObserverEntry.scala b/dom/src/main/scala/org/scalajs/dom/IntersectionObserverEntry.scala new file mode 100644 index 000000000..0a9c46d0c --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/IntersectionObserverEntry.scala @@ -0,0 +1,38 @@ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation.JSGlobal + +/** The IntersectionObserverEntry interface of the Intersection Observer API describes the intersection between the + * target element and its root container at a specific moment of transition. + */ +@js.native +@JSGlobal +class IntersectionObserverEntry(init: IntersectionObserverEntryInit) extends js.Object { + + /** The bounds rectangle of the target element as a DOMRectReadOnly. */ + def boundingClientRect: DOMRectReadOnly = js.native + + /** The ratio of the intersectionRect to the boundingClientRect. */ + def intersectionRatio: Double = js.native + + /** A DOMRectReadOnly representing the target's visible area. */ + def intersectionRect: DOMRectReadOnly = js.native + + /** A Boolean value which is true if the target element intersects with the intersection observer's root. If this is + * true, then, the IntersectionObserverEntry describes a transition into a state of intersection; if it's false, then + * you know the transition is from intersecting to not-intersecting. + */ + def isIntersecting: Boolean = js.native + + /** A DOMRectReadOnly for the intersection observer's root. */ + def rootBounds: DOMRectReadOnly = js.native + + /** The Element whose intersection with the root changed. */ + def target: Element = js.native + + /** A DOMHighResTimeStamp indicating the time at which the intersection was recorded, relative to the + * IntersectionObserver's time origin. + */ + def time: Double = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/IntersectionObserverEntryInit.scala b/dom/src/main/scala/org/scalajs/dom/IntersectionObserverEntryInit.scala new file mode 100644 index 000000000..08b1e26bd --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/IntersectionObserverEntryInit.scala @@ -0,0 +1,20 @@ +package org.scalajs.dom + +import scala.scalajs.js + +trait IntersectionObserverEntryInit extends js.Object { + + var boundingClientRect: DOMRectInit + + var intersectionRatio: Double + + var intersectionRect: DOMRectInit + + var isIntersecting: Boolean + + var rootBounds: DOMRectInit + + var target: Element + + var time: Double +} diff --git a/dom/src/main/scala/org/scalajs/dom/IntersectionObserverInit.scala b/dom/src/main/scala/org/scalajs/dom/IntersectionObserverInit.scala new file mode 100644 index 000000000..2f965f43c --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/IntersectionObserverInit.scala @@ -0,0 +1,27 @@ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.| + +/** An object which customizes the observer. */ +trait IntersectionObserverInit extends js.Object { + + /** An Element or Document object which is an ancestor of the intended target, whose bounding rectangle will be + * considered the viewport. Any part of the target not visible in the visible area of the root is not considered + * visible. + */ + var root: js.UndefOr[Document | Element] = js.undefined + + /** A string which specifies a set of offsets to add to the root's bounding_box when calculating intersections, + * effectively shrinking or growing the root for calculation purposes. The syntax is approximately the same as that + * for the CSS margin property; see The intersection root and root margin for more information on how the margin + * works and the syntax. The default is "0px 0px 0px 0px". + */ + var rootMargin: js.UndefOr[String] = js.undefined + + /** Either a single number or an array of numbers between 0.0 and 1.0, specifying a ratio of intersection area to + * total bounding box area for the observed target. A value of 0.0 means that even a single visible pixel counts as + * the target being visible. 1.0 means that the entire target element is visible. The default is a threshold of 0.0. + */ + var threshold: js.UndefOr[Double | js.Array[Double]] = js.undefined +} diff --git a/dom/src/main/scala/org/scalajs/dom/NavigatorContentUtils.scala b/dom/src/main/scala/org/scalajs/dom/NavigatorContentUtils.scala index 088ecc656..e4ba71fda 100644 --- a/dom/src/main/scala/org/scalajs/dom/NavigatorContentUtils.scala +++ b/dom/src/main/scala/org/scalajs/dom/NavigatorContentUtils.scala @@ -9,4 +9,66 @@ package org.scalajs.dom import scala.scalajs.js @js.native -trait NavigatorContentUtils extends js.Object +trait NavigatorContentUtils extends js.Object { + + /** The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular + * URL schemes (aka protocols). + * + * For example, this API lets webmail sites open mailto: URLs, or VoIP sites open tel: URLs. + * + * @see + * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler + * + * @param scheme + * A string containing the permitted scheme for the protocol that the site wishes to handle. For example, you can + * register to handle SMS text message links by passing the "sms" scheme. + * @param url + * A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced + * with the escaped URL to be handled. + * @return + * undefined + * + * @throws DOMException.SECURITY_ERR + * The user agent blocked the registration. This might happen if: + * - The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, + * etc.) + * - The handler URL's origin does not match the origin of the page calling this API. + * - The browser requires that this function is called from a secure context. + * - The browser requires that the handler's URL be over HTTPS. + * + * @throws DOMException.SYNTAX_ERR + * The %s placeholder is missing from the handler URL + */ + def registerProtocolHandler(scheme: String, url: String): Unit = js.native + def registerProtocolHandler(scheme: String, url: URL): Unit = js.native + + /** The Navigator method unregisterProtocolHandler() removes a protocol handler for a given URL scheme. + * + * This method is the inverse of registerProtocolHandler(). + * + * @see + * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/unregisterProtocolHandler + * + * @param scheme + * A string containing the permitted scheme in the protocol handler that will be unregistered. For example, you can + * unregister the handler for SMS text message links by passing the "sms" scheme. + * @param url + * A string containing the URL of the handler. This URL should match the one that was used to register the handler + * (e.g. it must include %s). + * @return + * undefined + * + * @throws DOMException.SECURITY_ERR + * The user agent blocked unregistration. This might happen if: + * - The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, + * etc.) + * - The handler URL's origin does not match the origin of the page calling this API. + * - The browser requires that this function is called from a secure context. + * - The browser requires that the handler's URL be over HTTPS. + * + * @throws DOMException.SYNTAX_ERR + * The %s placeholder is missing from the handler URL + */ + def unregisterProtocolHandler(scheme: String, url: String): Unit = js.native + def unregisterProtocolHandler(scheme: String, url: URL): Unit = js.native +} diff --git a/dom/src/main/scala/org/scalajs/dom/URL.scala b/dom/src/main/scala/org/scalajs/dom/URL.scala index ccd0f0a7f..aea3f3933 100644 --- a/dom/src/main/scala/org/scalajs/dom/URL.scala +++ b/dom/src/main/scala/org/scalajs/dom/URL.scala @@ -16,9 +16,12 @@ object URL extends js.Object { /** The URL.createObjectURL() static method creates a DOMString containing an URL representing the object given in * parameter. The URL lifetime is tied to the document in the window on which it was created. The new object URL - * represents the specified File object or Blob object. + * represents the specified File, Blob or MediaSource object. */ def createObjectURL(blob: Blob): String = js.native + + def createObjectURL(src: MediaSource): String = js.native + } /** The URL() constructor returns a newly created URL object representing the URL defined by the parameters. */ diff --git a/dom/src/main/scala/org/scalajs/dom/XMLDocument.scala b/dom/src/main/scala/org/scalajs/dom/XMLDocument.scala new file mode 100644 index 000000000..aa5580230 --- /dev/null +++ b/dom/src/main/scala/org/scalajs/dom/XMLDocument.scala @@ -0,0 +1,18 @@ +/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API + * and available under the Creative Commons Attribution-ShareAlike v2.5 or later. + * http://creativecommons.org/licenses/by-sa/2.5/ + * + * Everything else is under the MIT License http://opensource.org/licenses/MIT + */ +package org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.annotation._ + +/** The [[XMLDocument]] interface represents an XML document. It inherits from the generic [[Document]] and does not add + * any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of + * documents. + */ +@js.native +@JSGlobal +class XMLDocument extends Document diff --git a/dom/src/main/scala/org/scalajs/dom/intl/DateTimeFormatOptions.scala b/dom/src/main/scala/org/scalajs/dom/intl/DateTimeFormatOptions.scala index 958b1b012..7cf4d415e 100644 --- a/dom/src/main/scala/org/scalajs/dom/intl/DateTimeFormatOptions.scala +++ b/dom/src/main/scala/org/scalajs/dom/intl/DateTimeFormatOptions.scala @@ -57,6 +57,11 @@ trait DateTimeFormatOptions extends js.Object { /** The representation of the time zone name. Possible values are "short", "long". */ var timeZoneName: js.UndefOr[String] = js.undefined + + /** The number of digits used to represent fractions of a second (any additional digits are truncated). Possible + * values are 1, 2, 3. + */ + var fractionalSecondDigits: js.UndefOr[Int] = js.undefined } @deprecated("all members of DateTimeFormatOptions are deprecated", "2.0.0") diff --git a/project/build.properties b/project/build.properties index 46e43a97e..27430827b 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.2 +sbt.version=1.9.6 diff --git a/project/plugins.sbt b/project/plugins.sbt index 3ff46f291..a9ce080ea 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,4 +6,4 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.3.11") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: