-
Notifications
You must be signed in to change notification settings - Fork 161
Refresh DataTransfer API #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
armanbilge
merged 10 commits into
scala-js:main
from
zetashift:refresh-datatransfer-api
Feb 10, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
976316c
Refresh DataTransfer API
zetashift 5871123
Fix compile errors
zetashift ff85260
Remove wrongly copy pasted doc
zetashift 001c22a
Improve doc comments, fix function signature getAsString, api reports
zetashift c3d4492
DataTransferItem should be a class with a non-public constructor
zetashift 77404c2
DataTransferItemList should be a class with a non-public constructor
zetashift 932bb1b
api-reports and GetAsFile returns a file
zetashift d15fbef
Swap scaladocs / annotation
armanbilge 5a67f9f
Use ScalaJS Function1 and fix getAsString
zetashift 95127c2
Change naming of dropEffect and effectAllowed return types
zetashift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
dom/src/main/scala-2/org/scalajs/dom/DataTransferDropEffectKind.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait DataTransferDropEffectKind extends js.Any | ||
|
||
object DataTransferDropEffectKind { | ||
val none: DataTransferDropEffectKind = "none".asInstanceOf[DataTransferDropEffectKind] | ||
val copy: DataTransferDropEffectKind = "copy".asInstanceOf[DataTransferDropEffectKind] | ||
val link: DataTransferDropEffectKind = "link".asInstanceOf[DataTransferDropEffectKind] | ||
val move: DataTransferDropEffectKind = "move".asInstanceOf[DataTransferDropEffectKind] | ||
} |
18 changes: 18 additions & 0 deletions
18
dom/src/main/scala-2/org/scalajs/dom/DataTransferEffectAllowedKind.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait DataTransferEffectAllowedKind extends js.Any | ||
|
||
object DataTransferEffectAllowedKind { | ||
val none: DataTransferEffectAllowedKind= "none".asInstanceOf[DataTransferEffectAllowedKind] | ||
val copy: DataTransferEffectAllowedKind= "copy".asInstanceOf[DataTransferEffectAllowedKind] | ||
val copyLink: DataTransferEffectAllowedKind= "copyLink".asInstanceOf[DataTransferEffectAllowedKind] | ||
val copyMove: DataTransferEffectAllowedKind= "copyMove".asInstanceOf[DataTransferEffectAllowedKind] | ||
val link: DataTransferEffectAllowedKind= "link".asInstanceOf[DataTransferEffectAllowedKind] | ||
val linkMove: DataTransferEffectAllowedKind= "linkMove".asInstanceOf[DataTransferEffectAllowedKind] | ||
val move: DataTransferEffectAllowedKind= "move".asInstanceOf[DataTransferEffectAllowedKind] | ||
val all: DataTransferEffectAllowedKind= "all".asInstanceOf[DataTransferEffectAllowedKind] | ||
val uninitialized: DataTransferEffectAllowedKind= "uninitialized".asInstanceOf[DataTransferEffectAllowedKind] | ||
} |
11 changes: 11 additions & 0 deletions
11
dom/src/main/scala-2/org/scalajs/dom/DragDataItemKind.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait DragDataItemKind extends js.Any | ||
|
||
object DragDataItemKind { | ||
val string: DragDataItemKind = "string".asInstanceOf[DragDataItemKind] | ||
val file: DragDataItemKind = "file".asInstanceOf[DragDataItemKind] | ||
} |
12 changes: 12 additions & 0 deletions
12
dom/src/main/scala-3/org/scalajs/dom/DataTransferDropEffectKind.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type DataTransferDropEffectKind <: String = String | ||
|
||
object DataTransferDropEffectKind { | ||
val none: DataTransferDropEffectKind = "none" | ||
val copy: DataTransferDropEffectKind = "copy" | ||
val link: DataTransferDropEffectKind = "link" | ||
val move: DataTransferDropEffectKind = "move" | ||
} |
17 changes: 17 additions & 0 deletions
17
dom/src/main/scala-3/org/scalajs/dom/DataTransferEffectAllowedKind.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type DataTransferEffectAllowedKind <: String = String | ||
|
||
object DataTransferEffectAllowedKind { | ||
val none: DataTransferEffectAllowedKind = "none" | ||
val copy: DataTransferEffectAllowedKind = "copy" | ||
val copyLink: DataTransferEffectAllowedKind = "copyLink" | ||
val copyMove: DataTransferEffectAllowedKind = "copyMove" | ||
val link: DataTransferEffectAllowedKind = "link" | ||
val linkMove: DataTransferEffectAllowedKind = "linkMove" | ||
val move: DataTransferEffectAllowedKind = "move" | ||
val all: DataTransferEffectAllowedKind = "all" | ||
val uninitialized: DataTransferEffectAllowedKind = "uninitialized" | ||
} |
10 changes: 10 additions & 0 deletions
10
dom/src/main/scala-3/org/scalajs/dom/DragDataItemKind.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type DragDataItemKind <: String = String | ||
|
||
object DragDataItemKind { | ||
val string: DragDataItemKind = "string" | ||
val file: DragDataItemKind = "file" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** 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.JSGlobal | ||
|
||
/** Each DataTransferItem object is associated with a [[DataTransfer]] object. */ | ||
@js.native | ||
@JSGlobal | ||
class DataTransferItem private[this] extends js.Object { | ||
|
||
/** Returns the drag data item kind, one of: "string", "file". */ | ||
def kind: DragDataItemKind = js.native | ||
|
||
/** Returns the drag data item type string. */ | ||
def `type`: String = js.native | ||
|
||
/** Invokes the callback with the string data as the argument, if the drag data item kind is text. */ | ||
def getAsString(callback: js.Function1[String, Unit]): Unit = js.native | ||
|
||
/** Returns a File object, if the drag data item kind is File. */ | ||
def getAsFile(): File = js.native | ||
} |
41 changes: 41 additions & 0 deletions
41
dom/src/main/scala/org/scalajs/dom/DataTransferItemList.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** 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.JSGlobal | ||
|
||
/** A list of [[DataTransferItem]] objects representing items being dragged. During a drag operation, each DragEvent has | ||
* a dataTransfer property and that property is a DataTransferItemList. | ||
*/ | ||
@js.native | ||
@JSGlobal | ||
class DataTransferItemList private[this] extends js.Object { | ||
|
||
/** Returns the number of items in the drag data store. */ | ||
def length: Int = js.native | ||
|
||
/** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be | ||
* provided also. | ||
*/ | ||
def add(data: String, `type`: String): DataTransferItem = js.native | ||
|
||
/** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be | ||
* provided also. | ||
*/ | ||
def add(data: File): DataTransferItem = js.native | ||
|
||
/** Removes the indexth entry in the drag data store. */ | ||
def remove(index: Int): Unit = js.native | ||
|
||
/** Removes all the entries in the drag data store. */ | ||
def clear(): Unit = js.native | ||
|
||
/** Returns the DataTransferItem object representing the indexth entry in the drag data store. */ | ||
@js.annotation.JSBracketAccess | ||
def apply(index: Int): DataTransferItem = js.native | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.