linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Support For Solidjs

Open swise0 opened this issue 3 years ago • 9 comments

Solidjs framework is A faster React Alternative..

swise0 avatar Aug 17 '21 04:08 swise0

This repository may be used as a reference to implement a CSS in JS implementation in SolidJS. https://github.com/solidjs/solid-styled-components

petamoriken avatar Jun 23 '22 10:06 petamoriken

Hey everyone! FYI I'm working on this. Basically it all nails down to building a new processor, mostly similar to StyledProcessor in @linaria/react. I'm already able to transpile html tags down to pure jsx-components, which can then be passed to babel-preset-solid that transpiles them to pure dom/ssr templates.

So it's working for html tags (styled.div) but I'm having troubles with anonymous components wrapped directly in styled (e.g. styled(() => <div></div>)), they just disappear from the output even with the base @linaria/react, the body is replaced with a simple () => {}.

Additionally, I think I'd need some help with understanding where/how things like const _exp = () => .... are generated. Currently, all interpolations are replaced with such functions, example:

`
color: ${props => props.color};
`

is transpiled to

const _exp = () => props => props.color

and _exp can then be called directly in the body of the newly generated component this way:

const style = {
  '--sdfds-0': _exp()(props)
}

Do you see the extra call? I'd like to know if it's possible to hook into generation of these _exps.

Additionally, I'd like to know if you'd merge this to the repo as a separate package? (similar to atomic package)

raveclassic avatar Aug 01 '22 10:08 raveclassic

@raveclassic it will be a long story :) Can you message me in TG @anber_ru?

Anber avatar Aug 01 '22 12:08 Anber

Really want to use linaria with Solid.js. Any updates on this?

victorteokw avatar Oct 23 '22 01:10 victorteokw

@victorteokw, we have a test library. I'll try to make a PR tomorrow.

usmanyunusov avatar Oct 23 '22 02:10 usmanyunusov

Many thanks @usmanyunusov 🎉

victorteokw avatar Oct 23 '22 02:10 victorteokw

PR: #1096

rockwotj avatar Nov 17 '22 10:11 rockwotj

@usmanyunusov @raveclassic nu kak tam s dengami? I can help with solid btw Check demo with astro + solid: https://github.com/callstack/linaria/pull/1118

MrFoxPro avatar Nov 18 '22 08:11 MrFoxPro

@MrFoxPro I've updated the PR and added a simple demo https://github.com/callstack/linaria/pull/1096

raveclassic avatar Nov 26 '22 11:11 raveclassic