oyvindberg on gh-pages
Deploy website Deploy website … (compare)
oyvindberg on v1.0.0-beta29.2
oyvindberg on v1.0.0-beta29-patch
Update ammonite-ops to 2.3.8 Update sbt-mdoc to 2.2.13 Better error logging in CI and 12 more (compare)
oyvindberg on gh-pages
Deploy website Deploy website … (compare)
oyvindberg on master
Update sbt-mdoc to 2.2.15 (compare)
oyvindberg on master
Update library-developer.md Ad… (compare)
oyvindberg on scala-companion-objects
oyvindberg on scala-companion-objects
Generate more specific types fo… (compare)
oyvindberg on v1.0.0-beta29.1
oyvindberg on v1.0.0-beta29-patch
Another bugfix for remote cache (compare)
oyvindberg on gh-pages
Deploy website Deploy website … (compare)
oyvindberg on master
Restore compatibility with old … (compare)
oyvindberg on master
Restore compatibility with old … (compare)
oyvindberg on master
Another bugfix for remote cache (compare)
oyvindberg on master
Reintroduce `^` classes (compare)
oyvindberg on gh-pages
Deploy website Deploy website … (compare)
oyvindberg on master
add scalablytyped icon (#235) … (compare)
oyvindberg on master
try to speed up CI (compare)
oyvindberg on improve-class-extraction
oyvindberg on master
Improve ExtractClasses and Reso… (compare)
dist
now and pushed it by the way
[warn ] 2020-11-16T00:52:31.544315Z Phase3Compile.scala:144 Built /home/olvind/.ivy2/local/org.scalablytyped.slinky/react_sjs1_3.0.0-M1/16.9-dt-20200711Z-805e37/jars/react_sjs1_3.0.0-M1.jar in 48664 ms [id => react, thread => 1, phase => build, flavour => SlinkyFlavour]
hello, i want to display the demo of circular progress integration with using styleBuilder given in material ui demos, when i add val classes = styles1(js.undefined), it gives me blank pagen any suggestions`object DemoCircularIntegration {
case class Props()
//val classes = styles(js.undefined)
case class State(loading: Boolean = false, success: Boolean = false) {
def setLoading = copy(success = false, loading = true)
def setSuccess = copy(success = true, loading = false)
}
class Backend(t: BackendScope[Props, State]) {
var timer: js.UndefOr[js.timers.SetTimeoutHandle] = js.undefined
def unmount = Callback {
timer.foreach(js.timers.clearTimeout)
timer = js.undefined
}
def setSuccess = Callback {
timer = js.timers.setTimeout(2000)(t.modState(_.setSuccess).runNow())
}
def handleButtonClick(loading: Boolean) = {
(t.modState(_.setLoading) >> setSuccess).when(!loading) >> Callback.empty
}
val classes = styles1(js.undefined)
def render(props: Props, state: State): VdomElement = {
// val css = props.style
// val classes = css.styles
//val buttonCss = if (state.success) css.buttonSuccess else css.common.emptyStyle
<. div(
<. div(
Mui.Fab.color(typings.materialUiCore.mod.PropTypes.Color.primary).onClick(_ => handleButtonClick(state.loading))(
if (state.success) Muii.Check() else Muii.Save()
),
HicpCircularProgress(size=68,className="fabProgress")().when(state.loading)
),
div(
HicpRaisedButton(touchTapCallback=_ =>handleButtonClick(state.loading), disabled=state.loading)
("Accept terms")
),
HicpCircularProgress(size=24,className="buttonProgress")().when(state.loading)
)
}
}`
"foo" | "bar"
will be interesting, and also T | Null
, and just general type inference and compile times. I hope it will be a big improvement :)
diff --git a/material-ui/src/main/scala/demo/button/Button.scala b/material-ui/src/main/scala/demo/button/Button.scala
index 56de112..f01beaf 100644
--- a/material-ui/src/main/scala/demo/button/Button.scala
+++ b/material-ui/src/main/scala/demo/button/Button.scala
@@ -12,7 +12,7 @@ import typings.materialUiCore.createMuiThemeMod.{Theme, ThemeOptions}
import typings.materialUiCore.spacingMod.SpacingOptions
import typings.materialUiCore.{stylesMod, components => Mui}
import typings.materialUiStyles.components.ThemeProvider
-import typings.std.global.window
+import typings.std.global.{console, window}
import scala.scalajs.js
@@ -47,10 +47,17 @@ object ButtonTest {
s"Increment it, ${props.name}"
)
+ val ref = Hooks.useRef[Any](null)
+
div(
/* text field controlled by the value of the state hook above*/
- Mui.TextField.StandardTextFieldProps().value(state).disabled(true),
- incrementButton
+ Mui.TextField.StandardTextFieldProps().value(state).disabled(true).innerRef(ref),
+ incrementButton,
+ Option(ref.current).map(x => {
+ val dynamic = x.asInstanceOf[js.Dynamic]
+ console.warn(dynamic)
+ "has reference"
+ })
)
}
}
What should I do in the situation where the generated class extends a base class and I need to call the constructor defined on the base class?
export as namespace ProgressBar;
declare const main: {
Circle: typeof Circle;
};
export = main;
declare class Circle extends Shape {
readonly containerAspectRatio: 1;
}
declare class Shape {
constructor(container: SVGPathElement | string | null, opts?: PathDrawingOptions);
}
Which TypeScript seems to allow:
const circle = new ProgressBar.Circle('#example-percent-container', {
color: '#FCB03C',
strokeWidth: 3,
trailWidth: 1,
text: {
value: '0',
},
});
object ^ {
var Circle: Instantiable0[typings.progressbarJs.circleMod.^] = js.native
}
class ^ () extends Circle
trait Circle
extends typings.progressbarJs.shapeMod.^ {
val containerAspectRatio: `1` = js.native
}
class ^ () extends Shape {
def this(container: String) = this()
def this(container: SVGPathElement) = this()
def this(container: String, opts: PathDrawingOptions) = this()
def this(container: Null, opts: PathDrawingOptions) = this()
def this(container: SVGPathElement, opts: PathDrawingOptions) = this()
}
class ^ () extends Circle
and add the wanted constructor by hand, should be easy enough
Instantiable0
is actually the class as a function, it has a newInstance0
method on it
Is this conversion correct?
export = Sortable;
declare class Sortable {
…
}
declare namespace Sortable {
…
}
to:
@JSImport("sortablejs", JSImport.Namespace)
@js.native
class ^ protected () extends Sortable {
def this(element: HTMLElement, options: Options) = this()
}
@JSImport("sortablejs", JSImport.Namespace)
@js.native
object ^ extends js.Object {
…
}
I’m getting a TypeError when trying to instantiate the class saying that it is not a constructor. It looks like its ending up as the module.
The library docs say:
import Sortable from "sortablejs”;
var sortable = new Sortable(…)
So shouldn’t it be:
@JSImport("sortablejs", JSImport.Default)
?
import ^, * as ^ from "sortablejs”;
?
Actually I think that is what it should be but in Scala.js that would be:
@JSImport("sortablejs", JSImport.Default)
@js.native
class ^ protected () extends Sortable {
def this(element: HTMLElement, options: Options) = this()
}
@JSImport("sortablejs", JSImport.Namespace)
@js.native
object ^ extends js.Object {
…
}
wouldn’t it?