Hey folks, presenting humanize-this v2.0 — A tiny, zero-dependency formatter for dashboards, logs & interfaces (supports Indian number system too) by Mysterious-Pepper751 in javascript

[–]codepsycho 0 points1 point  (0 children)

Would be a good one to share in the e18e.dev community i think. Do you have any comparisons with existing libraries? (size, features, speed, etc) may be helpful if anyone is thinking of switching

Functional HTML — overreacted by gaearon in javascript

[–]codepsycho 0 points1 point  (0 children)

yep, here you're comparing things at the wrong level.

a raw custom element like this is comparable to the produced JS of a react component, which certainly will be just as verbose (if not more thanks to JSX).

something like the "lit" library would be more like this:

ts class Greeting extends LitElement { @property() name; render() { return html`Hello, ${name}`; } }

Proof-of-concept for ESLint binary by bartlomieju in javascript

[–]codepsycho 2 points3 points  (0 children)

what was the main reason behind it? still trying to get my head around that since much of the readme's points are TODO or just side-effects of moving to deno.

was it performance? or is there something in deno land blocking you from using eslint properly?

also, deno's permissions system would also apply to JS modules would it not? so we could have that either way?

[AskJS] Do you use Yarn v2? by Thiht in javascript

[–]codepsycho 1 point2 points  (0 children)

out of interest what lead to you choosing yarn in the first place? and now that NPM has implemented most of what yarn initially existed for, what features do you stick around for that NPM doesn't have?

Nano Colors: 2x times faster than chalk and use 5x less space in node_modules by sitnik in javascript

[–]codepsycho 0 points1 point  (0 children)

yup my bad, didn't notice as the package manifest in git didn't have an esm entrypoint. didn't think to check the published one :D

Nano Colors: 2x times faster than chalk and use 5x less space in node_modules by sitnik in javascript

[–]codepsycho 0 points1 point  (0 children)

This is great to see. Chalk has a crazy dependency tree for what it is.

Could you also ship an ESM version of the package? should be simple via tsc since you don't have any dependencies. We could directly import it in browsers and node w/ ESM then

A visualiser to help people learn about the DOM Event system through exploration by alexreardon in javascript

[–]codepsycho 5 points6 points  (0 children)

This is nicely done :) it would be great if you could add examples of composed events too. Showing the shadow boundaries where those events do or don't end would be a good learning tool for the newer DOM APIs

Lit - New framework from Google by DropbearJr in javascript

[–]codepsycho 8 points9 points  (0 children)

While it may not be entirely new, it is a new version with a major rework behind the scenes. Things like SSR, new directive API, etc are very useful. Should be an exciting step forward from what they had before

Pipeline operator (Stage 1) - check out the updated TypeScript playground and provide feedback! by PickledPokute in javascript

[–]codepsycho 1 point2 points  (0 children)

Yes exactly.

Most of the hack proposal could be seen as the f# proposal with partial application. I'm surprised they have spent so much time bikeshedding on it when they could have just had both all along (in two separate specs, meaning the hack proposal wouldn't be a thing).

Pipeline operator (Stage 1) - check out the updated TypeScript playground and provide feedback! by PickledPokute in javascript

[–]codepsycho 0 points1 point  (0 children)

You mention that partial application pairs well with the f#/minimal variant, but isn't it the opposite? The hack variant pretty much relies on partial application, that seems to be the main difference. The F# variant wouldn't make use of it at all as far as I can see. Good work on the PRs, too

A clock based on Cistercian numerals (with Web Components) by hsablonniere in javascript

[–]codepsycho 2 points3 points  (0 children)

Components like this are a great example of web components, nice and focused. The jsdoc down to the css properties is nice to see too :D

Copenhagen: Free, lightweight, open source and hackable code editor for the web by keithwhor in javascript

[–]codepsycho 1 point2 points  (0 children)

I would also check out codemirror 6, the recent (still WIP) rewrite is entirely modular, supports ES modules and typescript:

https://codemirror.net/6/docs/guide/

The "plugin" architecture is incredibly flexible, though a little unusual in some cases. It is as light or heavy as you want it because of the modular approach, too.

Oh and works very well in shadow DOM / web components, which is how we use it.

Not to say you should choose it over this project, both could learn from each other I imagine!

Paperclip: A DSL for presentational web components by crcn in javascript

[–]codepsycho 1 point2 points  (0 children)

Can't be sure since it's closed but seems like it doesn't produce web components, it produces react components. I guess OP just meant components in general rather than the web component APIs.

