Hacker Newsnew | past | comments | ask | show | jobs | submit | trafnar's commentslogin

I wanted to suggest a tweak to this cool project: The panning and zooming feel very sluggish. I'm not sure if there's a technical reason it needs to be that way, but if the animation duration or spring used to control that can be made faster, it will feel much nicer to navigate around.


On fastish home network (~300 Mbps) with middle-age MacBook Pro (2020), it's wonderfully snappy, not sluggish at all.


I was using this recently and found some situations where I didn't like the way the lines looked. Reading through the github comments from the author, it sounds like an improved version of this library is maintained within the tldraw codebase.


Their app listens to your calls and transcribes things. I think this visualizer helps indicate when it is actively listening.


So why does it need to be animated, a color indication could've worked just as well. Or the stop button right next to it...


It's still relevant, the language hasn't changed much since I made this course.


Panda seems really nice. As someone who does a lot of "creative" CSS work, writing styles quickly is important to me. I find writing styles as Javascript objects kinda cumbersome. I wish there was a way to use Imba's CSS system within a React or other Javascript app. https://imba.io/docs/css/syntax

Imba allows you to write CSS anywhere in a component definition using CSS-like syntax (rather than Javascript object syntax).

The syntax for adding a quick inline style is so simple:

  <div [width:20px]>
You can even do hover states in an inline style:

  <div [color:red @hover:blue]>
And interpolation is easy too:

  <div [width:{someValue}px]>
Putting a CSS block at any level of your tag hierarchy scopes it to that tag.

  <div.foo>
    <div.bar>
      css color:red # this applies to div.bar
        em color:blue # this applies to div.bar em
      
      "hello"
      <em> "world"
CSS blocks declared in a component definition but outside of the markup, apply to the whole tag. CSS declared in a file, outside of a component definition, apply to all components defined in that file. There is also a global keyword to apply styles globally.

and there's a whole range of other useful features, a favorite of mind is the shorthand syntax for things like this:

  c:red # same as color:red
  d:vtc # same as display:flex flex-direction:column justify-content:center
  x:10px rotate:30deg # same as transform:translateX(10px), rotate(30deg)


Imba CSS is just brilliant.

I've considered porting it to JS into a Vite plugin so the same syntax can be used anywhere else. I would have done it already if I had the time.


I’ve been building all my projects with Imba for the past few years, I love it.

- TaskTXT - Plain text todos and tasks with timers https://www.tasktxt.com

- ReadyRunner - GPT chat for desktop https://www.readyrunner.ai

- Chonky Menu Re-Creation - Breakdown of a fancy menu UI https://www.nathanmanousos.com/posts/chonky-menu

I’ve made several videos about Imba too:

- Building a counter in 49 seconds: https://www.youtube.com/watch?v=8XS5q9xhaMc

- Video timeline UI: https://www.youtube.com/watch?v=GbKTEqmCAJM

- All of my Imba videos here: https://www.youtube.com/playlist?list=PLYxkh3w952l5cwxYLcCsd...

I made the (free) official course on Scrimba: https://www.imba.io/learn/imba

Which is also on YouTube: https://www.youtube.com/watch?v=8DcOgcCy7zs

I understand that Imba is not appropriate for everyone and every project but I encourage you not to dismiss it. One are where it is clearly valuable is in building prototypes and side projects.


Thanks for sharing, this is cool to see. Do you use electron to wrap an Imba app for desktop?


Yes, via https://www.todesktop.com/ which makes it very easy.


I assume you are referring to the CSS shorthands Imba provides. Yes, they are controversial... and optional. These all work the same in imba:

  css div { background-color: red; display: flex; flex-direction: column; }
    div@hover {background-color:blue;}

  css div background-color: red display: flex flex-direction: column
    div@hover background-color: blue

  css div bgc:red @hover:blue d:vflex


The problem is, once you offer the option, people gonna use it....


You don't need any special state management tools like "stores" or "setState" you can just use regular variables.

  let count = 0
  tag Counter
    <self @click=(count++)> "Count is: {count}"
  imba.mount <Counter>, document.body


How will it work if I put 2 counter components on one page?

If it’s just using global variable for state then it will be shared between component. You can do the same thing in React, it’s just a bad idea.

If it does some magic under the hood to convert regular variables into something different like Svelte pre-5.0 (which Svelte decided to make more explicit in 5.0), then could you point me to docs describing it, I’m curious which approach they took with this.


If you look on the linked page under the "Styling Evolved" section. It appears variables are scoped to the component instance. In the example given each clock has its own variables, even though it is individually set to a different UTC.


In that case the count variable should be moved into a property of the tag. I just like putting it outside the tag because it really drives home "its just a variable".

   tag Counter
      count = 0
      <self @click=(count++)> "count: {count}"


the point is there is no need for "reactivity" constructs. Organize your "state" the way you want.

tag App

  counter = 0

  <self>
    <button @click=counter++> "{counter}"
imba.mount <App>

it doesn't have to be anything. You're free to organize your code as you wish: colocate, in a different file ... the compiler doesn't transform the variable in any way, nor does it track its "mutation", it "just" "rerenders" on every change. And it's super fast too!


The tricky part here is to determine what should trigger the rerender.


all events trigger it, also imba.commit! which you can use however you like


I'm not aware of any easier way to build something like this than what I presented in the article, but I'd be interested to learn if there was. I did create a full-fledged prototyping/animation tool called Flinto.com, but it can't quite do this interaction with all of its details


Thanks for the motivating comment :)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: