From 3c0e8ce8bb2d845da741cda87274d12e45fe6d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Thu, 13 Oct 2022 16:12:11 +0200 Subject: [PATCH] Include all modules So far ST has looked at package.json to determine a subset of typings to include. Going forward *all* files will be translated. This solves #463 There are loads of details for computing shorter module names. These will be solved similar to how `exports` was solved in #486, by injecting "proxy modules" into the AST. Note that some libraries ship typings for multiple hierarchies, typically in folders named `src`, `es`, `es6` and so on. we'll now get all those duplicates as well. --- .../converter/internal/Comment.scala | 1 - .../internal/importer/LibTsSource.scala | 48 +- .../internal/importer/LibraryResolver.scala | 46 +- .../importer/PathsFromTsLibSource.scala | 2 - .../importer/Phase1ReadTypescript.scala | 49 +- .../internal/importer/ProxyModule.scala | 59 ++- tests/antd/in/antd/lib/form/Form.d.ts | 2 +- tests/commander/check-3/c/commander/build.sbt | 2 +- .../main/scala/typings/commander/mod.scala | 416 +-------------- .../scala/typings/commander/typingsMod.scala | 474 ++++++++++++++++++ .../check-3/f/firebase-admin/build.sbt | 2 +- .../scala/typings/firebaseAdmin/libMod.scala | 46 ++ .../scala/typings/firebaseAdmin/mod.scala | 23 +- tests/fp-ts/check-3/f/fp-ts/build.sbt | 2 +- .../src/main/scala/typings/fpTs/libMod.scala | 25 + .../src/main/scala/typings/fpTs/mod.scala | 1 + .../r/react-dropzone/build.sbt | 2 +- .../components/ReactDropzone.scala | 8 +- .../typingsJapgolly/reactDropzone/mod.scala | 336 +------------ .../reactDropzone/reactDropzoneStrings.scala | 2 +- .../typingsReactDropzoneMod.scala | 350 +++++++++++++ .../build.sbt | 2 +- .../distEsMod.scala | 62 +++ .../mod.scala | 1 + .../build.sbt | 2 +- .../distEsMod.scala | 83 +++ .../stardustUiReactComponentRef/mod.scala | 7 +- .../check-slinky-3/r/react-dropzone/build.sbt | 2 +- .../components/ReactDropzone.scala | 8 +- .../typingsSlinky/reactDropzone/mod.scala | 326 +----------- .../reactDropzone/reactDropzoneStrings.scala | 2 +- .../typingsReactDropzoneMod.scala | 340 +++++++++++++ .../build.sbt | 2 +- .../distEsMod.scala | 62 +++ .../mod.scala | 1 + .../build.sbt | 2 +- .../distEsMod.scala | 83 +++ .../stardustUiReactComponentRef/mod.scala | 7 +- tests/vue/check-3/s/storybook__vue/build.sbt | 4 +- tests/vue/check-3/v/vue-scrollto/build.sbt | 4 +- tests/vue/check-3/v/vue/build.sbt | 2 +- .../vue/src/main/scala/typings/vue/mod.scala | 1 + .../src/main/scala/typings/vue/typesMod.scala | 20 + .../converter/internal/ts/TsTreeScope.scala | 9 - 44 files changed, 1696 insertions(+), 1232 deletions(-) create mode 100644 tests/commander/check-3/c/commander/src/main/scala/typings/commander/typingsMod.scala create mode 100644 tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/libMod.scala create mode 100644 tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/libMod.scala create mode 100644 tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/typingsReactDropzoneMod.scala create mode 100644 tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/distEsMod.scala create mode 100644 tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/distEsMod.scala create mode 100644 tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/typingsReactDropzoneMod.scala create mode 100644 tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/distEsMod.scala create mode 100644 tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/distEsMod.scala create mode 100644 tests/vue/check-3/v/vue/src/main/scala/typings/vue/typesMod.scala diff --git a/core/src/main/scala/org/scalablytyped/converter/internal/Comment.scala b/core/src/main/scala/org/scalablytyped/converter/internal/Comment.scala index f2d0d21525..9015050c25 100644 --- a/core/src/main/scala/org/scalablytyped/converter/internal/Comment.scala +++ b/core/src/main/scala/org/scalablytyped/converter/internal/Comment.scala @@ -21,7 +21,6 @@ object Marker { case object HasClassParent extends Marker case class NameHint(value: String) extends Marker - case class ModuleAliases(aliases: IArray[TsIdentModule]) extends Marker case class WasLiteral(lit: ExprTree.Lit) extends Marker case class WasUnion(related: IArray[TypeRef]) extends Marker diff --git a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibTsSource.scala b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibTsSource.scala index ec5c89a966..70fc1295ee 100644 --- a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibTsSource.scala +++ b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibTsSource.scala @@ -18,13 +18,11 @@ sealed trait LibTsSource extends TsTreeScope.TsLib { lazy val tsConfig: Option[TsConfig] = Json.opt[TsConfig](folder.path / "tsconfig.json") - - lazy val shortenedFiles: IArray[InFile] = LibTsSource.findShortenedFiles(this) } object LibTsSource { def hasTypescriptSources(folder: InFolder): Boolean = - os.walk.stream(folder.path, _.last == "node_modules").exists(_.last.endsWith(".d.ts")) + os.walk.stream(folder.path, skip = _.last == "node_modules").exists(_.last.endsWith(".d.ts")) final case class StdLibSource(folder: InFolder, files: IArray[InFile], libName: TsIdentLibrary) extends LibTsSource @@ -34,48 +32,4 @@ object LibTsSource { Ordering.by[S, String](_.pathString) implicit val SourceFormatter: Formatter[LibTsSource] = _.libName.value - - /* for files referenced through here we must shorten the paths */ - def findShortenedFiles(src: LibTsSource): IArray[InFile] = { - def fromTypingsJson(fromFolder: LibTsSource.FromFolder, files: Option[IArray[String]]): IArray[InFile] = - files.getOrElse(IArray.Empty).collect { - case path if path.endsWith("typings.json") => - val typingsJsonPath = fromFolder.folder.path / os.RelPath(path) - val typingsJson = Json.force[TypingsJson](typingsJsonPath) - InFile(typingsJsonPath / os.up / typingsJson.main) - } - - def fromFileEntry(fromFolder: LibTsSource.FromFolder, files: Option[IArray[String]]): IArray[InFile] = - files.getOrElse(IArray.Empty).mapNotNone(file => LibraryResolver.file(fromFolder.folder, file)) - - def fromModuleDeclaration( - fromFolder: LibTsSource.FromFolder, - files: Option[Map[String, String]], - ): IArray[InFile] = { - val files1 = files match { - case Some(files) => IArray.fromTraversable(files.values) - case None => IArray.Empty - } - - files1 - .mapNotNone(file => LibraryResolver.file(fromFolder.folder, file)) - .mapNotNone { - case existingFile if LibTsSource.hasTypescriptSources(existingFile.folder) => Some(existingFile) - case _ => None - } - } - - src match { - case _: StdLibSource => Empty - case f: FromFolder => - val fromTypings = - IArray( - fromFileEntry(f, f.packageJsonOpt.flatMap(_.parsedTypes).orElse(f.packageJsonOpt.flatMap(_.parsedTypings))), - fromTypingsJson(f, f.packageJsonOpt.flatMap(_.parsedTypings)), - ).flatten - - if (fromTypings.nonEmpty) fromTypings - else fromModuleDeclaration(f, f.packageJsonOpt.flatMap(_.parsedModules)) - } - } } diff --git a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibraryResolver.scala b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibraryResolver.scala index 3b9b38a532..35dd92700f 100644 --- a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibraryResolver.scala +++ b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/LibraryResolver.scala @@ -17,7 +17,7 @@ class LibraryResolver( value match { case LocalPath(localPath) => file(folder, localPath).map { inFile => - ResolvedModule.Local(inFile, LibraryResolver.moduleNameFor(source, inFile).head) + ResolvedModule.Local(inFile, LibraryResolver.moduleNameFor(source, inFile)) } case globalRef => val modName = ModuleNameParser(globalRef.split("/").to[List], keepIndexFragment = true) @@ -56,44 +56,16 @@ object LibraryResolver { case class Ignored(name: TsIdentLibrary) extends Res[Nothing] case class NotAvailable(name: TsIdentLibrary) extends Res[Nothing] - def moduleNameFor(source: LibTsSource, file: InFile): IArray[TsIdentModule] = { - val shortened: Option[TsIdentModule] = - if (source.shortenedFiles.contains(file)) { - source.libName match { - case TsIdentLibraryScoped(scope, name) => - Some(TsIdentModule(Some(scope), List(name))) - case TsIdentLibrarySimple(value) => - Some(TsIdentModule(None, value :: Nil)) - } - } else None - - val longName: TsIdentModule = { - val keepIndexPath = file.path match { - case base / segment / "index.d.ts" => files.exists(base / segment.concat(".d.ts")) - case _ => false - } - - ModuleNameParser( - source.libName.`__value` +: file.path.relativeTo(source.folder.path).segments.to[List], - keepIndexPath, - ) - } - - val ret = IArray.fromOptions(shortened, Some(longName)) - - /* some libraries contain multiple directory trees with type definitions, and refer to just one of them through - * `typings` in package.json for instance. - * - * Remarkably it can reach into one of the other trees even if the current tree has everything needed. - * This resolves the most common case, and fixes antd 4 in particular */ - val inParallelDirectory = ret.collect { - case TsIdentModule(scopeOpt, fragments) if fragments.contains("lib") => - TsIdentModule(scopeOpt, fragments.map { case "lib" => "es"; case other => other }) - case TsIdentModule(scopeOpt, fragments) if fragments.contains("es") => - TsIdentModule(scopeOpt, fragments.map { case "es" => "lib"; case other => other }) + def moduleNameFor(source: LibTsSource, file: InFile): TsIdentModule = { + val keepIndexPath = file.path match { + case base / segment / "index.d.ts" => files.exists(base / segment.concat(".d.ts")) + case _ => false } - ret ++ inParallelDirectory + ModuleNameParser( + source.libName.`__value` +: file.path.relativeTo(source.folder.path).segments.to[List], + keepIndexPath, + ) } def file(within: InFolder, fragment: String): Option[InFile] = diff --git a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/PathsFromTsLibSource.scala b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/PathsFromTsLibSource.scala index ee02e61974..895741bf23 100644 --- a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/PathsFromTsLibSource.scala +++ b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/PathsFromTsLibSource.scala @@ -15,8 +15,6 @@ object PathsFromTsLibSource { */ case "amd" => true case "umd" => true - case "es" => true - case "es6" => true /* DefinitelyTyped uses this pattern for newer versions of typescript. We just use the default */ case TS() => true /* DefinitelyTyped uses this pattern for old versions of the library */ diff --git a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase1ReadTypescript.scala b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase1ReadTypescript.scala index f2de625f24..ea77fc086c 100644 --- a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase1ReadTypescript.scala +++ b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase1ReadTypescript.scala @@ -54,11 +54,9 @@ class Phase1ReadTypescript( PathsFromTsLibSource.filesFrom(files.head.folder) case f @ LibTsSource.FromFolder(_, TsIdentLibrarySimple("typescript")) => /* don't include std */ - f.shortenedFiles + PathsFromTsLibSource.filesFrom(f.folder).filterNot(_.path.segments.contains("lib")) case f: LibTsSource.FromFolder => - /* There are often whole trees parallel to what is specified in `typings` (or similar). This ignores them */ - val bound = f.shortenedFiles.headOption.map(_.folder).getOrElse(f.folder) - PathsFromTsLibSource.filesFrom(bound) + PathsFromTsLibSource.filesFrom(f.folder) } val includedViaDirective = mutable.Set.empty[InFile] @@ -84,9 +82,9 @@ class Phase1ReadTypescript( LibraryResolver.file(resolve.stdLib.folder, s"lib.$value.d.ts").toRight(dir) } - val moduleNames = LibraryResolver.moduleNameFor(source, file) + val moduleName = LibraryResolver.moduleNameFor(source, file) - val withInferredModule = modules.InferredDefaultModule(parsed, moduleNames.head, logger) + val withInferredModule = modules.InferredDefaultModule(parsed, moduleName, fileLogger) withInferredModule.directives.foreach { case dir @ Directive.TypesRef(value) => @@ -94,16 +92,16 @@ class Phase1ReadTypescript( case Some(ResolvedModule.NotLocal(depSource, _)) => deps += depSource case Some(ResolvedModule.Local(depSource, _)) => - logger.fatal(s"unexpected typeref from local file $depSource") + fileLogger.fatal(s"unexpected typeref from local file $depSource") case _ => - logger.warn(s"directives: couldn't resolve $dir") + fileLogger.warn(s"directives: couldn't resolve $dir") } case _ => () } /* Resolve all references to other modules in `from` clauses, rename modules */ val ResolveExternalReferences.Result(withExternals, resolvedModules, unresolvedModules) = - ResolveExternalReferences(resolve, source, file.folder, withInferredModule, logger) + ResolveExternalReferences(resolve, source, file.folder, withInferredModule, fileLogger) resolvedModules.foreach { case ResolvedModule.NotLocal(source, _) => deps += source @@ -129,7 +127,7 @@ class Phase1ReadTypescript( source.libName, withOrigin, unresolvedModules, - logger, + fileLogger, ) inferredDepNames.foreach { libraryName => @@ -137,7 +135,7 @@ class Phase1ReadTypescript( case Some(ResolvedModule.NotLocal(dep, _)) => deps += dep case _ => - logger.warn(s"Couldn't resolve inferred dependency ${libraryName.value}") + fileLogger.warn(s"Couldn't resolve inferred dependency ${libraryName.value}") } } @@ -163,18 +161,10 @@ class Phase1ReadTypescript( parsed } - val _3 = moduleNames match { - case IArray.exactlyOne(_) => withInlined - case more => - withInlined.copy(members = withInlined.members.map { - case m: TsDeclModule if more.contains(m.name) => - m.copy(comments = m.comments + Marker.ModuleAliases(more.filterNot(_ === m.name))) - case other => other - }) - } - val _4 = T.SetCodePath.visitTsParsedFile(CodePath.HasPath(source.libName, TsQIdent.empty))(_3) + val _3 = + T.SetCodePath.visitTsParsedFile(CodePath.HasPath(source.libName, TsQIdent.empty))(withInlined) - (_4, deps.result()) + (_3, deps.result()) } } } @@ -212,7 +202,20 @@ class Phase1ReadTypescript( val flattened = FlattenTrees(preparedFiles.map(_._1)) val depsFromFiles = preparedFiles.foldLeft(Set.empty[LibTsSource]) { case (acc, (_, deps)) => acc ++ deps } - val withExportedModules = source.packageJsonOpt.flatMap(_.parsedExported).foldLeft(flattened) { + val topLevelProxyModule = { + val maybeProxy: Option[ProxyModule] = + source match { + case _: LibTsSource.StdLibSource => None + case source: LibTsSource.FromFolder => + ProxyModule.topLevel(source, existing = flattened.membersByName.contains) + } + + maybeProxy.foldLeft(flattened) { + case (file, pm) => file.copy(members = pm.asModule +: file.members) + } + } + + val withExportedModules = source.packageJsonOpt.flatMap(_.parsedExported).foldLeft(topLevelProxyModule) { case (file, exports) => val proxyModules = ProxyModule.fromExports( source, diff --git a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/ProxyModule.scala b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/ProxyModule.scala index 17e1488b2a..47825151c5 100644 --- a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/ProxyModule.scala +++ b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/ProxyModule.scala @@ -28,7 +28,64 @@ case class ProxyModule( } object ProxyModule { - val FromExports = Comments("/* from `exports` in `package.json` */\n") + val FromExports = Comments("/* from `exports` in `package.json` */\n") + val TopLevelModule = Comments("/* Inferred short module name */\n") + + /* some things kind of implicitly end up being the top-level module. this will add such a default module if none exist */ + def topLevel(source: LibTsSource.FromFolder, existing: TsIdent => Boolean): Option[ProxyModule] = { + def fromTypingsJson(files: Option[IArray[String]]): IArray[InFile] = + files.getOrElse(IArray.Empty).collect { + case path if path.endsWith("typings.json") => + val typingsJsonPath = source.folder.path / os.RelPath(path) + val typingsJson = Json.force[TypingsJson](typingsJsonPath) + InFile(typingsJsonPath / os.up / typingsJson.main) + } + + def fromFileEntry(files: Option[IArray[String]]): IArray[InFile] = + files.getOrElse(IArray.Empty).mapNotNone(file => LibraryResolver.file(source.folder, file)) + + def fromModuleDeclaration(files: Option[Map[String, String]]): IArray[InFile] = { + val files1 = files match { + case Some(files) => IArray.fromTraversable(files.values) + case None => IArray.Empty + } + + files1 + .mapNotNone(file => LibraryResolver.file(source.folder, file)) + .mapNotNone { + case existingFile if LibTsSource.hasTypescriptSources(existingFile.folder) => Some(existingFile) + case _ => None + } + } + + val found = { + val fromTypings = { + val types = source.packageJsonOpt.flatMap(_.parsedTypes).orElse(source.packageJsonOpt.flatMap(_.parsedTypings)) + IArray( + fromFileEntry(types), + fromTypingsJson(source.packageJsonOpt.flatMap(_.parsedTypings)), + ).flatten + } + + if (fromTypings.nonEmpty) fromTypings + else fromModuleDeclaration(source.packageJsonOpt.flatMap(_.parsedModules)) + } + + val sorted = found.sortBy(inFile => (inFile.path.last.startsWith("index"), inFile.path.toString().length)) + if (sorted.length > 1) { + print(0) + } + val maybeChosenFile = + sorted.lastOption + + maybeChosenFile + .map { chosenFile => + val fromModule = LibraryResolver.moduleNameFor(source, chosenFile) + val toModule = TsIdentModule.fromLibrary(source.libName) + ProxyModule(TopLevelModule, source.libName, fromModule, toModule) + } + .filterNot(pm => existing(pm.toModule)) + } def fromExports( source: LibTsSource, diff --git a/tests/antd/in/antd/lib/form/Form.d.ts b/tests/antd/in/antd/lib/form/Form.d.ts index 7e69e64188..3a4d0906ab 100644 --- a/tests/antd/in/antd/lib/form/Form.d.ts +++ b/tests/antd/in/antd/lib/form/Form.d.ts @@ -1,4 +1,4 @@ -import { FormProps as RcFormProps } from 'rc-field-form/lib/Form'; +import { FormProps as RcFormProps } from 'rc-field-form/es/Form'; export interface FormProps extends Omit { prefixCls?: string; diff --git a/tests/commander/check-3/c/commander/build.sbt b/tests/commander/check-3/c/commander/build.sbt index 10ae5ef7e8..4ef0b09cc9 100644 --- a/tests/commander/check-3/c/commander/build.sbt +++ b/tests/commander/check-3/c/commander/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "commander" -version := "2.15.1-fc4aa5" +version := "2.15.1-0e0384" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/commander/check-3/c/commander/src/main/scala/typings/commander/mod.scala b/tests/commander/check-3/c/commander/src/main/scala/typings/commander/mod.scala index 336be73886..10235d2386 100644 --- a/tests/commander/check-3/c/commander/src/main/scala/typings/commander/mod.scala +++ b/tests/commander/check-3/c/commander/src/main/scala/typings/commander/mod.scala @@ -1,14 +1,14 @@ package typings.commander -import org.scalablytyped.runtime.Instantiable1 -import org.scalablytyped.runtime.Instantiable2 import org.scalablytyped.runtime.Shortcut -import org.scalablytyped.runtime.StringDictionary -import typings.node.NodeJS.EventEmitter +import typings.commander.typingsMod.CommanderStatic +import typings.commander.typingsMod.local.Command +import typings.commander.typingsMod.local.Option import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod extends Shortcut { @JSImport("commander", JSImport.Namespace) @@ -25,7 +25,7 @@ object mod extends Shortcut { */ open class CommandCls () extends StObject - with typings.commander.mod.local.Command { + with Command { def this(name: String) = this() } @@ -34,7 +34,7 @@ object mod extends Shortcut { @js.native open class OptionCls protected () extends StObject - with typings.commander.mod.local.Option { + with Option { /** * Initialize a new `Option` with the given `flags` and `description`. * @@ -63,412 +63,8 @@ object mod extends Shortcut { var required: Boolean = js.native } - type Command = typings.commander.mod.local.Command - - trait CommandOptions extends StObject { - - var isDefault: js.UndefOr[Boolean] = js.undefined - - var noHelp: js.UndefOr[Boolean] = js.undefined - } - object CommandOptions { - - inline def apply(): CommandOptions = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[CommandOptions] - } - - extension [Self <: CommandOptions](x: Self) { - - inline def setIsDefault(value: Boolean): Self = StObject.set(x, "isDefault", value.asInstanceOf[js.Any]) - - inline def setIsDefaultUndefined: Self = StObject.set(x, "isDefault", js.undefined) - - inline def setNoHelp(value: Boolean): Self = StObject.set(x, "noHelp", value.asInstanceOf[js.Any]) - - inline def setNoHelpUndefined: Self = StObject.set(x, "noHelp", js.undefined) - } - } - - @js.native - trait CommanderStatic - extends StObject - with typings.commander.mod.local.Command { - - var Command: Instantiable1[/* name */ js.UndefOr[String], typings.commander.mod.local.Command] = js.native - - var CommandOptions: typings.commander.mod.CommandOptions = js.native - - var Option: Instantiable2[ - /* flags */ String, - /* description */ js.UndefOr[String], - typings.commander.mod.local.Option - ] = js.native - - var ParseOptionsResult: typings.commander.mod.ParseOptionsResult = js.native - } - - type Option = typings.commander.mod.local.Option - - trait ParseOptionsResult extends StObject { - - var args: js.Array[String] - - var unknown: js.Array[String] - } - object ParseOptionsResult { - - inline def apply(args: js.Array[String], unknown: js.Array[String]): ParseOptionsResult = { - val __obj = js.Dynamic.literal(args = args.asInstanceOf[js.Any], unknown = unknown.asInstanceOf[js.Any]) - __obj.asInstanceOf[ParseOptionsResult] - } - - extension [Self <: ParseOptionsResult](x: Self) { - - inline def setArgs(value: js.Array[String]): Self = StObject.set(x, "args", value.asInstanceOf[js.Any]) - - inline def setArgsVarargs(value: String*): Self = StObject.set(x, "args", js.Array(value*)) - - inline def setUnknown(value: js.Array[String]): Self = StObject.set(x, "unknown", value.asInstanceOf[js.Any]) - - inline def setUnknownVarargs(value: String*): Self = StObject.set(x, "unknown", js.Array(value*)) - } - } - type _To = CommanderStatic /* This means you don't have to write `^`, but can instead just say `mod.foo` */ override def _to: CommanderStatic = ^ - - object local { - - @js.native - trait Command - extends StObject - with EventEmitter - with /* key */ StringDictionary[Any] { - - /** - * Register callback `fn` for the command. - * - * @example - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {(...args: any[]) => void} fn - * @returns {Command} for chaining - */ - def action(fn: js.Function1[/* repeated */ Any, Unit]): typings.commander.mod.local.Command = js.native - - def alias(): String = js.native - /** - * Set an alias for the command. - * - * @param {string} alias - * @return {(Command | string)} - */ - def alias(alias: String): typings.commander.mod.local.Command = js.native - - /** - * Allow unknown options on the command line. - * - * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. - * @returns {Command} for chaining - */ - def allowUnknownOption(): typings.commander.mod.local.Command = js.native - def allowUnknownOption(arg: Boolean): typings.commander.mod.local.Command = js.native - - var args: js.Array[String] = js.native - - /** - * Define argument syntax for the top-level command. - * - * @param {string} desc - * @returns {Command} for chaining - */ - def arguments(desc: String): typings.commander.mod.local.Command = js.native - - /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * @example - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {string} name - * @param {string} [desc] for git-style sub-commands - * @param {CommandOptions} [opts] command options - * @returns {Command} the new command - */ - def command(name: String): typings.commander.mod.local.Command = js.native - def command(name: String, desc: String): typings.commander.mod.local.Command = js.native - def command(name: String, desc: String, opts: CommandOptions): typings.commander.mod.local.Command = js.native - def command(name: String, desc: Unit, opts: CommandOptions): typings.commander.mod.local.Command = js.native - - def description(): String = js.native - /** - * Set the description to `str`. - * - * @param {string} str - * @return {(Command | string)} - */ - def description(str: String): typings.commander.mod.local.Command = js.native - - /** Output help information and exit. - * - * @param {(str: string) => string} [cb] - */ - def help(): Unit = js.native - def help(cb: js.Function1[/* str */ String, String]): Unit = js.native - - /** - * Get the name of the command. - * - * @return {string} - */ - def name(): String = js.native - /** - * Set the name of the command. - * - * @param {string} str - * @return {Command} - */ - def name(str: String): typings.commander.mod.local.Command = js.native - - /** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * @example - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {string} flags - * @param {string} [description] - * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default - * @param {*} [defaultValue] - * @returns {Command} for chaining - */ - def option(flags: String): typings.commander.mod.local.Command = js.native - def option(flags: String, description: String): typings.commander.mod.local.Command = js.native - def option(flags: String, description: String, defaultValue: Any): typings.commander.mod.local.Command = js.native - def option(flags: String, description: String, fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit]): typings.commander.mod.local.Command = js.native - def option( - flags: String, - description: String, - fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit], - defaultValue: Any - ): typings.commander.mod.local.Command = js.native - def option(flags: String, description: String, fn: js.RegExp): typings.commander.mod.local.Command = js.native - def option(flags: String, description: String, fn: js.RegExp, defaultValue: Any): typings.commander.mod.local.Command = js.native - def option(flags: String, description: String, fn: Unit, defaultValue: Any): typings.commander.mod.local.Command = js.native - def option(flags: String, description: Unit, defaultValue: Any): typings.commander.mod.local.Command = js.native - def option(flags: String, description: Unit, fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit]): typings.commander.mod.local.Command = js.native - def option( - flags: String, - description: Unit, - fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit], - defaultValue: Any - ): typings.commander.mod.local.Command = js.native - def option(flags: String, description: Unit, fn: js.RegExp): typings.commander.mod.local.Command = js.native - def option(flags: String, description: Unit, fn: js.RegExp, defaultValue: Any): typings.commander.mod.local.Command = js.native - def option(flags: String, description: Unit, fn: Unit, defaultValue: Any): typings.commander.mod.local.Command = js.native - - /** - * Return an object containing options as key-value pairs - * - * @returns {{[key: string]: string}} - */ - def opts(): StringDictionary[String] = js.native - - /** - * Output help information for this command. - * - * @param {(str: string) => string} [cb] - */ - def outputHelp(): Unit = js.native - def outputHelp(cb: js.Function1[/* str */ String, String]): Unit = js.native - - /** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {string[]} argv - * @returns {Command} for chaining - */ - def parse(argv: js.Array[String]): typings.commander.mod.local.Command = js.native - - /** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {string[]} args - * @returns {Command} for chaining - */ - def parseExpectedArgs(args: js.Array[String]): typings.commander.mod.local.Command = js.native - - /** - * Parse options from `argv` returning `argv` void of these options. - * - * @param {string[]} argv - * @returns {ParseOptionsResult} - */ - def parseOptions(argv: js.Array[String]): ParseOptionsResult = js.native - - def usage(): String = js.native - /** - * Set or get the command usage. - * - * @param {string} str - * @return {(Command | string)} - */ - def usage(str: String): typings.commander.mod.local.Command = js.native - - /** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {string} str - * @param {string} [flags] - * @returns {Command} for chaining - */ - def version(str: String): typings.commander.mod.local.Command = js.native - def version(str: String, flags: String): typings.commander.mod.local.Command = js.native - } - - trait Option extends StObject { - - var bool: Boolean - - var description: String - - var flags: String - - var long: String - - var optional: Boolean - - var required: Boolean - - var short: js.UndefOr[String] = js.undefined - } - object Option { - - inline def apply( - bool: Boolean, - description: String, - flags: String, - long: String, - optional: Boolean, - required: Boolean - ): typings.commander.mod.local.Option = { - val __obj = js.Dynamic.literal(bool = bool.asInstanceOf[js.Any], description = description.asInstanceOf[js.Any], flags = flags.asInstanceOf[js.Any], long = long.asInstanceOf[js.Any], optional = optional.asInstanceOf[js.Any], required = required.asInstanceOf[js.Any]) - __obj.asInstanceOf[typings.commander.mod.local.Option] - } - - extension [Self <: typings.commander.mod.local.Option](x: Self) { - - inline def setBool(value: Boolean): Self = StObject.set(x, "bool", value.asInstanceOf[js.Any]) - - inline def setDescription(value: String): Self = StObject.set(x, "description", value.asInstanceOf[js.Any]) - - inline def setFlags(value: String): Self = StObject.set(x, "flags", value.asInstanceOf[js.Any]) - - inline def setLong(value: String): Self = StObject.set(x, "long", value.asInstanceOf[js.Any]) - - inline def setOptional(value: Boolean): Self = StObject.set(x, "optional", value.asInstanceOf[js.Any]) - - inline def setRequired(value: Boolean): Self = StObject.set(x, "required", value.asInstanceOf[js.Any]) - - inline def setShort(value: String): Self = StObject.set(x, "short", value.asInstanceOf[js.Any]) - - inline def setShortUndefined: Self = StObject.set(x, "short", js.undefined) - } - } - } } diff --git a/tests/commander/check-3/c/commander/src/main/scala/typings/commander/typingsMod.scala b/tests/commander/check-3/c/commander/src/main/scala/typings/commander/typingsMod.scala new file mode 100644 index 0000000000..8674b6cf46 --- /dev/null +++ b/tests/commander/check-3/c/commander/src/main/scala/typings/commander/typingsMod.scala @@ -0,0 +1,474 @@ +package typings.commander + +import org.scalablytyped.runtime.Instantiable1 +import org.scalablytyped.runtime.Instantiable2 +import org.scalablytyped.runtime.Shortcut +import org.scalablytyped.runtime.StringDictionary +import typings.node.NodeJS.EventEmitter +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object typingsMod extends Shortcut { + + @JSImport("commander/typings", JSImport.Namespace) + @js.native + val ^ : CommanderStatic = js.native + + /* This class was inferred from a value with a constructor, it was renamed because a distinct type already exists with the same name. */ + @JSImport("commander/typings", "Command") + @js.native + /** + * Initialize a new `Command`. + * + * @param {string} [name] + */ + open class CommandCls () + extends StObject + with typings.commander.typingsMod.local.Command { + def this(name: String) = this() + } + + /* This class was inferred from a value with a constructor, it was renamed because a distinct type already exists with the same name. */ + @JSImport("commander/typings", "Option") + @js.native + open class OptionCls protected () + extends StObject + with typings.commander.typingsMod.local.Option { + /** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {string} flags + * @param {string} [description] + */ + def this(flags: String) = this() + def this(flags: String, description: String) = this() + + /* CompleteClass */ + var bool: Boolean = js.native + + /* CompleteClass */ + var description: String = js.native + + /* CompleteClass */ + var flags: String = js.native + + /* CompleteClass */ + var long: String = js.native + + /* CompleteClass */ + var optional: Boolean = js.native + + /* CompleteClass */ + var required: Boolean = js.native + } + + type Command = typings.commander.typingsMod.local.Command + + trait CommandOptions extends StObject { + + var isDefault: js.UndefOr[Boolean] = js.undefined + + var noHelp: js.UndefOr[Boolean] = js.undefined + } + object CommandOptions { + + inline def apply(): CommandOptions = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[CommandOptions] + } + + extension [Self <: CommandOptions](x: Self) { + + inline def setIsDefault(value: Boolean): Self = StObject.set(x, "isDefault", value.asInstanceOf[js.Any]) + + inline def setIsDefaultUndefined: Self = StObject.set(x, "isDefault", js.undefined) + + inline def setNoHelp(value: Boolean): Self = StObject.set(x, "noHelp", value.asInstanceOf[js.Any]) + + inline def setNoHelpUndefined: Self = StObject.set(x, "noHelp", js.undefined) + } + } + + @js.native + trait CommanderStatic + extends StObject + with typings.commander.typingsMod.local.Command { + + var Command: Instantiable1[/* name */ js.UndefOr[String], typings.commander.typingsMod.local.Command] = js.native + + var CommandOptions: typings.commander.typingsMod.CommandOptions = js.native + + var Option: Instantiable2[ + /* flags */ String, + /* description */ js.UndefOr[String], + typings.commander.typingsMod.local.Option + ] = js.native + + var ParseOptionsResult: typings.commander.typingsMod.ParseOptionsResult = js.native + } + + type Option = typings.commander.typingsMod.local.Option + + trait ParseOptionsResult extends StObject { + + var args: js.Array[String] + + var unknown: js.Array[String] + } + object ParseOptionsResult { + + inline def apply(args: js.Array[String], unknown: js.Array[String]): ParseOptionsResult = { + val __obj = js.Dynamic.literal(args = args.asInstanceOf[js.Any], unknown = unknown.asInstanceOf[js.Any]) + __obj.asInstanceOf[ParseOptionsResult] + } + + extension [Self <: ParseOptionsResult](x: Self) { + + inline def setArgs(value: js.Array[String]): Self = StObject.set(x, "args", value.asInstanceOf[js.Any]) + + inline def setArgsVarargs(value: String*): Self = StObject.set(x, "args", js.Array(value*)) + + inline def setUnknown(value: js.Array[String]): Self = StObject.set(x, "unknown", value.asInstanceOf[js.Any]) + + inline def setUnknownVarargs(value: String*): Self = StObject.set(x, "unknown", js.Array(value*)) + } + } + + type _To = CommanderStatic + + /* This means you don't have to write `^`, but can instead just say `typingsMod.foo` */ + override def _to: CommanderStatic = ^ + + object local { + + @js.native + trait Command + extends StObject + with EventEmitter + with /* key */ StringDictionary[Any] { + + /** + * Register callback `fn` for the command. + * + * @example + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @param {(...args: any[]) => void} fn + * @returns {Command} for chaining + */ + def action(fn: js.Function1[/* repeated */ Any, Unit]): typings.commander.typingsMod.local.Command = js.native + + def alias(): String = js.native + /** + * Set an alias for the command. + * + * @param {string} alias + * @return {(Command | string)} + */ + def alias(alias: String): typings.commander.typingsMod.local.Command = js.native + + /** + * Allow unknown options on the command line. + * + * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. + * @returns {Command} for chaining + */ + def allowUnknownOption(): typings.commander.typingsMod.local.Command = js.native + def allowUnknownOption(arg: Boolean): typings.commander.typingsMod.local.Command = js.native + + var args: js.Array[String] = js.native + + /** + * Define argument syntax for the top-level command. + * + * @param {string} desc + * @returns {Command} for chaining + */ + def arguments(desc: String): typings.commander.typingsMod.local.Command = js.native + + /** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * @example + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function() { + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd) { + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('teardown [otherDirs...]') + * .description('run teardown commands') + * .action(function(dir, otherDirs) { + * console.log('dir "%s"', dir); + * if (otherDirs) { + * otherDirs.forEach(function (oDir) { + * console.log('dir "%s"', oDir); + * }); + * } + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env) { + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {string} name + * @param {string} [desc] for git-style sub-commands + * @param {CommandOptions} [opts] command options + * @returns {Command} the new command + */ + def command(name: String): typings.commander.typingsMod.local.Command = js.native + def command(name: String, desc: String): typings.commander.typingsMod.local.Command = js.native + def command(name: String, desc: String, opts: CommandOptions): typings.commander.typingsMod.local.Command = js.native + def command(name: String, desc: Unit, opts: CommandOptions): typings.commander.typingsMod.local.Command = js.native + + def description(): String = js.native + /** + * Set the description to `str`. + * + * @param {string} str + * @return {(Command | string)} + */ + def description(str: String): typings.commander.typingsMod.local.Command = js.native + + /** Output help information and exit. + * + * @param {(str: string) => string} [cb] + */ + def help(): Unit = js.native + def help(cb: js.Function1[/* str */ String, String]): Unit = js.native + + /** + * Get the name of the command. + * + * @return {string} + */ + def name(): String = js.native + /** + * Set the name of the command. + * + * @param {string} str + * @return {Command} + */ + def name(str: String): typings.commander.typingsMod.local.Command = js.native + + /** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * @example + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to true + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {string} flags + * @param {string} [description] + * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default + * @param {*} [defaultValue] + * @returns {Command} for chaining + */ + def option(flags: String): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: String): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: String, defaultValue: Any): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: String, fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit]): typings.commander.typingsMod.local.Command = js.native + def option( + flags: String, + description: String, + fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit], + defaultValue: Any + ): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: String, fn: js.RegExp): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: String, fn: js.RegExp, defaultValue: Any): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: String, fn: Unit, defaultValue: Any): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: Unit, defaultValue: Any): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: Unit, fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit]): typings.commander.typingsMod.local.Command = js.native + def option( + flags: String, + description: Unit, + fn: js.Function2[/* arg1 */ Any, /* arg2 */ Any, Unit], + defaultValue: Any + ): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: Unit, fn: js.RegExp): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: Unit, fn: js.RegExp, defaultValue: Any): typings.commander.typingsMod.local.Command = js.native + def option(flags: String, description: Unit, fn: Unit, defaultValue: Any): typings.commander.typingsMod.local.Command = js.native + + /** + * Return an object containing options as key-value pairs + * + * @returns {{[key: string]: string}} + */ + def opts(): StringDictionary[String] = js.native + + /** + * Output help information for this command. + * + * @param {(str: string) => string} [cb] + */ + def outputHelp(): Unit = js.native + def outputHelp(cb: js.Function1[/* str */ String, String]): Unit = js.native + + /** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {string[]} argv + * @returns {Command} for chaining + */ + def parse(argv: js.Array[String]): typings.commander.typingsMod.local.Command = js.native + + /** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {string[]} args + * @returns {Command} for chaining + */ + def parseExpectedArgs(args: js.Array[String]): typings.commander.typingsMod.local.Command = js.native + + /** + * Parse options from `argv` returning `argv` void of these options. + * + * @param {string[]} argv + * @returns {ParseOptionsResult} + */ + def parseOptions(argv: js.Array[String]): ParseOptionsResult = js.native + + def usage(): String = js.native + /** + * Set or get the command usage. + * + * @param {string} str + * @return {(Command | string)} + */ + def usage(str: String): typings.commander.typingsMod.local.Command = js.native + + /** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {string} str + * @param {string} [flags] + * @returns {Command} for chaining + */ + def version(str: String): typings.commander.typingsMod.local.Command = js.native + def version(str: String, flags: String): typings.commander.typingsMod.local.Command = js.native + } + + trait Option extends StObject { + + var bool: Boolean + + var description: String + + var flags: String + + var long: String + + var optional: Boolean + + var required: Boolean + + var short: js.UndefOr[String] = js.undefined + } + object Option { + + inline def apply( + bool: Boolean, + description: String, + flags: String, + long: String, + optional: Boolean, + required: Boolean + ): typings.commander.typingsMod.local.Option = { + val __obj = js.Dynamic.literal(bool = bool.asInstanceOf[js.Any], description = description.asInstanceOf[js.Any], flags = flags.asInstanceOf[js.Any], long = long.asInstanceOf[js.Any], optional = optional.asInstanceOf[js.Any], required = required.asInstanceOf[js.Any]) + __obj.asInstanceOf[typings.commander.typingsMod.local.Option] + } + + extension [Self <: typings.commander.typingsMod.local.Option](x: Self) { + + inline def setBool(value: Boolean): Self = StObject.set(x, "bool", value.asInstanceOf[js.Any]) + + inline def setDescription(value: String): Self = StObject.set(x, "description", value.asInstanceOf[js.Any]) + + inline def setFlags(value: String): Self = StObject.set(x, "flags", value.asInstanceOf[js.Any]) + + inline def setLong(value: String): Self = StObject.set(x, "long", value.asInstanceOf[js.Any]) + + inline def setOptional(value: Boolean): Self = StObject.set(x, "optional", value.asInstanceOf[js.Any]) + + inline def setRequired(value: Boolean): Self = StObject.set(x, "required", value.asInstanceOf[js.Any]) + + inline def setShort(value: String): Self = StObject.set(x, "short", value.asInstanceOf[js.Any]) + + inline def setShortUndefined: Self = StObject.set(x, "short", js.undefined) + } + } + } +} diff --git a/tests/firebase-admin/check-3/f/firebase-admin/build.sbt b/tests/firebase-admin/check-3/f/firebase-admin/build.sbt index 75c20d9ade..89c69cfb0a 100644 --- a/tests/firebase-admin/check-3/f/firebase-admin/build.sbt +++ b/tests/firebase-admin/check-3/f/firebase-admin/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "firebase-admin" -version := "8.2.0-8b474c" +version := "8.2.0-1cd812" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/libMod.scala b/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/libMod.scala new file mode 100644 index 0000000000..aafc02c156 --- /dev/null +++ b/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/libMod.scala @@ -0,0 +1,46 @@ +package typings.firebaseAdmin + +import typings.googleCloudFirestore.FirebaseFirestore.Settings +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object libMod { + + object firestore { + + inline def apply(): Firestore = ^.asInstanceOf[js.Dynamic].apply().asInstanceOf[Firestore] + inline def apply(str: String): Firestore = ^.asInstanceOf[js.Dynamic].apply(str.asInstanceOf[js.Any]).asInstanceOf[Firestore] + + @JSImport("firebase-admin/lib", "firestore") + @js.native + val ^ : js.Any = js.native + + @JSImport("firebase-admin/lib", "firestore.Firestore") + @js.native + /** + * @param settings Configuration object. See [Firestore Documentation] + * {@link https://firebase.google.com/docs/firestore/} + */ + open class Firestore () + extends StObject + with typings.googleCloudFirestore.FirebaseFirestore.Firestore { + def this(settings: Settings) = this() + + /** + * Specifies custom settings to be used to configure the `Firestore` + * instance. Can only be invoked once and before any other Firestore + * method. + * + * If settings are provided via both `settings()` and the `Firestore` + * constructor, both settings objects are merged and any settings provided + * via `settings()` take precedence. + * + * @param {object} settings The settings to use for all Firestore + * operations. + */ + /* CompleteClass */ + override def settings(settings: Settings): Unit = js.native + } + } +} diff --git a/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/mod.scala b/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/mod.scala index 2850879272..193b9ab675 100644 --- a/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/mod.scala +++ b/tests/firebase-admin/check-3/f/firebase-admin/src/main/scala/typings/firebaseAdmin/mod.scala @@ -5,12 +5,13 @@ import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { object firestore { - inline def apply(): Firestore = ^.asInstanceOf[js.Dynamic].apply().asInstanceOf[Firestore] - inline def apply(str: String): Firestore = ^.asInstanceOf[js.Dynamic].apply(str.asInstanceOf[js.Any]).asInstanceOf[Firestore] + inline def apply(): typings.firebaseAdmin.libMod.firestore.Firestore = ^.asInstanceOf[js.Dynamic].apply().asInstanceOf[typings.firebaseAdmin.libMod.firestore.Firestore] + inline def apply(str: String): typings.firebaseAdmin.libMod.firestore.Firestore = ^.asInstanceOf[js.Dynamic].apply(str.asInstanceOf[js.Any]).asInstanceOf[typings.firebaseAdmin.libMod.firestore.Firestore] @JSImport("firebase-admin", "firestore") @js.native @@ -23,24 +24,8 @@ object mod { * {@link https://firebase.google.com/docs/firestore/} */ open class Firestore () - extends StObject - with typings.googleCloudFirestore.FirebaseFirestore.Firestore { + extends typings.firebaseAdmin.libMod.firestore.Firestore { def this(settings: Settings) = this() - - /** - * Specifies custom settings to be used to configure the `Firestore` - * instance. Can only be invoked once and before any other Firestore - * method. - * - * If settings are provided via both `settings()` and the `Firestore` - * constructor, both settings objects are merged and any settings provided - * via `settings()` take precedence. - * - * @param {object} settings The settings to use for all Firestore - * operations. - */ - /* CompleteClass */ - override def settings(settings: Settings): Unit = js.native } } } diff --git a/tests/fp-ts/check-3/f/fp-ts/build.sbt b/tests/fp-ts/check-3/f/fp-ts/build.sbt index 525e04b34e..f41e29499a 100644 --- a/tests/fp-ts/check-3/f/fp-ts/build.sbt +++ b/tests/fp-ts/check-3/f/fp-ts/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "fp-ts" -version := "1.2.0-071b7e" +version := "1.2.0-83bcad" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/libMod.scala b/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/libMod.scala new file mode 100644 index 0000000000..2e4e1bf8f3 --- /dev/null +++ b/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/libMod.scala @@ -0,0 +1,25 @@ +package typings.fpTs + +import typings.fpTs.libEitherMod.Either +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object libMod { + + object either { + + @JSImport("fp-ts/lib", "either.URI") + @js.native + val URI: /* "Either" */ String = js.native + } + + object task { + + @JSImport("fp-ts/lib", "task") + @js.native + val ^ : js.Any = js.native + + inline def tryCatch[L, A](f: Any, onrejected: js.Function1[/* reason */ js.Object, L]): Either[L, A] = (^.asInstanceOf[js.Dynamic].applyDynamic("tryCatch")(f.asInstanceOf[js.Any], onrejected.asInstanceOf[js.Any])).asInstanceOf[Either[L, A]] + } +} diff --git a/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/mod.scala b/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/mod.scala index 6be4f37850..cf3a73ed7c 100644 --- a/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/mod.scala +++ b/tests/fp-ts/check-3/f/fp-ts/src/main/scala/typings/fpTs/mod.scala @@ -5,6 +5,7 @@ import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { object either { diff --git a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt index 7b78a119b2..230c9823a5 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react-dropzone" -version := "10.1.10-3f6e87" +version := "10.1.10-76ad43" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/components/ReactDropzone.scala b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/components/ReactDropzone.scala index dcd3330157..40eb114c22 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/components/ReactDropzone.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/components/ReactDropzone.scala @@ -6,10 +6,10 @@ import org.scalajs.dom.HTMLElement import typingsJapgolly.StBuildingComponent import typingsJapgolly.react.mod.RefAttributes import typingsJapgolly.react.mod.global.JSX.Element -import typingsJapgolly.reactDropzone.mod.DropEvent -import typingsJapgolly.reactDropzone.mod.DropzoneProps -import typingsJapgolly.reactDropzone.mod.DropzoneRef -import typingsJapgolly.reactDropzone.mod.DropzoneState +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropEvent +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneProps +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneRef +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneState import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} diff --git a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/mod.scala b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/mod.scala index f657ffd2bd..4a1c131421 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/mod.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/mod.scala @@ -1,23 +1,16 @@ package typingsJapgolly.reactDropzone -import japgolly.scalajs.react.Callback -import japgolly.scalajs.react.ReactDragEventFrom -import japgolly.scalajs.react.ReactEventFrom -import japgolly.scalajs.react.facade.React.RefHandle -import org.scalablytyped.runtime.StringDictionary -import org.scalajs.dom.DragEvent -import org.scalajs.dom.Event -import org.scalajs.dom.HTMLElement -import org.scalajs.dom.HTMLInputElement -import typingsJapgolly.react.mod.DragEventHandler -import typingsJapgolly.react.mod.HTMLAttributes -import typingsJapgolly.react.mod.InputHTMLAttributes import typingsJapgolly.react.mod.RefAttributes import typingsJapgolly.react.mod.global.JSX.Element +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneOptions +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneProps +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneRef +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.DropzoneState import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { @JSImport("react-dropzone", JSImport.Namespace) @@ -28,323 +21,4 @@ object mod { inline def useDropzone(): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")().asInstanceOf[DropzoneState] inline def useDropzone(options: DropzoneOptions): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")(options.asInstanceOf[js.Any]).asInstanceOf[DropzoneState] - - type DropEvent = ReactDragEventFrom[HTMLElement] | ReactEventFrom[HTMLInputElement] | DragEvent | Event - - trait DropzoneInputProps - extends StObject - with InputHTMLAttributes[HTMLInputElement] { - - var refKey: js.UndefOr[String] = js.undefined - } - object DropzoneInputProps { - - inline def apply(): DropzoneInputProps = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneInputProps] - } - - extension [Self <: DropzoneInputProps](x: Self) { - - inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) - - inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) - } - } - - /* Inlined std.Pick, react-dropzone.react-dropzone.PropTypes> & { accept :string | std.Array | undefined, minSize :number | undefined, maxSize :number | undefined, preventDropOnDocument :boolean | undefined, noClick :boolean | undefined, noKeyboard :boolean | undefined, noDrag :boolean | undefined, noDragEventsBubbling :boolean | undefined, disabled :boolean | undefined, onDrop :(acceptedFiles : std.Array, rejectedFiles : std.Array, event : react-dropzone.react-dropzone.DropEvent): void | undefined, onDropAccepted :(files : std.Array, event : react-dropzone.react-dropzone.DropEvent): void | undefined, onDropRejected :(files : std.Array, event : react-dropzone.react-dropzone.DropEvent): void | undefined, getFilesFromEvent :(event : react-dropzone.react-dropzone.DropEvent): / * import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> * / any | undefined, onFileDialogCancel :(): void | undefined} */ - trait DropzoneOptions extends StObject { - - var accept: js.UndefOr[String | js.Array[String]] = js.undefined - - var disabled: js.UndefOr[Boolean] = js.undefined - - var getFilesFromEvent: js.UndefOr[ - js.Function1[ - /* event */ DropEvent, - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any - ] - ] = js.undefined - - var maxSize: js.UndefOr[Double] = js.undefined - - var minSize: js.UndefOr[Double] = js.undefined - - var multiple: js.UndefOr[Boolean] = js.undefined - - var noClick: js.UndefOr[Boolean] = js.undefined - - var noDrag: js.UndefOr[Boolean] = js.undefined - - var noDragEventsBubbling: js.UndefOr[Boolean] = js.undefined - - var noKeyboard: js.UndefOr[Boolean] = js.undefined - - var onDragEnter: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined - - var onDragLeave: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined - - var onDragOver: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined - - var onDrop: js.UndefOr[ - js.Function3[ - /* acceptedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* rejectedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* event */ DropEvent, - Unit - ] - ] = js.undefined - - var onDropAccepted: js.UndefOr[ - js.Function2[ - /* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* event */ DropEvent, - Unit - ] - ] = js.undefined - - var onDropRejected: js.UndefOr[ - js.Function2[ - /* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* event */ DropEvent, - Unit - ] - ] = js.undefined - - var onFileDialogCancel: js.UndefOr[js.Function0[Unit]] = js.undefined - - var preventDropOnDocument: js.UndefOr[Boolean] = js.undefined - } - object DropzoneOptions { - - inline def apply(): DropzoneOptions = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneOptions] - } - - extension [Self <: DropzoneOptions](x: Self) { - - inline def setAccept(value: String | js.Array[String]): Self = StObject.set(x, "accept", value.asInstanceOf[js.Any]) - - inline def setAcceptUndefined: Self = StObject.set(x, "accept", js.undefined) - - inline def setAcceptVarargs(value: String*): Self = StObject.set(x, "accept", js.Array(value*)) - - inline def setDisabled(value: Boolean): Self = StObject.set(x, "disabled", value.asInstanceOf[js.Any]) - - inline def setDisabledUndefined: Self = StObject.set(x, "disabled", js.undefined) - - inline def setGetFilesFromEvent( - value: /* event */ DropEvent => /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any - ): Self = StObject.set(x, "getFilesFromEvent", js.Any.fromFunction1(value)) - - inline def setGetFilesFromEventUndefined: Self = StObject.set(x, "getFilesFromEvent", js.undefined) - - inline def setMaxSize(value: Double): Self = StObject.set(x, "maxSize", value.asInstanceOf[js.Any]) - - inline def setMaxSizeUndefined: Self = StObject.set(x, "maxSize", js.undefined) - - inline def setMinSize(value: Double): Self = StObject.set(x, "minSize", value.asInstanceOf[js.Any]) - - inline def setMinSizeUndefined: Self = StObject.set(x, "minSize", js.undefined) - - inline def setMultiple(value: Boolean): Self = StObject.set(x, "multiple", value.asInstanceOf[js.Any]) - - inline def setMultipleUndefined: Self = StObject.set(x, "multiple", js.undefined) - - inline def setNoClick(value: Boolean): Self = StObject.set(x, "noClick", value.asInstanceOf[js.Any]) - - inline def setNoClickUndefined: Self = StObject.set(x, "noClick", js.undefined) - - inline def setNoDrag(value: Boolean): Self = StObject.set(x, "noDrag", value.asInstanceOf[js.Any]) - - inline def setNoDragEventsBubbling(value: Boolean): Self = StObject.set(x, "noDragEventsBubbling", value.asInstanceOf[js.Any]) - - inline def setNoDragEventsBubblingUndefined: Self = StObject.set(x, "noDragEventsBubbling", js.undefined) - - inline def setNoDragUndefined: Self = StObject.set(x, "noDrag", js.undefined) - - inline def setNoKeyboard(value: Boolean): Self = StObject.set(x, "noKeyboard", value.asInstanceOf[js.Any]) - - inline def setNoKeyboardUndefined: Self = StObject.set(x, "noKeyboard", js.undefined) - - inline def setOnDragEnter(value: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element] => Callback): Self = StObject.set(x, "onDragEnter", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element]) => value(t0).runNow())) - - inline def setOnDragEnterUndefined: Self = StObject.set(x, "onDragEnter", js.undefined) - - inline def setOnDragLeave(value: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element] => Callback): Self = StObject.set(x, "onDragLeave", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element]) => value(t0).runNow())) - - inline def setOnDragLeaveUndefined: Self = StObject.set(x, "onDragLeave", js.undefined) - - inline def setOnDragOver(value: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element] => Callback): Self = StObject.set(x, "onDragOver", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element]) => value(t0).runNow())) - - inline def setOnDragOverUndefined: Self = StObject.set(x, "onDragOver", js.undefined) - - inline def setOnDrop( - value: (/* acceptedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* rejectedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* event */ DropEvent) => Callback - ): Self = StObject.set(x, "onDrop", js.Any.fromFunction3((t0: /* acceptedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], t1: /* rejectedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], t2: /* event */ DropEvent) => (value(t0, t1, t2)).runNow())) - - inline def setOnDropAccepted( - value: (/* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* event */ DropEvent) => Callback - ): Self = StObject.set(x, "onDropAccepted", js.Any.fromFunction2((t0: /* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], t1: /* event */ DropEvent) => (value(t0, t1)).runNow())) - - inline def setOnDropAcceptedUndefined: Self = StObject.set(x, "onDropAccepted", js.undefined) - - inline def setOnDropRejected( - value: (/* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* event */ DropEvent) => Callback - ): Self = StObject.set(x, "onDropRejected", js.Any.fromFunction2((t0: /* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], t1: /* event */ DropEvent) => (value(t0, t1)).runNow())) - - inline def setOnDropRejectedUndefined: Self = StObject.set(x, "onDropRejected", js.undefined) - - inline def setOnDropUndefined: Self = StObject.set(x, "onDrop", js.undefined) - - inline def setOnFileDialogCancel(value: Callback): Self = StObject.set(x, "onFileDialogCancel", value.toJsFn) - - inline def setOnFileDialogCancelUndefined: Self = StObject.set(x, "onFileDialogCancel", js.undefined) - - inline def setPreventDropOnDocument(value: Boolean): Self = StObject.set(x, "preventDropOnDocument", value.asInstanceOf[js.Any]) - - inline def setPreventDropOnDocumentUndefined: Self = StObject.set(x, "preventDropOnDocument", js.undefined) - } - } - - trait DropzoneProps - extends StObject - with DropzoneOptions { - - var children: js.UndefOr[js.Function1[/* state */ DropzoneState, Element]] = js.undefined - } - object DropzoneProps { - - inline def apply(): DropzoneProps = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneProps] - } - - extension [Self <: DropzoneProps](x: Self) { - - inline def setChildren(value: /* state */ DropzoneState => Element): Self = StObject.set(x, "children", js.Any.fromFunction1(value)) - - inline def setChildrenUndefined: Self = StObject.set(x, "children", js.undefined) - } - } - - trait DropzoneRef extends StObject { - - def open(): Unit - } - object DropzoneRef { - - inline def apply(open: Callback): DropzoneRef = { - val __obj = js.Dynamic.literal(open = open.toJsFn) - __obj.asInstanceOf[DropzoneRef] - } - - extension [Self <: DropzoneRef](x: Self) { - - inline def setOpen(value: Callback): Self = StObject.set(x, "open", value.toJsFn) - } - } - - trait DropzoneRootProps - extends StObject - with HTMLAttributes[HTMLElement] - with /* key */ StringDictionary[Any] { - - var refKey: js.UndefOr[String] = js.undefined - } - object DropzoneRootProps { - - inline def apply(): DropzoneRootProps = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneRootProps] - } - - extension [Self <: DropzoneRootProps](x: Self) { - - inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) - - inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) - } - } - - @js.native - trait DropzoneState - extends StObject - with DropzoneRef { - - var acceptedFiles: js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ] = js.native - - var draggedFiles: js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ] = js.native - - def getInputProps(): DropzoneInputProps = js.native - def getInputProps(props: DropzoneInputProps): DropzoneInputProps = js.native - - def getRootProps(): DropzoneRootProps = js.native - def getRootProps(props: DropzoneRootProps): DropzoneRootProps = js.native - - var inputRef: RefHandle[HTMLInputElement] = js.native - - var isDragAccept: Boolean = js.native - - var isDragActive: Boolean = js.native - - var isDragReject: Boolean = js.native - - var isFileDialogActive: Boolean = js.native - - var isFocused: Boolean = js.native - - var rejectedFiles: js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ] = js.native - - var rootRef: RefHandle[HTMLElement] = js.native - } - - /* Rewritten from type alias, can be one of: - - typingsJapgolly.reactDropzone.reactDropzoneStrings.multiple - - typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragEnter - - typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragOver - - typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragLeave - */ - trait PropTypes extends StObject - object PropTypes { - - inline def multiple: typingsJapgolly.reactDropzone.reactDropzoneStrings.multiple = "multiple".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.multiple] - - inline def onDragEnter: typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragEnter = "onDragEnter".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragEnter] - - inline def onDragLeave: typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragLeave = "onDragLeave".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragLeave] - - inline def onDragOver: typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragOver = "onDragOver".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragOver] - } } diff --git a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/reactDropzoneStrings.scala b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/reactDropzoneStrings.scala index 45f9469cdd..5a5f817ab3 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/reactDropzoneStrings.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/reactDropzoneStrings.scala @@ -1,6 +1,6 @@ package typingsJapgolly.reactDropzone -import typingsJapgolly.reactDropzone.mod.PropTypes +import typingsJapgolly.reactDropzone.typingsReactDropzoneMod.PropTypes import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} diff --git a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/typingsReactDropzoneMod.scala b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/typingsReactDropzoneMod.scala new file mode 100644 index 0000000000..cec41c2ba1 --- /dev/null +++ b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/src/main/scala/typingsJapgolly/reactDropzone/typingsReactDropzoneMod.scala @@ -0,0 +1,350 @@ +package typingsJapgolly.reactDropzone + +import japgolly.scalajs.react.Callback +import japgolly.scalajs.react.ReactDragEventFrom +import japgolly.scalajs.react.ReactEventFrom +import japgolly.scalajs.react.facade.React.RefHandle +import org.scalablytyped.runtime.StringDictionary +import org.scalajs.dom.DragEvent +import org.scalajs.dom.Event +import org.scalajs.dom.HTMLElement +import org.scalajs.dom.HTMLInputElement +import typingsJapgolly.react.mod.DragEventHandler +import typingsJapgolly.react.mod.HTMLAttributes +import typingsJapgolly.react.mod.InputHTMLAttributes +import typingsJapgolly.react.mod.RefAttributes +import typingsJapgolly.react.mod.global.JSX.Element +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object typingsReactDropzoneMod { + + @JSImport("react-dropzone/typings/react-dropzone", JSImport.Namespace) + @js.native + val ^ : js.Any = js.native + + inline def default(props: DropzoneProps & RefAttributes[DropzoneRef]): Element = ^.asInstanceOf[js.Dynamic].applyDynamic("default")(props.asInstanceOf[js.Any]).asInstanceOf[Element] + + inline def useDropzone(): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")().asInstanceOf[DropzoneState] + inline def useDropzone(options: DropzoneOptions): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")(options.asInstanceOf[js.Any]).asInstanceOf[DropzoneState] + + type DropEvent = ReactDragEventFrom[HTMLElement] | ReactEventFrom[HTMLInputElement] | DragEvent | Event + + trait DropzoneInputProps + extends StObject + with InputHTMLAttributes[HTMLInputElement] { + + var refKey: js.UndefOr[String] = js.undefined + } + object DropzoneInputProps { + + inline def apply(): DropzoneInputProps = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneInputProps] + } + + extension [Self <: DropzoneInputProps](x: Self) { + + inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) + + inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) + } + } + + /* Inlined std.Pick, react-dropzone.react-dropzone/typings/react-dropzone.PropTypes> & { accept :string | std.Array | undefined, minSize :number | undefined, maxSize :number | undefined, preventDropOnDocument :boolean | undefined, noClick :boolean | undefined, noKeyboard :boolean | undefined, noDrag :boolean | undefined, noDragEventsBubbling :boolean | undefined, disabled :boolean | undefined, onDrop :(acceptedFiles : std.Array, rejectedFiles : std.Array, event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): void | undefined, onDropAccepted :(files : std.Array, event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): void | undefined, onDropRejected :(files : std.Array, event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): void | undefined, getFilesFromEvent :(event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): / * import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> * / any | undefined, onFileDialogCancel :(): void | undefined} */ + trait DropzoneOptions extends StObject { + + var accept: js.UndefOr[String | js.Array[String]] = js.undefined + + var disabled: js.UndefOr[Boolean] = js.undefined + + var getFilesFromEvent: js.UndefOr[ + js.Function1[ + /* event */ DropEvent, + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any + ] + ] = js.undefined + + var maxSize: js.UndefOr[Double] = js.undefined + + var minSize: js.UndefOr[Double] = js.undefined + + var multiple: js.UndefOr[Boolean] = js.undefined + + var noClick: js.UndefOr[Boolean] = js.undefined + + var noDrag: js.UndefOr[Boolean] = js.undefined + + var noDragEventsBubbling: js.UndefOr[Boolean] = js.undefined + + var noKeyboard: js.UndefOr[Boolean] = js.undefined + + var onDragEnter: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined + + var onDragLeave: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined + + var onDragOver: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined + + var onDrop: js.UndefOr[ + js.Function3[ + /* acceptedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* rejectedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* event */ DropEvent, + Unit + ] + ] = js.undefined + + var onDropAccepted: js.UndefOr[ + js.Function2[ + /* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* event */ DropEvent, + Unit + ] + ] = js.undefined + + var onDropRejected: js.UndefOr[ + js.Function2[ + /* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* event */ DropEvent, + Unit + ] + ] = js.undefined + + var onFileDialogCancel: js.UndefOr[js.Function0[Unit]] = js.undefined + + var preventDropOnDocument: js.UndefOr[Boolean] = js.undefined + } + object DropzoneOptions { + + inline def apply(): DropzoneOptions = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneOptions] + } + + extension [Self <: DropzoneOptions](x: Self) { + + inline def setAccept(value: String | js.Array[String]): Self = StObject.set(x, "accept", value.asInstanceOf[js.Any]) + + inline def setAcceptUndefined: Self = StObject.set(x, "accept", js.undefined) + + inline def setAcceptVarargs(value: String*): Self = StObject.set(x, "accept", js.Array(value*)) + + inline def setDisabled(value: Boolean): Self = StObject.set(x, "disabled", value.asInstanceOf[js.Any]) + + inline def setDisabledUndefined: Self = StObject.set(x, "disabled", js.undefined) + + inline def setGetFilesFromEvent( + value: /* event */ DropEvent => /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any + ): Self = StObject.set(x, "getFilesFromEvent", js.Any.fromFunction1(value)) + + inline def setGetFilesFromEventUndefined: Self = StObject.set(x, "getFilesFromEvent", js.undefined) + + inline def setMaxSize(value: Double): Self = StObject.set(x, "maxSize", value.asInstanceOf[js.Any]) + + inline def setMaxSizeUndefined: Self = StObject.set(x, "maxSize", js.undefined) + + inline def setMinSize(value: Double): Self = StObject.set(x, "minSize", value.asInstanceOf[js.Any]) + + inline def setMinSizeUndefined: Self = StObject.set(x, "minSize", js.undefined) + + inline def setMultiple(value: Boolean): Self = StObject.set(x, "multiple", value.asInstanceOf[js.Any]) + + inline def setMultipleUndefined: Self = StObject.set(x, "multiple", js.undefined) + + inline def setNoClick(value: Boolean): Self = StObject.set(x, "noClick", value.asInstanceOf[js.Any]) + + inline def setNoClickUndefined: Self = StObject.set(x, "noClick", js.undefined) + + inline def setNoDrag(value: Boolean): Self = StObject.set(x, "noDrag", value.asInstanceOf[js.Any]) + + inline def setNoDragEventsBubbling(value: Boolean): Self = StObject.set(x, "noDragEventsBubbling", value.asInstanceOf[js.Any]) + + inline def setNoDragEventsBubblingUndefined: Self = StObject.set(x, "noDragEventsBubbling", js.undefined) + + inline def setNoDragUndefined: Self = StObject.set(x, "noDrag", js.undefined) + + inline def setNoKeyboard(value: Boolean): Self = StObject.set(x, "noKeyboard", value.asInstanceOf[js.Any]) + + inline def setNoKeyboardUndefined: Self = StObject.set(x, "noKeyboard", js.undefined) + + inline def setOnDragEnter(value: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element] => Callback): Self = StObject.set(x, "onDragEnter", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element]) => value(t0).runNow())) + + inline def setOnDragEnterUndefined: Self = StObject.set(x, "onDragEnter", js.undefined) + + inline def setOnDragLeave(value: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element] => Callback): Self = StObject.set(x, "onDragLeave", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element]) => value(t0).runNow())) + + inline def setOnDragLeaveUndefined: Self = StObject.set(x, "onDragLeave", js.undefined) + + inline def setOnDragOver(value: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element] => Callback): Self = StObject.set(x, "onDragOver", js.Any.fromFunction1((t0: ReactDragEventFrom[HTMLElement & org.scalajs.dom.Element]) => value(t0).runNow())) + + inline def setOnDragOverUndefined: Self = StObject.set(x, "onDragOver", js.undefined) + + inline def setOnDrop( + value: (/* acceptedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* rejectedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* event */ DropEvent) => Callback + ): Self = StObject.set(x, "onDrop", js.Any.fromFunction3((t0: /* acceptedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], t1: /* rejectedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], t2: /* event */ DropEvent) => (value(t0, t1, t2)).runNow())) + + inline def setOnDropAccepted( + value: (/* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* event */ DropEvent) => Callback + ): Self = StObject.set(x, "onDropAccepted", js.Any.fromFunction2((t0: /* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], t1: /* event */ DropEvent) => (value(t0, t1)).runNow())) + + inline def setOnDropAcceptedUndefined: Self = StObject.set(x, "onDropAccepted", js.undefined) + + inline def setOnDropRejected( + value: (/* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* event */ DropEvent) => Callback + ): Self = StObject.set(x, "onDropRejected", js.Any.fromFunction2((t0: /* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], t1: /* event */ DropEvent) => (value(t0, t1)).runNow())) + + inline def setOnDropRejectedUndefined: Self = StObject.set(x, "onDropRejected", js.undefined) + + inline def setOnDropUndefined: Self = StObject.set(x, "onDrop", js.undefined) + + inline def setOnFileDialogCancel(value: Callback): Self = StObject.set(x, "onFileDialogCancel", value.toJsFn) + + inline def setOnFileDialogCancelUndefined: Self = StObject.set(x, "onFileDialogCancel", js.undefined) + + inline def setPreventDropOnDocument(value: Boolean): Self = StObject.set(x, "preventDropOnDocument", value.asInstanceOf[js.Any]) + + inline def setPreventDropOnDocumentUndefined: Self = StObject.set(x, "preventDropOnDocument", js.undefined) + } + } + + trait DropzoneProps + extends StObject + with DropzoneOptions { + + var children: js.UndefOr[js.Function1[/* state */ DropzoneState, Element]] = js.undefined + } + object DropzoneProps { + + inline def apply(): DropzoneProps = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneProps] + } + + extension [Self <: DropzoneProps](x: Self) { + + inline def setChildren(value: /* state */ DropzoneState => Element): Self = StObject.set(x, "children", js.Any.fromFunction1(value)) + + inline def setChildrenUndefined: Self = StObject.set(x, "children", js.undefined) + } + } + + trait DropzoneRef extends StObject { + + def open(): Unit + } + object DropzoneRef { + + inline def apply(open: Callback): DropzoneRef = { + val __obj = js.Dynamic.literal(open = open.toJsFn) + __obj.asInstanceOf[DropzoneRef] + } + + extension [Self <: DropzoneRef](x: Self) { + + inline def setOpen(value: Callback): Self = StObject.set(x, "open", value.toJsFn) + } + } + + trait DropzoneRootProps + extends StObject + with HTMLAttributes[HTMLElement] + with /* key */ StringDictionary[Any] { + + var refKey: js.UndefOr[String] = js.undefined + } + object DropzoneRootProps { + + inline def apply(): DropzoneRootProps = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneRootProps] + } + + extension [Self <: DropzoneRootProps](x: Self) { + + inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) + + inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) + } + } + + @js.native + trait DropzoneState + extends StObject + with DropzoneRef { + + var acceptedFiles: js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ] = js.native + + var draggedFiles: js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ] = js.native + + def getInputProps(): DropzoneInputProps = js.native + def getInputProps(props: DropzoneInputProps): DropzoneInputProps = js.native + + def getRootProps(): DropzoneRootProps = js.native + def getRootProps(props: DropzoneRootProps): DropzoneRootProps = js.native + + var inputRef: RefHandle[HTMLInputElement] = js.native + + var isDragAccept: Boolean = js.native + + var isDragActive: Boolean = js.native + + var isDragReject: Boolean = js.native + + var isFileDialogActive: Boolean = js.native + + var isFocused: Boolean = js.native + + var rejectedFiles: js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ] = js.native + + var rootRef: RefHandle[HTMLElement] = js.native + } + + /* Rewritten from type alias, can be one of: + - typingsJapgolly.reactDropzone.reactDropzoneStrings.multiple + - typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragEnter + - typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragOver + - typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragLeave + */ + trait PropTypes extends StObject + object PropTypes { + + inline def multiple: typingsJapgolly.reactDropzone.reactDropzoneStrings.multiple = "multiple".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.multiple] + + inline def onDragEnter: typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragEnter = "onDragEnter".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragEnter] + + inline def onDragLeave: typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragLeave = "onDragLeave".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragLeave] + + inline def onDragOver: typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragOver = "onDragOver".asInstanceOf[typingsJapgolly.reactDropzone.reactDropzoneStrings.onDragOver] + } +} diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt index 5340c98de1..fe743db9b2 100644 --- a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-event-listener" -version := "0.38.0-8cd60e" +version := "0.38.0-d4b1ad" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/distEsMod.scala b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/distEsMod.scala new file mode 100644 index 0000000000..ce7b163738 --- /dev/null +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/distEsMod.scala @@ -0,0 +1,62 @@ +package typingsJapgolly.stardustUiReactComponentEventListener + +import japgolly.scalajs.react.facade.React.RefHandle +import typingsJapgolly.stardustUiReactComponentEventListener.anon.Capture +import typingsJapgolly.stardustUiReactComponentEventListener.anon.Listener +import typingsJapgolly.stardustUiReactComponentEventListener.distEsTypesMod.EventListenerOptions +import typingsJapgolly.stardustUiReactComponentEventListener.distEsTypesMod.EventTypes +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object distEsMod { + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", JSImport.Namespace) + @js.native + val ^ : js.Any = js.native + + object EventListener { + + inline def apply[T /* <: EventTypes */](props: EventListenerOptions[T]): Any = ^.asInstanceOf[js.Dynamic].apply(props.asInstanceOf[js.Any]).asInstanceOf[Any] + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener") + @js.native + val ^ : js.Any = js.native + + object defaultProps { + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.defaultProps") + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.defaultProps.capture") + @js.native + def capture: Boolean = js.native + inline def capture_=(x: Boolean): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("capture")(x.asInstanceOf[js.Any]) + } + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.displayName") + @js.native + def displayName: String = js.native + inline def displayName_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("displayName")(x.asInstanceOf[js.Any]) + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.propTypes") + @js.native + def propTypes: Capture | Listener = js.native + inline def propTypes_=(x: Capture | Listener): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("propTypes")(x.asInstanceOf[js.Any]) + } + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "documentRef") + @js.native + val documentRef: RefHandle[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Node */ Any + ] = js.native + + inline def useEventListener[T /* <: /* import warning: LimitUnionLength.leaveTypeRef Was union type with length 91, starting with typingsJapgolly.stardustUiReactComponentEventListener.stardustUiReactComponentEventListenerStrings.waiting, typingsJapgolly.stardustUiReactComponentEventListener.stardustUiReactComponentEventListenerStrings.error, typingsJapgolly.stardustUiReactComponentEventListener.stardustUiReactComponentEventListenerStrings.abort */ Any */](options: EventListenerOptions[T]): Unit = ^.asInstanceOf[js.Dynamic].applyDynamic("useEventListener")(options.asInstanceOf[js.Any]).asInstanceOf[Unit] + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "windowRef") + @js.native + val windowRef: RefHandle[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Node */ Any + ] = js.native +} diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/mod.scala b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/mod.scala index 1ffb992a84..656e4cd2de 100644 --- a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/mod.scala +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsJapgolly/stardustUiReactComponentEventListener/mod.scala @@ -9,6 +9,7 @@ import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { @JSImport("@stardust-ui/react-component-event-listener", JSImport.Namespace) diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt index f8dab74711..141fd13cfb 100644 --- a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-ref" -version := "0.38.0-af16f8" +version := "0.38.0-303839" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/distEsMod.scala b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/distEsMod.scala new file mode 100644 index 0000000000..8c34ac0bd9 --- /dev/null +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/distEsMod.scala @@ -0,0 +1,83 @@ +package typingsJapgolly.stardustUiReactComponentRef + +import japgolly.scalajs.react.facade.React.RefHandle +import typingsJapgolly.react.mod.FunctionComponent +import typingsJapgolly.stardustUiReactComponentRef.anon.Children +import typingsJapgolly.stardustUiReactComponentRef.anon.InnerRef +import typingsJapgolly.stardustUiReactComponentRef.distEsRefFindNodeMod.default +import typingsJapgolly.stardustUiReactComponentRef.distEsTypesMod.RefProps +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object distEsMod { + + @JSImport("@stardust-ui/react-component-ref/dist/es", JSImport.Namespace) + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "Ref") + @js.native + val Ref: FunctionComponent[RefProps] = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode") + @js.native + open class RefFindNode () extends default + /* static members */ + object RefFindNode { + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode") + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode.displayName") + @js.native + def displayName: String = js.native + inline def displayName_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("displayName")(x.asInstanceOf[js.Any]) + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode.propTypes") + @js.native + def propTypes: Children | InnerRef = js.native + inline def propTypes_=(x: Children | InnerRef): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("propTypes")(x.asInstanceOf[js.Any]) + } + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward") + @js.native + open class RefForward () + extends typingsJapgolly.stardustUiReactComponentRef.distEsRefForwardMod.default + /* static members */ + object RefForward { + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward") + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward.displayName") + @js.native + def displayName: String = js.native + inline def displayName_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("displayName")(x.asInstanceOf[js.Any]) + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward.propTypes") + @js.native + def propTypes: Children | InnerRef = js.native + inline def propTypes_=(x: Children | InnerRef): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("propTypes")(x.asInstanceOf[js.Any]) + } + + /** + * The function that correctly handles passing refs. + * + * @param ref An ref object or function + * @param node A node that should be passed by ref + */ + inline def handleRef[N](ref: typingsJapgolly.react.mod.Ref[N], node: N): Unit = (^.asInstanceOf[js.Dynamic].applyDynamic("handleRef")(ref.asInstanceOf[js.Any], node.asInstanceOf[js.Any])).asInstanceOf[Unit] + + /** Checks that the passed object is a valid React ref object. */ + inline def isRefObject(ref: Any): /* is react.react.RefObject */ Boolean = ^.asInstanceOf[js.Dynamic].applyDynamic("isRefObject")(ref.asInstanceOf[js.Any]).asInstanceOf[/* is react.react.RefObject */ Boolean] + + @JSImport("@stardust-ui/react-component-ref/dist/es", "refPropType") + @js.native + val refPropType: /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify PropTypes.Requireable> */ Any = js.native + + /** Creates a React ref object from existing DOM node. */ + inline def toRefObject[T /* <: /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Node */ Any */](node: T): RefHandle[T] = ^.asInstanceOf[js.Dynamic].applyDynamic("toRefObject")(node.asInstanceOf[js.Any]).asInstanceOf[RefHandle[T]] +} diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/mod.scala b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/mod.scala index 8985926ac3..ce49b1435a 100644 --- a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/mod.scala +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/src/main/scala/typingsJapgolly/stardustUiReactComponentRef/mod.scala @@ -4,12 +4,12 @@ import japgolly.scalajs.react.facade.React.RefHandle import typingsJapgolly.react.mod.FunctionComponent import typingsJapgolly.stardustUiReactComponentRef.anon.Children import typingsJapgolly.stardustUiReactComponentRef.anon.InnerRef -import typingsJapgolly.stardustUiReactComponentRef.distEsRefFindNodeMod.default import typingsJapgolly.stardustUiReactComponentRef.distEsTypesMod.RefProps import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { @JSImport("@stardust-ui/react-component-ref", JSImport.Namespace) @@ -22,7 +22,8 @@ object mod { @JSImport("@stardust-ui/react-component-ref", "RefFindNode") @js.native - open class RefFindNode () extends default + open class RefFindNode () + extends typingsJapgolly.stardustUiReactComponentRef.distEsMod.RefFindNode /* static members */ object RefFindNode { @@ -44,7 +45,7 @@ object mod { @JSImport("@stardust-ui/react-component-ref", "RefForward") @js.native open class RefForward () - extends typingsJapgolly.stardustUiReactComponentRef.distEsRefForwardMod.default + extends typingsJapgolly.stardustUiReactComponentRef.distEsMod.RefForward /* static members */ object RefForward { diff --git a/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt b/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt index 3927b7a8fd..db5f632cb0 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react-dropzone" -version := "10.1.10-438eca" +version := "10.1.10-606391" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/components/ReactDropzone.scala b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/components/ReactDropzone.scala index f8db874643..7cd60d7df4 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/components/ReactDropzone.scala +++ b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/components/ReactDropzone.scala @@ -6,10 +6,10 @@ import typingsSlinky.StBuildingComponent import typingsSlinky.react.mod.DragEvent import typingsSlinky.react.mod.RefAttributes import typingsSlinky.react.mod.global.JSX.Element -import typingsSlinky.reactDropzone.mod.DropEvent -import typingsSlinky.reactDropzone.mod.DropzoneProps -import typingsSlinky.reactDropzone.mod.DropzoneRef -import typingsSlinky.reactDropzone.mod.DropzoneState +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropEvent +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneProps +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneRef +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneState import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} diff --git a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/mod.scala b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/mod.scala index 07062d3ee9..ab134331b9 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/mod.scala +++ b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/mod.scala @@ -1,21 +1,16 @@ package typingsSlinky.reactDropzone -import org.scalablytyped.runtime.StringDictionary -import org.scalajs.dom.Event -import org.scalajs.dom.HTMLElement -import org.scalajs.dom.HTMLInputElement -import slinky.core.facade.ReactRef -import typingsSlinky.react.mod.ChangeEvent -import typingsSlinky.react.mod.DragEvent -import typingsSlinky.react.mod.DragEventHandler -import typingsSlinky.react.mod.HTMLAttributes -import typingsSlinky.react.mod.InputHTMLAttributes import typingsSlinky.react.mod.RefAttributes import typingsSlinky.react.mod.global.JSX.Element +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneOptions +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneProps +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneRef +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.DropzoneState import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { @JSImport("react-dropzone", JSImport.Namespace) @@ -26,315 +21,4 @@ object mod { inline def useDropzone(): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")().asInstanceOf[DropzoneState] inline def useDropzone(options: DropzoneOptions): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")(options.asInstanceOf[js.Any]).asInstanceOf[DropzoneState] - - type DropEvent = DragEvent[HTMLElement] | ChangeEvent[HTMLInputElement] | org.scalajs.dom.DragEvent | Event - - trait DropzoneInputProps - extends StObject - with InputHTMLAttributes[HTMLInputElement] { - - var refKey: js.UndefOr[String] = js.undefined - } - object DropzoneInputProps { - - inline def apply(): DropzoneInputProps = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneInputProps] - } - - extension [Self <: DropzoneInputProps](x: Self) { - - inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) - - inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) - } - } - - /* Inlined std.Pick, react-dropzone.react-dropzone.PropTypes> & { accept :string | std.Array | undefined, minSize :number | undefined, maxSize :number | undefined, preventDropOnDocument :boolean | undefined, noClick :boolean | undefined, noKeyboard :boolean | undefined, noDrag :boolean | undefined, noDragEventsBubbling :boolean | undefined, disabled :boolean | undefined, onDrop :(acceptedFiles : std.Array, rejectedFiles : std.Array, event : react-dropzone.react-dropzone.DropEvent): void | undefined, onDropAccepted :(files : std.Array, event : react-dropzone.react-dropzone.DropEvent): void | undefined, onDropRejected :(files : std.Array, event : react-dropzone.react-dropzone.DropEvent): void | undefined, getFilesFromEvent :(event : react-dropzone.react-dropzone.DropEvent): / * import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> * / any | undefined, onFileDialogCancel :(): void | undefined} */ - trait DropzoneOptions extends StObject { - - var accept: js.UndefOr[String | js.Array[String]] = js.undefined - - var disabled: js.UndefOr[Boolean] = js.undefined - - var getFilesFromEvent: js.UndefOr[ - js.Function1[ - /* event */ DropEvent, - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any - ] - ] = js.undefined - - var maxSize: js.UndefOr[Double] = js.undefined - - var minSize: js.UndefOr[Double] = js.undefined - - var multiple: js.UndefOr[Boolean] = js.undefined - - var noClick: js.UndefOr[Boolean] = js.undefined - - var noDrag: js.UndefOr[Boolean] = js.undefined - - var noDragEventsBubbling: js.UndefOr[Boolean] = js.undefined - - var noKeyboard: js.UndefOr[Boolean] = js.undefined - - var onDragEnter: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined - - var onDragLeave: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined - - var onDragOver: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined - - var onDrop: js.UndefOr[ - js.Function3[ - /* acceptedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* rejectedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* event */ DropEvent, - Unit - ] - ] = js.undefined - - var onDropAccepted: js.UndefOr[ - js.Function2[ - /* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* event */ DropEvent, - Unit - ] - ] = js.undefined - - var onDropRejected: js.UndefOr[ - js.Function2[ - /* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], - /* event */ DropEvent, - Unit - ] - ] = js.undefined - - var onFileDialogCancel: js.UndefOr[js.Function0[Unit]] = js.undefined - - var preventDropOnDocument: js.UndefOr[Boolean] = js.undefined - } - object DropzoneOptions { - - inline def apply(): DropzoneOptions = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneOptions] - } - - extension [Self <: DropzoneOptions](x: Self) { - - inline def setAccept(value: String | js.Array[String]): Self = StObject.set(x, "accept", value.asInstanceOf[js.Any]) - - inline def setAcceptUndefined: Self = StObject.set(x, "accept", js.undefined) - - inline def setAcceptVarargs(value: String*): Self = StObject.set(x, "accept", js.Array(value*)) - - inline def setDisabled(value: Boolean): Self = StObject.set(x, "disabled", value.asInstanceOf[js.Any]) - - inline def setDisabledUndefined: Self = StObject.set(x, "disabled", js.undefined) - - inline def setGetFilesFromEvent( - value: /* event */ DropEvent => /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any - ): Self = StObject.set(x, "getFilesFromEvent", js.Any.fromFunction1(value)) - - inline def setGetFilesFromEventUndefined: Self = StObject.set(x, "getFilesFromEvent", js.undefined) - - inline def setMaxSize(value: Double): Self = StObject.set(x, "maxSize", value.asInstanceOf[js.Any]) - - inline def setMaxSizeUndefined: Self = StObject.set(x, "maxSize", js.undefined) - - inline def setMinSize(value: Double): Self = StObject.set(x, "minSize", value.asInstanceOf[js.Any]) - - inline def setMinSizeUndefined: Self = StObject.set(x, "minSize", js.undefined) - - inline def setMultiple(value: Boolean): Self = StObject.set(x, "multiple", value.asInstanceOf[js.Any]) - - inline def setMultipleUndefined: Self = StObject.set(x, "multiple", js.undefined) - - inline def setNoClick(value: Boolean): Self = StObject.set(x, "noClick", value.asInstanceOf[js.Any]) - - inline def setNoClickUndefined: Self = StObject.set(x, "noClick", js.undefined) - - inline def setNoDrag(value: Boolean): Self = StObject.set(x, "noDrag", value.asInstanceOf[js.Any]) - - inline def setNoDragEventsBubbling(value: Boolean): Self = StObject.set(x, "noDragEventsBubbling", value.asInstanceOf[js.Any]) - - inline def setNoDragEventsBubblingUndefined: Self = StObject.set(x, "noDragEventsBubbling", js.undefined) - - inline def setNoDragUndefined: Self = StObject.set(x, "noDrag", js.undefined) - - inline def setNoKeyboard(value: Boolean): Self = StObject.set(x, "noKeyboard", value.asInstanceOf[js.Any]) - - inline def setNoKeyboardUndefined: Self = StObject.set(x, "noKeyboard", js.undefined) - - inline def setOnDragEnter(value: DragEvent[HTMLElement] => Unit): Self = StObject.set(x, "onDragEnter", js.Any.fromFunction1(value)) - - inline def setOnDragEnterUndefined: Self = StObject.set(x, "onDragEnter", js.undefined) - - inline def setOnDragLeave(value: DragEvent[HTMLElement] => Unit): Self = StObject.set(x, "onDragLeave", js.Any.fromFunction1(value)) - - inline def setOnDragLeaveUndefined: Self = StObject.set(x, "onDragLeave", js.undefined) - - inline def setOnDragOver(value: DragEvent[HTMLElement] => Unit): Self = StObject.set(x, "onDragOver", js.Any.fromFunction1(value)) - - inline def setOnDragOverUndefined: Self = StObject.set(x, "onDragOver", js.undefined) - - inline def setOnDrop( - value: (/* acceptedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* rejectedFiles */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* event */ DropEvent) => Unit - ): Self = StObject.set(x, "onDrop", js.Any.fromFunction3(value)) - - inline def setOnDropAccepted( - value: (/* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* event */ DropEvent) => Unit - ): Self = StObject.set(x, "onDropAccepted", js.Any.fromFunction2(value)) - - inline def setOnDropAcceptedUndefined: Self = StObject.set(x, "onDropAccepted", js.undefined) - - inline def setOnDropRejected( - value: (/* files */ js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ], /* event */ DropEvent) => Unit - ): Self = StObject.set(x, "onDropRejected", js.Any.fromFunction2(value)) - - inline def setOnDropRejectedUndefined: Self = StObject.set(x, "onDropRejected", js.undefined) - - inline def setOnDropUndefined: Self = StObject.set(x, "onDrop", js.undefined) - - inline def setOnFileDialogCancel(value: () => Unit): Self = StObject.set(x, "onFileDialogCancel", js.Any.fromFunction0(value)) - - inline def setOnFileDialogCancelUndefined: Self = StObject.set(x, "onFileDialogCancel", js.undefined) - - inline def setPreventDropOnDocument(value: Boolean): Self = StObject.set(x, "preventDropOnDocument", value.asInstanceOf[js.Any]) - - inline def setPreventDropOnDocumentUndefined: Self = StObject.set(x, "preventDropOnDocument", js.undefined) - } - } - - trait DropzoneProps - extends StObject - with DropzoneOptions { - - var children: js.UndefOr[js.Function1[/* state */ DropzoneState, Element]] = js.undefined - } - object DropzoneProps { - - inline def apply(): DropzoneProps = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneProps] - } - - extension [Self <: DropzoneProps](x: Self) { - - inline def setChildren(value: /* state */ DropzoneState => Element): Self = StObject.set(x, "children", js.Any.fromFunction1(value)) - - inline def setChildrenUndefined: Self = StObject.set(x, "children", js.undefined) - } - } - - trait DropzoneRef extends StObject { - - def open(): Unit - } - object DropzoneRef { - - inline def apply(open: () => Unit): DropzoneRef = { - val __obj = js.Dynamic.literal(open = js.Any.fromFunction0(open)) - __obj.asInstanceOf[DropzoneRef] - } - - extension [Self <: DropzoneRef](x: Self) { - - inline def setOpen(value: () => Unit): Self = StObject.set(x, "open", js.Any.fromFunction0(value)) - } - } - - trait DropzoneRootProps - extends StObject - with HTMLAttributes[HTMLElement] - with /* key */ StringDictionary[Any] { - - var refKey: js.UndefOr[String] = js.undefined - } - object DropzoneRootProps { - - inline def apply(): DropzoneRootProps = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[DropzoneRootProps] - } - - extension [Self <: DropzoneRootProps](x: Self) { - - inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) - - inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) - } - } - - @js.native - trait DropzoneState - extends StObject - with DropzoneRef { - - var acceptedFiles: js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ] = js.native - - var draggedFiles: js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ] = js.native - - def getInputProps(): DropzoneInputProps = js.native - def getInputProps(props: DropzoneInputProps): DropzoneInputProps = js.native - - def getRootProps(): DropzoneRootProps = js.native - def getRootProps(props: DropzoneRootProps): DropzoneRootProps = js.native - - var inputRef: ReactRef[HTMLInputElement] = js.native - - var isDragAccept: Boolean = js.native - - var isDragActive: Boolean = js.native - - var isDragReject: Boolean = js.native - - var isFileDialogActive: Boolean = js.native - - var isFocused: Boolean = js.native - - var rejectedFiles: js.Array[ - /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any - ] = js.native - - var rootRef: ReactRef[HTMLElement] = js.native - } - - /* Rewritten from type alias, can be one of: - - typingsSlinky.reactDropzone.reactDropzoneStrings.multiple - - typingsSlinky.reactDropzone.reactDropzoneStrings.onDragEnter - - typingsSlinky.reactDropzone.reactDropzoneStrings.onDragOver - - typingsSlinky.reactDropzone.reactDropzoneStrings.onDragLeave - */ - trait PropTypes extends StObject - object PropTypes { - - inline def multiple: typingsSlinky.reactDropzone.reactDropzoneStrings.multiple = "multiple".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.multiple] - - inline def onDragEnter: typingsSlinky.reactDropzone.reactDropzoneStrings.onDragEnter = "onDragEnter".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.onDragEnter] - - inline def onDragLeave: typingsSlinky.reactDropzone.reactDropzoneStrings.onDragLeave = "onDragLeave".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.onDragLeave] - - inline def onDragOver: typingsSlinky.reactDropzone.reactDropzoneStrings.onDragOver = "onDragOver".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.onDragOver] - } } diff --git a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/reactDropzoneStrings.scala b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/reactDropzoneStrings.scala index 4482ff46e0..8cd92a5a36 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/reactDropzoneStrings.scala +++ b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/reactDropzoneStrings.scala @@ -1,6 +1,6 @@ package typingsSlinky.reactDropzone -import typingsSlinky.reactDropzone.mod.PropTypes +import typingsSlinky.reactDropzone.typingsReactDropzoneMod.PropTypes import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} diff --git a/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/typingsReactDropzoneMod.scala b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/typingsReactDropzoneMod.scala new file mode 100644 index 0000000000..394b91d593 --- /dev/null +++ b/tests/react-integration-test/check-slinky-3/r/react-dropzone/src/main/scala/typingsSlinky/reactDropzone/typingsReactDropzoneMod.scala @@ -0,0 +1,340 @@ +package typingsSlinky.reactDropzone + +import org.scalablytyped.runtime.StringDictionary +import org.scalajs.dom.Event +import org.scalajs.dom.HTMLElement +import org.scalajs.dom.HTMLInputElement +import slinky.core.facade.ReactRef +import typingsSlinky.react.mod.ChangeEvent +import typingsSlinky.react.mod.DragEvent +import typingsSlinky.react.mod.DragEventHandler +import typingsSlinky.react.mod.HTMLAttributes +import typingsSlinky.react.mod.InputHTMLAttributes +import typingsSlinky.react.mod.RefAttributes +import typingsSlinky.react.mod.global.JSX.Element +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object typingsReactDropzoneMod { + + @JSImport("react-dropzone/typings/react-dropzone", JSImport.Namespace) + @js.native + val ^ : js.Any = js.native + + inline def default(props: DropzoneProps & RefAttributes[DropzoneRef]): Element = ^.asInstanceOf[js.Dynamic].applyDynamic("default")(props.asInstanceOf[js.Any]).asInstanceOf[Element] + + inline def useDropzone(): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")().asInstanceOf[DropzoneState] + inline def useDropzone(options: DropzoneOptions): DropzoneState = ^.asInstanceOf[js.Dynamic].applyDynamic("useDropzone")(options.asInstanceOf[js.Any]).asInstanceOf[DropzoneState] + + type DropEvent = DragEvent[HTMLElement] | ChangeEvent[HTMLInputElement] | org.scalajs.dom.DragEvent | Event + + trait DropzoneInputProps + extends StObject + with InputHTMLAttributes[HTMLInputElement] { + + var refKey: js.UndefOr[String] = js.undefined + } + object DropzoneInputProps { + + inline def apply(): DropzoneInputProps = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneInputProps] + } + + extension [Self <: DropzoneInputProps](x: Self) { + + inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) + + inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) + } + } + + /* Inlined std.Pick, react-dropzone.react-dropzone/typings/react-dropzone.PropTypes> & { accept :string | std.Array | undefined, minSize :number | undefined, maxSize :number | undefined, preventDropOnDocument :boolean | undefined, noClick :boolean | undefined, noKeyboard :boolean | undefined, noDrag :boolean | undefined, noDragEventsBubbling :boolean | undefined, disabled :boolean | undefined, onDrop :(acceptedFiles : std.Array, rejectedFiles : std.Array, event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): void | undefined, onDropAccepted :(files : std.Array, event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): void | undefined, onDropRejected :(files : std.Array, event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): void | undefined, getFilesFromEvent :(event : react-dropzone.react-dropzone/typings/react-dropzone.DropEvent): / * import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> * / any | undefined, onFileDialogCancel :(): void | undefined} */ + trait DropzoneOptions extends StObject { + + var accept: js.UndefOr[String | js.Array[String]] = js.undefined + + var disabled: js.UndefOr[Boolean] = js.undefined + + var getFilesFromEvent: js.UndefOr[ + js.Function1[ + /* event */ DropEvent, + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any + ] + ] = js.undefined + + var maxSize: js.UndefOr[Double] = js.undefined + + var minSize: js.UndefOr[Double] = js.undefined + + var multiple: js.UndefOr[Boolean] = js.undefined + + var noClick: js.UndefOr[Boolean] = js.undefined + + var noDrag: js.UndefOr[Boolean] = js.undefined + + var noDragEventsBubbling: js.UndefOr[Boolean] = js.undefined + + var noKeyboard: js.UndefOr[Boolean] = js.undefined + + var onDragEnter: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined + + var onDragLeave: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined + + var onDragOver: js.UndefOr[DragEventHandler[HTMLElement]] = js.undefined + + var onDrop: js.UndefOr[ + js.Function3[ + /* acceptedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* rejectedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* event */ DropEvent, + Unit + ] + ] = js.undefined + + var onDropAccepted: js.UndefOr[ + js.Function2[ + /* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* event */ DropEvent, + Unit + ] + ] = js.undefined + + var onDropRejected: js.UndefOr[ + js.Function2[ + /* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], + /* event */ DropEvent, + Unit + ] + ] = js.undefined + + var onFileDialogCancel: js.UndefOr[js.Function0[Unit]] = js.undefined + + var preventDropOnDocument: js.UndefOr[Boolean] = js.undefined + } + object DropzoneOptions { + + inline def apply(): DropzoneOptions = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneOptions] + } + + extension [Self <: DropzoneOptions](x: Self) { + + inline def setAccept(value: String | js.Array[String]): Self = StObject.set(x, "accept", value.asInstanceOf[js.Any]) + + inline def setAcceptUndefined: Self = StObject.set(x, "accept", js.undefined) + + inline def setAcceptVarargs(value: String*): Self = StObject.set(x, "accept", js.Array(value*)) + + inline def setDisabled(value: Boolean): Self = StObject.set(x, "disabled", value.asInstanceOf[js.Any]) + + inline def setDisabledUndefined: Self = StObject.set(x, "disabled", js.undefined) + + inline def setGetFilesFromEvent( + value: /* event */ DropEvent => /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Promise> */ Any + ): Self = StObject.set(x, "getFilesFromEvent", js.Any.fromFunction1(value)) + + inline def setGetFilesFromEventUndefined: Self = StObject.set(x, "getFilesFromEvent", js.undefined) + + inline def setMaxSize(value: Double): Self = StObject.set(x, "maxSize", value.asInstanceOf[js.Any]) + + inline def setMaxSizeUndefined: Self = StObject.set(x, "maxSize", js.undefined) + + inline def setMinSize(value: Double): Self = StObject.set(x, "minSize", value.asInstanceOf[js.Any]) + + inline def setMinSizeUndefined: Self = StObject.set(x, "minSize", js.undefined) + + inline def setMultiple(value: Boolean): Self = StObject.set(x, "multiple", value.asInstanceOf[js.Any]) + + inline def setMultipleUndefined: Self = StObject.set(x, "multiple", js.undefined) + + inline def setNoClick(value: Boolean): Self = StObject.set(x, "noClick", value.asInstanceOf[js.Any]) + + inline def setNoClickUndefined: Self = StObject.set(x, "noClick", js.undefined) + + inline def setNoDrag(value: Boolean): Self = StObject.set(x, "noDrag", value.asInstanceOf[js.Any]) + + inline def setNoDragEventsBubbling(value: Boolean): Self = StObject.set(x, "noDragEventsBubbling", value.asInstanceOf[js.Any]) + + inline def setNoDragEventsBubblingUndefined: Self = StObject.set(x, "noDragEventsBubbling", js.undefined) + + inline def setNoDragUndefined: Self = StObject.set(x, "noDrag", js.undefined) + + inline def setNoKeyboard(value: Boolean): Self = StObject.set(x, "noKeyboard", value.asInstanceOf[js.Any]) + + inline def setNoKeyboardUndefined: Self = StObject.set(x, "noKeyboard", js.undefined) + + inline def setOnDragEnter(value: DragEvent[HTMLElement] => Unit): Self = StObject.set(x, "onDragEnter", js.Any.fromFunction1(value)) + + inline def setOnDragEnterUndefined: Self = StObject.set(x, "onDragEnter", js.undefined) + + inline def setOnDragLeave(value: DragEvent[HTMLElement] => Unit): Self = StObject.set(x, "onDragLeave", js.Any.fromFunction1(value)) + + inline def setOnDragLeaveUndefined: Self = StObject.set(x, "onDragLeave", js.undefined) + + inline def setOnDragOver(value: DragEvent[HTMLElement] => Unit): Self = StObject.set(x, "onDragOver", js.Any.fromFunction1(value)) + + inline def setOnDragOverUndefined: Self = StObject.set(x, "onDragOver", js.undefined) + + inline def setOnDrop( + value: (/* acceptedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* rejectedFiles */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* event */ DropEvent) => Unit + ): Self = StObject.set(x, "onDrop", js.Any.fromFunction3(value)) + + inline def setOnDropAccepted( + value: (/* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* event */ DropEvent) => Unit + ): Self = StObject.set(x, "onDropAccepted", js.Any.fromFunction2(value)) + + inline def setOnDropAcceptedUndefined: Self = StObject.set(x, "onDropAccepted", js.undefined) + + inline def setOnDropRejected( + value: (/* files */ js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ], /* event */ DropEvent) => Unit + ): Self = StObject.set(x, "onDropRejected", js.Any.fromFunction2(value)) + + inline def setOnDropRejectedUndefined: Self = StObject.set(x, "onDropRejected", js.undefined) + + inline def setOnDropUndefined: Self = StObject.set(x, "onDrop", js.undefined) + + inline def setOnFileDialogCancel(value: () => Unit): Self = StObject.set(x, "onFileDialogCancel", js.Any.fromFunction0(value)) + + inline def setOnFileDialogCancelUndefined: Self = StObject.set(x, "onFileDialogCancel", js.undefined) + + inline def setPreventDropOnDocument(value: Boolean): Self = StObject.set(x, "preventDropOnDocument", value.asInstanceOf[js.Any]) + + inline def setPreventDropOnDocumentUndefined: Self = StObject.set(x, "preventDropOnDocument", js.undefined) + } + } + + trait DropzoneProps + extends StObject + with DropzoneOptions { + + var children: js.UndefOr[js.Function1[/* state */ DropzoneState, Element]] = js.undefined + } + object DropzoneProps { + + inline def apply(): DropzoneProps = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneProps] + } + + extension [Self <: DropzoneProps](x: Self) { + + inline def setChildren(value: /* state */ DropzoneState => Element): Self = StObject.set(x, "children", js.Any.fromFunction1(value)) + + inline def setChildrenUndefined: Self = StObject.set(x, "children", js.undefined) + } + } + + trait DropzoneRef extends StObject { + + def open(): Unit + } + object DropzoneRef { + + inline def apply(open: () => Unit): DropzoneRef = { + val __obj = js.Dynamic.literal(open = js.Any.fromFunction0(open)) + __obj.asInstanceOf[DropzoneRef] + } + + extension [Self <: DropzoneRef](x: Self) { + + inline def setOpen(value: () => Unit): Self = StObject.set(x, "open", js.Any.fromFunction0(value)) + } + } + + trait DropzoneRootProps + extends StObject + with HTMLAttributes[HTMLElement] + with /* key */ StringDictionary[Any] { + + var refKey: js.UndefOr[String] = js.undefined + } + object DropzoneRootProps { + + inline def apply(): DropzoneRootProps = { + val __obj = js.Dynamic.literal() + __obj.asInstanceOf[DropzoneRootProps] + } + + extension [Self <: DropzoneRootProps](x: Self) { + + inline def setRefKey(value: String): Self = StObject.set(x, "refKey", value.asInstanceOf[js.Any]) + + inline def setRefKeyUndefined: Self = StObject.set(x, "refKey", js.undefined) + } + } + + @js.native + trait DropzoneState + extends StObject + with DropzoneRef { + + var acceptedFiles: js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ] = js.native + + var draggedFiles: js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ] = js.native + + def getInputProps(): DropzoneInputProps = js.native + def getInputProps(props: DropzoneInputProps): DropzoneInputProps = js.native + + def getRootProps(): DropzoneRootProps = js.native + def getRootProps(props: DropzoneRootProps): DropzoneRootProps = js.native + + var inputRef: ReactRef[HTMLInputElement] = js.native + + var isDragAccept: Boolean = js.native + + var isDragActive: Boolean = js.native + + var isDragReject: Boolean = js.native + + var isFileDialogActive: Boolean = js.native + + var isFocused: Boolean = js.native + + var rejectedFiles: js.Array[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify File */ Any + ] = js.native + + var rootRef: ReactRef[HTMLElement] = js.native + } + + /* Rewritten from type alias, can be one of: + - typingsSlinky.reactDropzone.reactDropzoneStrings.multiple + - typingsSlinky.reactDropzone.reactDropzoneStrings.onDragEnter + - typingsSlinky.reactDropzone.reactDropzoneStrings.onDragOver + - typingsSlinky.reactDropzone.reactDropzoneStrings.onDragLeave + */ + trait PropTypes extends StObject + object PropTypes { + + inline def multiple: typingsSlinky.reactDropzone.reactDropzoneStrings.multiple = "multiple".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.multiple] + + inline def onDragEnter: typingsSlinky.reactDropzone.reactDropzoneStrings.onDragEnter = "onDragEnter".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.onDragEnter] + + inline def onDragLeave: typingsSlinky.reactDropzone.reactDropzoneStrings.onDragLeave = "onDragLeave".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.onDragLeave] + + inline def onDragOver: typingsSlinky.reactDropzone.reactDropzoneStrings.onDragOver = "onDragOver".asInstanceOf[typingsSlinky.reactDropzone.reactDropzoneStrings.onDragOver] + } +} diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt index 798178dde4..f79d8784e3 100644 --- a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-event-listener" -version := "0.38.0-f0cd1b" +version := "0.38.0-1815f0" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/distEsMod.scala b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/distEsMod.scala new file mode 100644 index 0000000000..32d23b6824 --- /dev/null +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/distEsMod.scala @@ -0,0 +1,62 @@ +package typingsSlinky.stardustUiReactComponentEventListener + +import slinky.core.facade.ReactRef +import typingsSlinky.stardustUiReactComponentEventListener.anon.Capture +import typingsSlinky.stardustUiReactComponentEventListener.anon.Listener +import typingsSlinky.stardustUiReactComponentEventListener.distEsTypesMod.EventListenerOptions +import typingsSlinky.stardustUiReactComponentEventListener.distEsTypesMod.EventTypes +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object distEsMod { + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", JSImport.Namespace) + @js.native + val ^ : js.Any = js.native + + object EventListener { + + inline def apply[T /* <: EventTypes */](props: EventListenerOptions[T]): Any = ^.asInstanceOf[js.Dynamic].apply(props.asInstanceOf[js.Any]).asInstanceOf[Any] + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener") + @js.native + val ^ : js.Any = js.native + + object defaultProps { + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.defaultProps") + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.defaultProps.capture") + @js.native + def capture: Boolean = js.native + inline def capture_=(x: Boolean): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("capture")(x.asInstanceOf[js.Any]) + } + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.displayName") + @js.native + def displayName: String = js.native + inline def displayName_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("displayName")(x.asInstanceOf[js.Any]) + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "EventListener.propTypes") + @js.native + def propTypes: Capture | Listener = js.native + inline def propTypes_=(x: Capture | Listener): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("propTypes")(x.asInstanceOf[js.Any]) + } + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "documentRef") + @js.native + val documentRef: ReactRef[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Node */ Any + ] = js.native + + inline def useEventListener[T /* <: /* import warning: LimitUnionLength.leaveTypeRef Was union type with length 91, starting with typingsSlinky.stardustUiReactComponentEventListener.stardustUiReactComponentEventListenerStrings.waiting, typingsSlinky.stardustUiReactComponentEventListener.stardustUiReactComponentEventListenerStrings.error, typingsSlinky.stardustUiReactComponentEventListener.stardustUiReactComponentEventListenerStrings.abort */ Any */](options: EventListenerOptions[T]): Unit = ^.asInstanceOf[js.Dynamic].applyDynamic("useEventListener")(options.asInstanceOf[js.Any]).asInstanceOf[Unit] + + @JSImport("@stardust-ui/react-component-event-listener/dist/es", "windowRef") + @js.native + val windowRef: ReactRef[ + /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Node */ Any + ] = js.native +} diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/mod.scala b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/mod.scala index 713dcb2cc6..ab134efa4c 100644 --- a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/mod.scala +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/src/main/scala/typingsSlinky/stardustUiReactComponentEventListener/mod.scala @@ -9,6 +9,7 @@ import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { @JSImport("@stardust-ui/react-component-event-listener", JSImport.Namespace) diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt index 6858854906..628c1bda92 100644 --- a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-ref" -version := "0.38.0-615fad" +version := "0.38.0-927790" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/distEsMod.scala b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/distEsMod.scala new file mode 100644 index 0000000000..c1c5d5d8ad --- /dev/null +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/distEsMod.scala @@ -0,0 +1,83 @@ +package typingsSlinky.stardustUiReactComponentRef + +import slinky.core.ReactComponentClass +import slinky.core.facade.ReactRef +import typingsSlinky.stardustUiReactComponentRef.anon.Children +import typingsSlinky.stardustUiReactComponentRef.anon.InnerRef +import typingsSlinky.stardustUiReactComponentRef.distEsRefFindNodeMod.default +import typingsSlinky.stardustUiReactComponentRef.distEsTypesMod.RefProps +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object distEsMod { + + @JSImport("@stardust-ui/react-component-ref/dist/es", JSImport.Namespace) + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "Ref") + @js.native + val Ref: ReactComponentClass[RefProps] = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode") + @js.native + open class RefFindNode () extends default + /* static members */ + object RefFindNode { + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode") + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode.displayName") + @js.native + def displayName: String = js.native + inline def displayName_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("displayName")(x.asInstanceOf[js.Any]) + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefFindNode.propTypes") + @js.native + def propTypes: Children | InnerRef = js.native + inline def propTypes_=(x: Children | InnerRef): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("propTypes")(x.asInstanceOf[js.Any]) + } + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward") + @js.native + open class RefForward () + extends typingsSlinky.stardustUiReactComponentRef.distEsRefForwardMod.default + /* static members */ + object RefForward { + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward") + @js.native + val ^ : js.Any = js.native + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward.displayName") + @js.native + def displayName: String = js.native + inline def displayName_=(x: String): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("displayName")(x.asInstanceOf[js.Any]) + + @JSImport("@stardust-ui/react-component-ref/dist/es", "RefForward.propTypes") + @js.native + def propTypes: Children | InnerRef = js.native + inline def propTypes_=(x: Children | InnerRef): Unit = ^.asInstanceOf[js.Dynamic].updateDynamic("propTypes")(x.asInstanceOf[js.Any]) + } + + /** + * The function that correctly handles passing refs. + * + * @param ref An ref object or function + * @param node A node that should be passed by ref + */ + inline def handleRef[N](ref: typingsSlinky.react.mod.Ref[N], node: N): Unit = (^.asInstanceOf[js.Dynamic].applyDynamic("handleRef")(ref.asInstanceOf[js.Any], node.asInstanceOf[js.Any])).asInstanceOf[Unit] + + /** Checks that the passed object is a valid React ref object. */ + inline def isRefObject(ref: Any): /* is react.react.RefObject */ Boolean = ^.asInstanceOf[js.Dynamic].applyDynamic("isRefObject")(ref.asInstanceOf[js.Any]).asInstanceOf[/* is react.react.RefObject */ Boolean] + + @JSImport("@stardust-ui/react-component-ref/dist/es", "refPropType") + @js.native + val refPropType: /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify PropTypes.Requireable> */ Any = js.native + + /** Creates a React ref object from existing DOM node. */ + inline def toRefObject[T /* <: /* import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify Node */ Any */](node: T): ReactRef[T] = ^.asInstanceOf[js.Dynamic].applyDynamic("toRefObject")(node.asInstanceOf[js.Any]).asInstanceOf[ReactRef[T]] +} diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/mod.scala b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/mod.scala index 44283cb630..1ac839ba1d 100644 --- a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/mod.scala +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/src/main/scala/typingsSlinky/stardustUiReactComponentRef/mod.scala @@ -4,12 +4,12 @@ import slinky.core.ReactComponentClass import slinky.core.facade.ReactRef import typingsSlinky.stardustUiReactComponentRef.anon.Children import typingsSlinky.stardustUiReactComponentRef.anon.InnerRef -import typingsSlinky.stardustUiReactComponentRef.distEsRefFindNodeMod.default import typingsSlinky.stardustUiReactComponentRef.distEsTypesMod.RefProps import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod { @JSImport("@stardust-ui/react-component-ref", JSImport.Namespace) @@ -22,7 +22,8 @@ object mod { @JSImport("@stardust-ui/react-component-ref", "RefFindNode") @js.native - open class RefFindNode () extends default + open class RefFindNode () + extends typingsSlinky.stardustUiReactComponentRef.distEsMod.RefFindNode /* static members */ object RefFindNode { @@ -44,7 +45,7 @@ object mod { @JSImport("@stardust-ui/react-component-ref", "RefForward") @js.native open class RefForward () - extends typingsSlinky.stardustUiReactComponentRef.distEsRefForwardMod.default + extends typingsSlinky.stardustUiReactComponentRef.distEsMod.RefForward /* static members */ object RefForward { diff --git a/tests/vue/check-3/s/storybook__vue/build.sbt b/tests/vue/check-3/s/storybook__vue/build.sbt index db5765492e..cb668dbe1e 100644 --- a/tests/vue/check-3/s/storybook__vue/build.sbt +++ b/tests/vue/check-3/s/storybook__vue/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "storybook__vue" -version := "3.3-8970b4" +version := "3.3-6fc4a2" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "org.scalablytyped" %%% "std" % "0.0-unknown-ddd099", - "org.scalablytyped" %%% "vue" % "2.5.13-597b3c", + "org.scalablytyped" %%% "vue" % "2.5.13-29e5d0", "org.scalablytyped" %%% "webpack-env" % "1.13-08f28b") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/vue/check-3/v/vue-scrollto/build.sbt b/tests/vue/check-3/v/vue-scrollto/build.sbt index de87a356f1..77b19ed619 100644 --- a/tests/vue/check-3/v/vue-scrollto/build.sbt +++ b/tests/vue/check-3/v/vue-scrollto/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "vue-scrollto" -version := "2.7-d31dd1" +version := "2.7-e1d6db" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "org.scalablytyped" %%% "std" % "0.0-unknown-ddd099", - "org.scalablytyped" %%% "vue" % "2.5.13-597b3c") + "org.scalablytyped" %%% "vue" % "2.5.13-29e5d0") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") licenses += ("MIT", url("http://opensource.org/licenses/MIT")) diff --git a/tests/vue/check-3/v/vue/build.sbt b/tests/vue/check-3/v/vue/build.sbt index 2388383ab9..9d4924667c 100644 --- a/tests/vue/check-3/v/vue/build.sbt +++ b/tests/vue/check-3/v/vue/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "vue" -version := "2.5.13-597b3c" +version := "2.5.13-29e5d0" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/vue/check-3/v/vue/src/main/scala/typings/vue/mod.scala b/tests/vue/check-3/v/vue/src/main/scala/typings/vue/mod.scala index 1aec8da907..01f8f866c6 100644 --- a/tests/vue/check-3/v/vue/src/main/scala/typings/vue/mod.scala +++ b/tests/vue/check-3/v/vue/src/main/scala/typings/vue/mod.scala @@ -7,6 +7,7 @@ import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} +/* Inferred short module name */ object mod extends Shortcut { @JSImport("vue", JSImport.Default) diff --git a/tests/vue/check-3/v/vue/src/main/scala/typings/vue/typesMod.scala b/tests/vue/check-3/v/vue/src/main/scala/typings/vue/typesMod.scala new file mode 100644 index 0000000000..ef703010f9 --- /dev/null +++ b/tests/vue/check-3/v/vue/src/main/scala/typings/vue/typesMod.scala @@ -0,0 +1,20 @@ +package typings.vue + +import org.scalablytyped.runtime.Shortcut +import typings.vue.typesVueMod.Vue +import typings.vue.typesVueMod.VueConstructor +import org.scalablytyped.runtime.StObject +import scala.scalajs.js +import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} + +object typesMod extends Shortcut { + + @JSImport("vue/types", JSImport.Default) + @js.native + val default: VueConstructor[Vue] = js.native + + type _To = VueConstructor[Vue] + + /* This means you don't have to write `default`, but can instead just say `typesMod.foo` */ + override def _to: VueConstructor[Vue] = default +} diff --git a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/TsTreeScope.scala b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/TsTreeScope.scala index 92cd310134..1d3c2d048c 100644 --- a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/TsTreeScope.scala +++ b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/TsTreeScope.scala @@ -539,16 +539,7 @@ object TsTreeScope { val modScope = outsideModule / mod addAlternative(mod.name, modScope) ret += (mod.name -> modScope) - mod.comments.cs.foreach { - case Marker.ModuleAliases(aliases) => - aliases.foreach { alias => - ret += ((alias, modScope)) - addAlternative(alias, modScope) - } - case _ => () - } } - } /**