Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 08 17:32
    scala-steward closed #322
  • Jun 08 17:32
    scala-steward commented #322
  • Jun 08 17:32
    scala-steward opened #326
  • May 14 18:48
    scala-steward closed #324
  • May 14 18:48
    scala-steward commented #324
  • May 14 18:48
    scala-steward opened #325
  • Apr 20 21:39
    scala-steward closed #323
  • Apr 20 21:39
    scala-steward commented #323
  • Apr 20 21:39
    scala-steward opened #324
  • Apr 01 07:36
    scala-steward closed #318
  • Apr 01 07:36
    scala-steward commented #318
  • Apr 01 07:36
    scala-steward opened #323
  • Mar 31 17:33
    scala-steward closed #313
  • Mar 31 17:33
    scala-steward commented #313
  • Mar 31 17:33
    scala-steward opened #322
  • Mar 29 00:41
    vmchura commented #4
  • Mar 12 20:36
    scala-steward closed #320
  • Mar 12 20:36
    scala-steward commented #320
  • Mar 12 20:36
    scala-steward opened #321
  • Mar 11 06:16
    scala-steward opened #320
Nabodit Paudyal
@NaBandit

it it still possible however, to do something like this, to get a working applyBegin method:

object SVGSVGFactory extends ElementFactory[SVGSVGElement] {
    override protected def tagName: String = "svg"
  }

Whose applyBegin method is

@inline def applyBegin = new NodeBinding.Constant.ElementBuilder(document.createElement(tagName).asInstanceOf[E])

And the applybegin in the svg becomes

object svg extends Curried {
        @inline def applyBegin = SVGSVGFactory.applyBegin
      }

But this is not good enough for my purposes as createElementNS is the desired method instead of createElement
@Atry any thoughts? Or am I missing the mark completely here

Philipp Dörfler
@phdoerfler
@NaBandit How about instead modifying the build of html.scala, adding the missing generators?
https://github.com/element-io/svg-tags/blob/master/lib/svg-tags.json has a list of the SVG tags of SVG 1.1, similar to https://whatwg.org which has a list of HTML entities etc. in json. The latter is used by the build to generate the code (ElementFactories, AttributeFactories, …) with scalameta, already
https://github.com/GlasslabGames/html.scala/blob/master/project/Generators.scala#L143 this is one example where the build fetches such a list and generates code
imho, all it's missing is the equivalent for svg, is that right @Atry?
Would you accept a PR filling that niche?
Nabodit Paudyal
@NaBandit
I need to experiment with it a little, see if I can get it to work. But yeah, I think svgs are important(common?) enough to merit their implementations
Philipp Dörfler
@phdoerfler
imho adding generators is the only way to do this
I don't care if they go into the html.scala library or a different library just for svg, but really, svg is so closely tied to html already, it makes sense
besides, it's not a lot of tags
I don't understand why it's necessary to generate code for every different tag you wanna use. I guess this makes it more typesafe? But it makes it near impossible to use custom xml tags.
Philipp Dörfler
@phdoerfler
@Atry Trying to compile html.scala, I get
[error] (html / update) sbt.librarymanagement.ResolveException: Error downloading com.thoughtworks.binding:binding_sjs1_2.11:11.9.0
[error]   Not found
[error]   Not found
[error]   not found: /Users/phi/.ivy2/local/com.thoughtworks.binding/binding_sjs1_2.11/11.9.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/thoughtworks/binding/binding_sjs1_2.11/11.9.0/binding_sjs1_2.11-11.9.0.pom
[error] Error downloading com.thoughtworks.binding:bindable_sjs1_2.11:1.1.0
[error]   Not found
[error]   Not found
[error]   not found: /Users/phi/.ivy2/local/com.thoughtworks.binding/bindable_sjs1_2.11/1.1.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/thoughtworks/binding/bindable_sjs1_2.11/1.1.0/bindable_sjs1_2.11-1.1.0.pom
[error] Total time: 1 s, completed 2 Aug 2020, 11:44:28
Yang, Bo
@Atry

Would you accept a PR filling that niche?

