-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
React: Identify components which are exported at the top-level of a c…
…ommonjs library (#264)
- Loading branch information
1 parent
b6f3ec8
commit 613bc2e
Showing
26 changed files
with
714 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
2 changes: 1 addition & 1 deletion
2
tests/react-integration-test/check-japgolly/r/react-dropzone/build.sbt
This file contains 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
97 changes: 97 additions & 0 deletions
97
...eact-dropzone/src/main/scala/typingsJapgolly/reactDropzone/components/ReactDropzone.scala
This file contains 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,97 @@ | ||
package typingsJapgolly.reactDropzone.components | ||
|
||
import japgolly.scalajs.react.Callback | ||
import japgolly.scalajs.react.ReactDragEventFrom | ||
import japgolly.scalajs.react.raw.React.Element | ||
import org.scalajs.dom.raw.HTMLElement | ||
import typingsJapgolly.StBuildingComponent | ||
import typingsJapgolly.react.mod.RefAttributes | ||
import typingsJapgolly.reactDropzone.mod.DropEvent | ||
import typingsJapgolly.reactDropzone.mod.DropzoneProps | ||
import typingsJapgolly.reactDropzone.mod.DropzoneRef | ||
import typingsJapgolly.reactDropzone.mod.DropzoneState | ||
import org.scalablytyped.runtime.StObject | ||
import scala.scalajs.js | ||
import scala.scalajs.js.`|` | ||
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} | ||
|
||
object ReactDropzone { | ||
|
||
@JSImport("react-dropzone", JSImport.Default) | ||
@js.native | ||
val component: js.Object = js.native | ||
|
||
@scala.inline | ||
class Builder (val args: js.Array[js.Any]) | ||
extends AnyVal | ||
with StBuildingComponent[DropzoneRef] { | ||
|
||
@scala.inline | ||
def accept(value: String | js.Array[String]): this.type = set("accept", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def acceptVarargs(value: String*): this.type = set("accept", js.Array(value :_*)) | ||
|
||
@scala.inline | ||
def children(value: /* state */ DropzoneState => Element): this.type = set("children", js.Any.fromFunction1(value)) | ||
|
||
@scala.inline | ||
def disabled(value: Boolean): this.type = set("disabled", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def getFilesFromEvent( | ||
value: /* event */ DropEvent => /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise<Array<File | DataTransferItem>> */ _ | ||
): this.type = set("getFilesFromEvent", js.Any.fromFunction1(value)) | ||
|
||
@scala.inline | ||
def maxSize(value: Double): this.type = set("maxSize", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def minSize(value: Double): this.type = set("minSize", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def multiple(value: Boolean): this.type = set("multiple", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def noClick(value: Boolean): this.type = set("noClick", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def noDrag(value: Boolean): this.type = set("noDrag", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def noDragEventsBubbling(value: Boolean): this.type = set("noDragEventsBubbling", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def noKeyboard(value: Boolean): this.type = set("noKeyboard", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def onDragEnter(value: ReactDragEventFrom[HTMLElement] => Callback): this.type = set("onDragEnter", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement]) => value(t0).runNow())) | ||
|
||
@scala.inline | ||
def onDragLeave(value: ReactDragEventFrom[HTMLElement] => Callback): this.type = set("onDragLeave", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement]) => value(t0).runNow())) | ||
|
||
@scala.inline | ||
def onDragOver(value: ReactDragEventFrom[HTMLElement] => Callback): this.type = set("onDragOver", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement]) => value(t0).runNow())) | ||
|
||
@scala.inline | ||
def onDrop( | ||
value: (/* acceptedFiles */ js.Array[js.Any], /* rejectedFiles */ js.Array[js.Any], /* event */ DropEvent) => Callback | ||
): this.type = set("onDrop", js.Any.fromFunction3((t0: /* acceptedFiles */ js.Array[js.Any], t1: /* rejectedFiles */ js.Array[js.Any], t2: /* event */ DropEvent) => (value(t0, t1, t2)).runNow())) | ||
|
||
@scala.inline | ||
def onDropAccepted(value: (/* files */ js.Array[js.Any], /* event */ DropEvent) => Callback): this.type = set("onDropAccepted", js.Any.fromFunction2((t0: /* files */ js.Array[js.Any], t1: /* event */ DropEvent) => (value(t0, t1)).runNow())) | ||
|
||
@scala.inline | ||
def onDropRejected(value: (/* files */ js.Array[js.Any], /* event */ DropEvent) => Callback): this.type = set("onDropRejected", js.Any.fromFunction2((t0: /* files */ js.Array[js.Any], t1: /* event */ DropEvent) => (value(t0, t1)).runNow())) | ||
|
||
@scala.inline | ||
def onFileDialogCancel(value: Callback): this.type = set("onFileDialogCancel", value.toJsFn) | ||
|
||
@scala.inline | ||
def preventDropOnDocument(value: Boolean): this.type = set("preventDropOnDocument", value.asInstanceOf[js.Any]) | ||
} | ||
|
||
implicit def make(companion: ReactDropzone.type): Builder = new Builder(js.Array(this.component, js.Dictionary.empty))() | ||
|
||
def withProps(p: DropzoneProps with RefAttributes[DropzoneRef]): Builder = new Builder(js.Array(this.component, p.asInstanceOf[js.Any])) | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/react-integration-test/check-japgolly/r/react-markdown/build.sbt
This file contains 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,15 @@ | ||
organization := "org.scalablytyped" | ||
name := "react-markdown" | ||
version := "0.0-unknown-7278fc" | ||
scalaVersion := "2.13.3" | ||
enablePlugins(ScalaJSPlugin) | ||
libraryDependencies ++= Seq( | ||
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.5", | ||
"com.olvind" %%% "scalablytyped-runtime" % "2.4.0", | ||
"org.scalablytyped" %%% "react" % "16.9.2-0e03be", | ||
"org.scalablytyped" %%% "std" % "0.0-unknown-43ed0a") | ||
publishArtifact in packageDoc := false | ||
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials") | ||
licenses += ("MIT", url("http://opensource.org/licenses/MIT")) | ||
bintrayRepository := "ScalablyTyped" | ||
resolvers += Resolver.bintrayRepo("oyvindberg", "ScalablyTyped") |
1 change: 1 addition & 0 deletions
1
tests/react-integration-test/check-japgolly/r/react-markdown/project/build.properties
This file contains 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 @@ | ||
sbt.version=1.4.2 |
2 changes: 2 additions & 0 deletions
2
tests/react-integration-test/check-japgolly/r/react-markdown/project/plugins.sbt
This file contains 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,2 @@ | ||
addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.3.0") | ||
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4") |
15 changes: 15 additions & 0 deletions
15
tests/react-integration-test/check-japgolly/r/react-markdown/readme.md
This file contains 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,15 @@ | ||
|
||
# Scala.js typings for react-markdown | ||
|
||
|
||
|
||
|
||
## Note | ||
This library has been generated from typescript code from first party type definitions. | ||
|
||
Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped) | ||
|
||
## Usage | ||
See [the main readme](../../readme.md) for instructions. | ||
|
||
|
20 changes: 20 additions & 0 deletions
20
...eact-markdown/src/main/scala/typingsJapgolly/reactMarkdown/components/ReactMarkdown.scala
This file contains 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,20 @@ | ||
package typingsJapgolly.reactMarkdown.components | ||
|
||
import typingsJapgolly.StBuildingComponent.Default | ||
import typingsJapgolly.reactMarkdown.mod.ReactMarkdownProps | ||
import org.scalablytyped.runtime.StObject | ||
import scala.scalajs.js | ||
import scala.scalajs.js.`|` | ||
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} | ||
|
||
/* The props of this component has an unsupported shape. You can use `set` manually to use it, but with no compiler support :/ . Couldn't find props for typingsJapgolly.reactMarkdown.mod.ReactMarkdownProps because: IArray(Couldn't find props for typingsJapgolly.reactMarkdown.mod.ChildrenProp with typingsJapgolly.reactMarkdown.reactMarkdownStrings.Not with js.Any because: IArray(Could't extract props from js.Any because couldn't resolve ClassTree.), Couldn't find props for typingsJapgolly.reactMarkdown.mod.SourceProp with typingsJapgolly.reactMarkdown.reactMarkdownStrings.Not with js.Any because: IArray(Could't extract props from js.Any because couldn't resolve ClassTree.)) */ | ||
object ReactMarkdown { | ||
|
||
def apply(p: ReactMarkdownProps): Default[js.Object] = new Default[js.Object](js.Array(this.component, p.asInstanceOf[js.Any])) | ||
|
||
@JSImport("react-markdown", JSImport.Namespace) | ||
@js.native | ||
val component: js.Object = js.native | ||
|
||
implicit def make(companion: ReactMarkdown.type): Default[js.Object] = new Default[js.Object](js.Array(this.component, js.Dictionary.empty))() | ||
} |
148 changes: 148 additions & 0 deletions
148
...st/check-japgolly/r/react-markdown/src/main/scala/typingsJapgolly/reactMarkdown/mod.scala
This file contains 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,148 @@ | ||
package typingsJapgolly.reactMarkdown | ||
|
||
import japgolly.scalajs.react.raw.React.Element | ||
import japgolly.scalajs.react.raw.React.ElementType | ||
import japgolly.scalajs.react.raw.React.Node | ||
import org.scalablytyped.runtime.StringDictionary | ||
import org.scalablytyped.runtime.TopLevel | ||
import org.scalablytyped.runtime.StObject | ||
import scala.scalajs.js | ||
import scala.scalajs.js.`|` | ||
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} | ||
|
||
object mod { | ||
|
||
@scala.inline | ||
def apply(props: ReactMarkdownProps): Element = ^.asInstanceOf[js.Dynamic].apply(props.asInstanceOf[js.Any]).asInstanceOf[Element] | ||
|
||
@JSImport("react-markdown", JSImport.Namespace) | ||
@js.native | ||
val ^ : js.Any = js.native | ||
|
||
@JSImport("react-markdown", "renderers") | ||
@js.native | ||
val renderers: Renderers_ = js.native | ||
|
||
@scala.inline | ||
def uriTransformer(uri: String): String = ^.asInstanceOf[js.Dynamic].applyDynamic("uriTransformer")(uri.asInstanceOf[js.Any]).asInstanceOf[String] | ||
|
||
@js.native | ||
trait ChildrenProp extends StObject { | ||
|
||
val children: String = js.native | ||
} | ||
object ChildrenProp { | ||
|
||
@scala.inline | ||
def apply(children: String): ChildrenProp = { | ||
val __obj = js.Dynamic.literal(children = children.asInstanceOf[js.Any]) | ||
__obj.asInstanceOf[ChildrenProp] | ||
} | ||
|
||
@scala.inline | ||
implicit class ChildrenPropMutableBuilder[Self <: ChildrenProp] (val x: Self) extends AnyVal { | ||
|
||
@scala.inline | ||
def setChildren(value: String): Self = StObject.set(x, "children", value.asInstanceOf[js.Any]) | ||
} | ||
} | ||
|
||
type LinkTargetResolver = js.Function3[/* uri */ String, /* text */ String, /* title */ js.UndefOr[String], String] | ||
|
||
type MutuallyExclusive[T, U] = (T with Not[U]) | (U with Not[T]) | ||
|
||
type Not[T] = /* import warning: importer.ImportType#apply c Unsupported type mapping: | ||
{[ key in keyof T ]:? never} | ||
*/ typingsJapgolly.reactMarkdown.reactMarkdownStrings.Not with TopLevel[js.Any] | ||
|
||
type ReactMarkdownProps = ReactMarkdownPropsBase with (MutuallyExclusive[ChildrenProp, SourceProp]) | ||
|
||
@js.native | ||
trait ReactMarkdownPropsBase extends StObject { | ||
|
||
val allowNode: js.UndefOr[js.Function1[/* index */ Double, Boolean]] = js.native | ||
|
||
val className: js.UndefOr[String] = js.native | ||
|
||
val linkTarget: js.UndefOr[String | LinkTargetResolver] = js.native | ||
|
||
val transformLinkUri: js.UndefOr[ | ||
(js.Function3[ | ||
/* uri */ String, | ||
/* children */ js.UndefOr[Node], | ||
/* title */ js.UndefOr[String], | ||
String | ||
]) | Null | ||
] = js.native | ||
} | ||
object ReactMarkdownPropsBase { | ||
|
||
@scala.inline | ||
def apply(): ReactMarkdownPropsBase = { | ||
val __obj = js.Dynamic.literal() | ||
__obj.asInstanceOf[ReactMarkdownPropsBase] | ||
} | ||
|
||
@scala.inline | ||
implicit class ReactMarkdownPropsBaseMutableBuilder[Self <: ReactMarkdownPropsBase] (val x: Self) extends AnyVal { | ||
|
||
@scala.inline | ||
def setAllowNode(value: /* index */ Double => Boolean): Self = StObject.set(x, "allowNode", js.Any.fromFunction1(value)) | ||
|
||
@scala.inline | ||
def setAllowNodeUndefined: Self = StObject.set(x, "allowNode", js.undefined) | ||
|
||
@scala.inline | ||
def setClassName(value: String): Self = StObject.set(x, "className", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def setClassNameUndefined: Self = StObject.set(x, "className", js.undefined) | ||
|
||
@scala.inline | ||
def setLinkTarget(value: String | LinkTargetResolver): Self = StObject.set(x, "linkTarget", value.asInstanceOf[js.Any]) | ||
|
||
@scala.inline | ||
def setLinkTargetFunction3(value: (/* uri */ String, /* text */ String, /* title */ js.UndefOr[String]) => String): Self = StObject.set(x, "linkTarget", js.Any.fromFunction3(value)) | ||
|
||
@scala.inline | ||
def setLinkTargetUndefined: Self = StObject.set(x, "linkTarget", js.undefined) | ||
|
||
@scala.inline | ||
def setTransformLinkUri( | ||
value: (/* uri */ String, /* children */ js.UndefOr[Node], /* title */ js.UndefOr[String]) => String | ||
): Self = StObject.set(x, "transformLinkUri", js.Any.fromFunction3(value)) | ||
|
||
@scala.inline | ||
def setTransformLinkUriNull: Self = StObject.set(x, "transformLinkUri", null) | ||
|
||
@scala.inline | ||
def setTransformLinkUriUndefined: Self = StObject.set(x, "transformLinkUri", js.undefined) | ||
} | ||
} | ||
|
||
type Renderer[T] = js.Function1[/* props */ T, ElementType] | ||
|
||
type Renderers_ = StringDictionary[String | Renderer[js.Any]] | ||
|
||
@js.native | ||
trait SourceProp extends StObject { | ||
|
||
/** @deprecated use children */ | ||
val source: String = js.native | ||
} | ||
object SourceProp { | ||
|
||
@scala.inline | ||
def apply(source: String): SourceProp = { | ||
val __obj = js.Dynamic.literal(source = source.asInstanceOf[js.Any]) | ||
__obj.asInstanceOf[SourceProp] | ||
} | ||
|
||
@scala.inline | ||
implicit class SourcePropMutableBuilder[Self <: SourceProp] (val x: Self) extends AnyVal { | ||
|
||
@scala.inline | ||
def setSource(value: String): Self = StObject.set(x, "source", value.asInstanceOf[js.Any]) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
.../r/react-markdown/src/main/scala/typingsJapgolly/reactMarkdown/reactMarkdownRequire.scala
This file contains 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 typingsJapgolly.reactMarkdown | ||
|
||
import org.scalablytyped.runtime.StObject | ||
import scala.scalajs.js | ||
import scala.scalajs.js.`|` | ||
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} | ||
|
||
/* This can be used to `require` the library as a side effect. | ||
If it is a global library this will make scalajs-bundler include it */ | ||
@JSImport("react-markdown", JSImport.Namespace) | ||
@js.native | ||
object reactMarkdownRequire extends StObject |
14 changes: 14 additions & 0 deletions
14
.../r/react-markdown/src/main/scala/typingsJapgolly/reactMarkdown/reactMarkdownStrings.scala
This file contains 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,14 @@ | ||
package typingsJapgolly.reactMarkdown | ||
|
||
import org.scalablytyped.runtime.StObject | ||
import scala.scalajs.js | ||
import scala.scalajs.js.`|` | ||
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} | ||
|
||
object reactMarkdownStrings { | ||
|
||
@js.native | ||
sealed trait Not extends StObject | ||
@scala.inline | ||
def Not: Not = "Not".asInstanceOf[Not] | ||
} |
Oops, something went wrong.