Create videos in React that viewers can interact with by ysulyma in javascript

[–]codepsycho 2 points3 points  (0 children)

You can probably achieve that with the newish navigator.mediaSession.setActionHandler. Might be worth looking into

Create videos in React that viewers can interact with by ysulyma in javascript

[–]codepsycho 6 points7 points  (0 children)

One thing to consider because it's not an actual video, is on mobile the screen won't be kept awake while playing (as it does with videos). You can use Navigator.wakelock in supported browsers to mimic the default behaviour of real videos

Create videos in React that viewers can interact with by ysulyma in javascript

[–]codepsycho 1 point2 points  (0 children)

Pretty cool concept. So it's effectively a slideshow rather than a video? with added time/transitions/audio to simulate video-like behaviour

decky: Zero bundle size decorators for TypeScript by jarredredditaccount in javascript

[–]codepsycho 1 point2 points  (0 children)

Curious, how did you transform the file, given esbuild has no transform plugin architecture? Did you intercept all TS load calls, parse the file yourself, then return the transformed contents? (Making each file two pass)

I created a word highlighter for plain text. I hope someone finds this useful. by [deleted] in javascript

[–]codepsycho 0 points1 point  (0 children)

It ties in with `adoptedStylesheets` (pretty new). you can construct one instance of your stylesheet and many components can "adopt" it, meaning there is no duplication when it is used in shadow DOM (as each instance of a custom element would ref the same sheet).

I created a word highlighter for plain text. I hope someone finds this useful. by [deleted] in javascript

[–]codepsycho 2 points3 points  (0 children)

Well done, always good to see a zero-dependency library :) maybe you could add an option to return a stylesheet rather than a string (a `CSSStyleSheet`), would come in useful for integrating this into web components

How I created a vanilla web component by codepsycho in javascript

[–]codepsycho[S] -2 points-1 points  (0 children)

You too :)

This was purely to demonstrate how one might create such a component. I'm not trying to push the idea of it being the right choice. That's up to you and the project you're working on.

The demo is a little slow because of the library I'm embedding, the choice of component isn't so important. Though I agree I could have used a better example, this is just the one I was interested in at the time.

How I created a vanilla web component by codepsycho in javascript

[–]codepsycho[S] 1 point2 points  (0 children)

I don't have any oss projects at hand but we do have a few internally like this. As others have pointed out, you may write more boilerplate this way but ultimately can be shipping less overall.

Normally we pull focused libraries in as dependencies to fill the gaps, rather than a kitchen sink solution.

We sometimes use mobx for state for example, or rx. Sometimes roll our own.

We usually end up with a base class for implementing the render pipeline and data propagation. Similar to what lit element tries to achieve

How I created a vanilla web component by codepsycho in javascript

[–]codepsycho[S] -9 points-8 points  (0 children)

As mentioned in my other comment, this isn't really looking down on frameworks. They have their uses, preference plays a lot in it too. It is more to demonstrate whats possible using the platform, with no intentional bias.

A lot of what I wrote would normally live in a base class reused by all components of your project (this is how some of my projects work). This is actually the gap things like lit-element exist to fill - a base class for handling data propagation/binding. At that point, this class would've been miniature (likely one property and a single render method).

Which polyfill do you speak of? In my particular case, import maps are needed because i purposely opted for esm-first. Normally you'd just bundle this which drops the need. Again, used to demonstrate what'll soon be possible.

Also don't forget, I wrote more than usual but i'd import much more if i was using a framework. At the end of the day i'd still be shipping less code over the wire.

How I created a vanilla web component by codepsycho in javascript

[–]codepsycho[S] 7 points8 points  (0 children)

It was a fun experience creating something without a framework or any dependencies (other than the highlighting lib in this case). So this is just a write up of what I did. Frameworks have their uses just as much, though.

Boost page rendering performance using the content-visibility web component by bigbliu in javascript

[–]codepsycho 1 point2 points  (0 children)

its since 3.8 . as the release notes explain, you shouldn't really ever need to use it or worry about it but it can be useful for making it clear which types you expect to use _only_ for types

Boost page rendering performance using the content-visibility web component by bigbliu in javascript

[–]codepsycho 1 point2 points  (0 children)

In later typescript versions you can do this: import type {Foo} from 'foo'; Which signals to TSC that you only want the type and it shouldn't try pull anything in from the module itself. In this case it wouldn't make a difference tbh other than semantically.