Read the full details and examples in the article π
www.typeonce.dev/article/patt...
Read the full details and examples in the article π
www.typeonce.dev/article/patt...
π className instead of variants
Extract variants as `utility` and compose styles as classes instead of props
π HTML custom data attributes
Define states as `data-` attributes, and then reference them easily as tailwind classes
Use the new `variant` to clean all up as well
π Inline CSS variables
Define dynamic values as local/inline CSS variables, and reference them as a static tailwind classes
Using @tailwindcss.com for styling?
Here are some not-obvious strategies to make your styles more composable (using v4) π§±
Last release of the year in the newsletter, with a look back at everything that happened in 2024
And it happened a lot π€―
www.sandromaglione.com/newsletter
β¨ TypeScript tip β¨
A function that returns Tagged Classes
π Type a class with `new () => T`
π Required `Tag` type and value
π Return a class with `_tag`
Call the function from `extends` to get the class πͺ
My writing 101 tips in this week newsletter
I have been writing on the web for (more than) a few years now
Exploring my setup and process this week π
www.sandromaglione.com/newsletter
The example that made me get CSS subgrid β¨
A superpower that can be used for many layouts
www.typeonce.dev/article/the-...
Articles are coming to typeonce.dev π
For everything that doesnβt require long explanations, but just short and to-the-point examples π
New update on pubdev with package download count π
Turns out fpdart is downloaded 90_000 times each week π (number formatting intended)
This is what you get when you bet on @effect-ts.bsky.social and the community around it β¨
β¨ TypeScript Tip β¨
Rest parameters: Allow passing any number of arguments to a function
Make your API easier to use, avoiding multiple function calls π€
β¨ TypeScript Tip β¨
Function overloads with types
π Wrap type in `{}`
π Provide 2 different signatures
Allows to call the same function with different parameters, and different results
Runtime problems may apply π
This pattern is useful in library-land to provide a better API for the end user
Programming literacy in this week newsletter π‘
> The ability to read, write, and understand code; programming concepts, syntax, and semantics, as well as applying skills to solve problems and communicate ideas
sandromaglione.com/newsletter
β¨ TypeScript Tip β¨
Type classes using `new`
π `new` keyword
π Constructor parameters inside `()`
π Class parameters after `=>`
You can mark a type as a constructor signature, something that can be instantiated using `new` π
β¨ Introducing ECS for TypeScript β¨
typeonce/ecs is a zero dependencies library to bring the Entity Component System pattern in your game
Simple, working with any renderer, type safe and composable πΉοΈ
github.com/typeonce-dev...
Systems in ECS just got a simple as it gets πΉοΈ
Define systems, dependencies, and input all type safe and inferred for you
βοΈ Components
βοΈ Systems
βοΈ Entities
Closer to the full API π
ECS + @pixijs.com + MatterJS = πΉοΈ
Compose systems to build a complex game with physics and rendering
ECS keeps everything organized and under control π«‘
Have you ever considered making a game?
Well, then you should learn about Entity Component System πΉοΈ
An introduction for you in this week newsletter π
sandromaglione.com/newsletter
Integrate physics with matterjs and ECS in your game π§±
Each system as simple as it gets, a function and a query is all you need π
Making the API as simple and safe in my ECS in TypeScript πΉοΈ
Define a component with a simple class, auto tagged and ready to use
Simple and safe πͺ
Working Entity Component System with TypeScript in action πΉοΈ
Simple architecture for organised code and powerful results π
ECS implementation in TypeScript achieved π«‘
TypeScript only, extensible, working with any renderer, type safe and composable πΉοΈ
May be the beginning of something
#game-development #typescript #games #ecs
Entity Component System (ECS) brings composability to game development πͺ
Split data and logic, and just compose entities with what they need to operate
Clean, composable and powerful π₯
Local-only calories tracker app project out now π
Learn how to build a client-only app with database included in the browser with PGLite π
@effect-ts.bsky.social + @drizzle.team + @tanstack.com router + XState
www.typeonce.dev/course/calor...
Functional programming in games? π€¨
I have been exploring a deep hole this week, and I may have found something
Some ideas in this week newsletter π
www.sandromaglione.com/newsletter
Project preview already available π
www.typeonce.dev/course/calor...
New project landing next week Tuesday 26 November π
Local-only calories tracker app
ποΈ @effect-ts.bsky.social
β‘οΈ @pglite.dev with live queries
π @drizzle.team
π Actors with XState
π§± @tanstack.com router
Your next local-first stack π