zlacker

[parent] [thread] 14 comments
1. franci+(OP)[view] [source] 2023-11-20 20:07:11
I made https://vector-graph.com/ a while back and documented it pretty thoroughly. While I never "finished" it, it's working pretty fine and as long as you fix it to a specific version, you won't have to worry about changes if/when I continue working on it.

Feedback would be greatly welcome! It's made specifically for the usecase you mention, blog-like website with Katex to add pretty graphics. Example usage:

    <!-- Draw a triangle with labels on the sides and angles -->
    <vector-graph x="3" y="3" axis="false">
      <polygon points="0,0;1,3;3,1" sides="a,b,c" angles="α,β,γ"></polygon>
    </vector-graph>

    <!-- a + b = c, but in vector form (with lots of labels) -->
    <vector-graph x="4.9" y="4.9">
      <vector label="b" color="blue" from="3,4" to="4,2" axis></vector>
      <vector label="a" color="red" from="0,0" to="3,4" axis></vector>
      <vector label="c" from="0,0" to="4,2"></vector>
    </vector-graph>

PS, I give you permission to use it in your personal website for free, alexkritchevsky.com
replies(4): >>culi+d2 >>ajkjk+t6 >>corn-d+DQ1 >>billfr+2V2
2. culi+d2[view] [source] 2023-11-20 20:13:56
>>franci+(OP)
is it based on web components?
replies(1): >>franci+E4
◧◩
3. franci+E4[view] [source] [discussion] 2023-11-20 20:23:47
>>culi+d2
`<vector-graph>` itself is a properly defined WebComponent, everything else inside is just parsed as a string of pseudo-html and rendered within the parent web component (as an SVG).

Edit: note that the examples in the website, since they are part of the README in Github, are plain SVG images that have been rendered on the backend statically also by VectorGraph, see the Node.js environment if interested:

https://vector-graph.com/#nodejs

replies(1): >>ble+ax
4. ajkjk+t6[view] [source] 2023-11-20 20:30:35
>>franci+(OP)
Lol, thanks. I'll check it out. But, is the license such that you need to give permission? I see that you have a "commercial license" but it seems like that wouldn't apply to me anyway. I don't know much about software licenses tbh so some clarification would be nice.
replies(1): >>franci+td
◧◩
5. franci+td[view] [source] [discussion] 2023-11-20 20:59:50
>>ajkjk+t6
It's dual-licensed as AGPL (free software) and commercial (with a one-time $19 fee), the AGPL is pretty restrictive so if you want a more liberal one you could buy it. But, as a 3rd option exclusive for you in here, you can use it for free in your own website without having to comply with the AGPL. See a longer-form explanation:

https://opensource.stackexchange.com/a/4877

What the AGPL does differently compared to e.g. GPL is basically say that you cannot build a proprietary service around my library without making that service open source as well. So theoretically, it could be argued that depending on how you use it in your website, you would need to make your website free software as well. Or, buy a license. (Or in this case, get an exception from me). This is just a friendly explanation, the full legal terms are here:

https://github.com/franciscop/vector-graph/blob/master/LICEN...

replies(1): >>ajkjk+4L
◧◩◪
6. ble+ax[view] [source] [discussion] 2023-11-20 22:33:32
>>franci+E4
Very nice looking diagrams for the amount of effort required to make them as a client of the library.

I love that it uses exactly 1 WebComponent. I love / am vaguely confused that it doesn't read the component's own DOM but instead gets the `.outerHTML`: https://github.com/franciscop/vector-graph/blob/master/index...

I guess that it means that the actual rendering gets fully decoupled from the live, but hidden DOM tree within the WebComponent and that live DOM tree doesn't really matter aside from first render.