SVG support probably should belong to a separate library. However, the SVG library might use some shared code with html.scala. Let me know if there is any blocker prevent you calling those shared code. I am happy to merge PRs for extracting shared code from html.scala.

@Atry Trying to compile html.scala, I get

[error] (html / update) sbt.librarymanagement.ResolveException: Error downloading com.thoughtworks.binding:binding_sjs1_2.11:11.9.0
[error]   Not found
[error]   Not found
[error]   not found: /Users/phi/.ivy2/local/com.thoughtworks.binding/binding_sjs1_2.11/11.9.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/thoughtworks/binding/binding_sjs1_2.11/11.9.0/binding_sjs1_2.11-11.9.0.pom
[error] Error downloading com.thoughtworks.binding:bindable_sjs1_2.11:1.1.0
[error]   Not found
[error]   Not found
[error]   not found: /Users/phi/.ivy2/local/com.thoughtworks.binding/bindable_sjs1_2.11/1.1.0/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/thoughtworks/binding/bindable_sjs1_2.11/1.1.0/bindable_sjs1_2.11-1.1.0.pom
[error] Total time: 1 s, completed 2 Aug 2020, 11:44:28

Could you ask these general questions on StackOverflow, please?

2 replies

should I file a bug report?

Yes, please

Iain Cardnell
@idc101
Hi, I pasted quite a lot of HTML (125 lines) into a function and after that sbt fails with OutOfMemory. I increased sbt's memory to 8g and same thing so it's not just it needed a little more memory.
Is this a known issue with Binding.scala?
Yang, Bo
@Atry
Would you mind posting the question on stackoverflow?
Iain Cardnell
@idc101
sure
Roman Babenko
@sparlampe
Hi all, I am trying to figure out how to work with source maps in scalajs apps. I found https://github.com/ThoughtWorksInc/sbt-scala-js-map that seems to showcase correctly functioning source maps in a scalajs app, which is at http://todomvc.com/examples/binding-scala/#/.
However, when I load the application I get the following warning in the console DevTools failed to load SourceMap: Could not load content for http://todomvc.com/examples/binding-scala/js/js-fastopt.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE. Is there a way to fix this?
Yang, Bo
@Atry
@sparlampe Thank you for pointing it out. It seems it is not configured correctly.
Joseph Hajduk
@josephhajduk
Is there a scala 3 roadmap or plan somewhere?
Roman Landenband
@romansky
@Atry any chance for help with ThoughtWorksInc/Binding.scala#294 ?
Roman Landenband
@romansky
@Atry can't find a way around https://stackoverflow.com/questions/64103296/binding-scala-how-to-get-updating-count-from-vars it looks like a type variance issue I am not able to get around, the basic all.bind will just not compile, this is a public method but I can't see anyone is using it..
Jeaye Wilkerson
@jeaye
Is https://github.com/ThoughtWorksInc/Binding.scala#step-1-add-htmlscala-dependencies-into-your-buildsbt correct? For me, it causes sbt.librarymanagement.ResolveException: Error downloading org.scalamacros:paradise_2.13.4:2.1.1.
Jeaye Wilkerson
@jeaye
Hm, had to switch to to 2.13.1 to get it working, but now I can switch back to 2.13.4 and it still works.
Jeaye Wilkerson
@jeaye

Is it against Binding.scala's design to reuse and configure components with custom attributes? I've looked at half a dozen different projects using html.scala and not a single one of them has a reusable component which can be configured differently, outside of just passing in different class names.

For example, using Laminar, I can have a vBox which is also arbitrarily customizable:

def vBox(mods: Modifier[HtmlElement]*): HtmlElement = {
  div(
    display("flex"),
    flexDirection("column"),
    flexWrap("wrap"),
    mods
  )
}

def root(): HtmlElement = {
  div(
    width("100%"),
    height("100%"),

    vBox(
      flex("1"),
      height("100%"),

      div(flex("1"), "top"),
      div(flex("1"), "bottom")
    )
  )
}
The XML literals don't seem amenable to this sort of thing, but I'm really hoping I'm wrong.
Yang, Bo
@Atry
Why not simply vBox(flex=1, height="100%")...?