replies(1): >>franci+y41
◧◩◪
7. ajkjk+4L[view] [source] [discussion] 2023-11-20 23:51:24
>>franci+td
Hmm. That makes me less interested, really. The restrictive license doesn't affect my project but I don't want to use something I can't recommend to someone else, and I would never want to build something on that because I don't want to think about licenses at all in my life, much less deal with one that encodes someone else's ideology that I don't share. Any reason not to just make it MIT? Which is apparently what e.g. KaTeX uses.
replies(2): >>franci+q31 >>buzzy_+Vm1
◧◩◪◨
8. franci+q31[view] [source] [discussion] 2023-11-21 01:56:47
>>ajkjk+4L
> Any reason not to just make it MIT?

Yes, I'm not funded by the millions (like Khan Academy, the org that created/sponsored Katex) so I would hate to see all my hard work get copy/pasted by a company, rebranded as their own and sold to the public in a private manner.

> I don't want to think about licenses at all in my life

If you don't want to think about licenses ever it's just a one-time payment of $19, that's exactly why I dual-licensed it; follow the license, or pay $19 to not deal with the license.

> That makes me less interested, really

That's okay, if you don't think it's a library worth $19 (or following the license), it means it doesn't provide enough value for you to be worth of your money. For the average developer in the world that's less than 1h of their time though, so if you think that my library will save you 1h vs others, or vs doing it by hand, then it's "worth it". Many developers think all the tools should be MIT, and that is okay, but I don't share that ideology.

◧◩◪◨
9. franci+y41[view] [source] [discussion] 2023-11-21 02:03:15
>>ble+ax
Thanks! That was my goal! I didn't release it officially because I also wanted to add hooks/extensibility, and that was a lot trickier than I expected. I cannot expect everyone to only use the provided tools, and extensibility was a bit tricky (there's a lot of low-level math operations going on).

I'm not totally sure what you mean by "it doesn't read the component's own DOM but instead gets the `.outerHTML`". Note that I am not a Shadow DOM expert and I made this a couple of years ago, but IIRC the reason I made it this way is that I wanted a lot of flexibility on the transformation.

It's not 1-component-to-1-svg-element, it's more like I might have an arbitrary N number of "HTML elements", which might render into an arbitrary M number of "SVG elements", some of which might even be global (<defs>) so not even in the same order as the HTML elements order.

◧◩◪◨
10. buzzy_+Vm1[view] [source] [discussion] 2023-11-21 04:10:17
>>ajkjk+4L
Since you said you don’t know much about licenses, I suggest you check out https://writefreesoftware.org/learn/copyleft

AGPL is a copyleft license, MIT is not. There’s good reasons for a developer to prefer copyleft.

replies(1): >>ajkjk+7z5
11. corn-d+DQ1[view] [source] 2023-11-21 08:25:08
>>franci+(OP)
This is freaking awesome! I imagine this would’ve been a fun project to work on. Do you have a blog or a write up on how you did this?

I’m also an enjoyer of web-components, I use them in my chrome extension Mobile View. I want to try this out tomorrow at work

replies(1): >>franci+jj2
◧◩
12. franci+jj2[view] [source] [discussion] 2023-11-21 12:25:48
>>corn-d+DQ1
Thanks! Like some of my other "big" projects, it's really modular, in the way it started very simple "let's see if I can draw lines", and then each extra "type" was just a bit extra over the existing core, and so now it has a lot of features! If I knew it'd grow to the current scope I might have been afraid and not even started TBH.

I actually have a Twitter thread on it!

https://twitter.com/FPresencia/status/1411196648177405953

13. billfr+2V2[view] [source] 2023-11-21 15:36:04
>>franci+(OP)
Does it work for 3D? If you want vectors in 3D space for example?
replies(1): >>franci+TC3
◧◩
14. franci+TC3[view] [source] [discussion] 2023-11-21 18:23:20
>>billfr+2V2
Unfortunately not, this is only for 2D
◧◩◪◨⬒
15. ajkjk+7z5[view] [source] [discussion] 2023-11-22 05:58:12
>>buzzy_+Vm1
For whatever reason I find licensing incredibly boring. Anything I learn about it just vanishes the next day. That's basically why I'm only interested in dealing with licenses I don't have to think about.
[go to top]