GithubHelp home page GithubHelp logo

silkstudio / jynx Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 0.0 2.15 MB

Rapidly create and control responsive, theme-focused and type-safe styled-components, directly from your jsx.

Home Page: https://jynx.vercel.app

License: MIT License

TypeScript 99.53% Shell 0.02% JavaScript 0.45%
react typescript css-in-js cssinjs css style-props styled-components emotion

jynx's Introduction

Jynx

Rapidly create and control responsive, theme-focused and type-safe components, directly from your jsx.

GitHub Workflow Status npm npm GitHub Repo stars GitHub


Jynx is a performant and intuitive utility library for the 'CSS-in-JS era', allowing for responsive, theme-focused, type-safe styled-components to be rapidly created and controlled directly from your jsx.

Originally built in-house by Silk Studio to streamline our own development pipeline, Jynx is now available to use in your own projects and comes with support for:

  • rapid component styling through the use of style-props
  • using objects and arrays to create mobile-first, responsive designs
  • integration with a global theme that's accessed directly from your props
  • written in Typescript and fully type-safe

✏️  Getting Started

Check out the introduction to get up and running or head to jynx.vercel.app to view the full documentation.

🔗  Quick Links

💻  Development

Jynx uses shipjs for managing it's releases. For devs issuing a new release, simply run yarn release in your local terminal and follow the CLI wizard.

Notes on Releasing

  • When merging a shipjs-created PR always make sure to Squash & Merge (failure to do so will cause issues due to the commit name).
  • If you are experiencing auth issues with git/github you may need to authorise a new GITHUB_TOKEN.

📄  License

Jynx is MIT licensed, Copyright © 2022-present


2022 © Silk Studio

jynx's People

Contributors

dependabot[bot] avatar nathnhughes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

jynx's Issues

flexbox: enforcing display flex

In order for flex properties to work, a components display props must be set to flex. This is shown in the code in the following way:

const flexbox: StyleFunction<FlexboxProps> = ({ theme, ...styles }) => {
const result = createStylesObject<FlexboxProps>(styles, theme, config)
if (Object.keys(styles).length) {
result.display = 'flex'
}
return result
}

However, in practice, there seem to be instances where even if no flex props are passed, the display prop is still being set to flex as a default.

This should be investigated and potentially, a new solution provided for handling the adding of display: flex;.

Roadmap

Here's the roadmap for how the library is planning to progress. This issue will act as a rolling thread to keep track of where things are at.

 

Phase 1 - Initial MVP

  • Create basic working product which allows for use of the librarys functions to pass style props, which are type-checked against css-type.

Phase 2

  • Add a scale prop to the styleParser function that can be used as the first-port-of-call for emit suggestions.
  • Create a more strictly typed theme based on whether a property can have an object, array or both assigned to it
  • Make a descision on rules for how to parse different types of style values
  • Implement a unitless function to add units to plain numbers (but only in certain circumstances based on the above)
  • Implement a test suite to check everything is working

Phase 3

  • Add intellisense through ts to enable suggestions for props based on theme and scale
  • Add transformers to select props to allow 'power-user' syntax (e.g. gridRow, gridCol, margin, padding, width, height)
  • Add aliases (with type support) to common props allowing cleaner syntax

 

Longer term

  • Create compose function for improved performance

transientisation: props leaking through to DOM

Due to the current implementation, there appear to be many instances where props are leaking through to the DOM that shouldn't otherwise be there.

This is solved either by using some sort of shouldForwardProp function or by using transient (prefixed with $) props.

A potential solution could be to make all available props also accept a 'transient' version, however, I worry whether it will make the DX feel a bit clunky if you have to filter through masses of props to find the one you're looking for in your IDE.

Using a shouldForwardProp function poses a number of difficulties, most notably being where to implement it.

Implement it directly in the package and it becomes a lot more opinionated as there may be instances when props should be passed to the underlying component.

Make it an export function and leave it to the user to implement and you risk it becoming tedious should it need to be added to every component created.

This needs to be researched a little more before a concrete solution can be provided...

grid: alignSelf

Grid children should have an alignSelf prop by default rather than having to add it in with a flex style function.

There may be a couple more props like this for grid children (justifySelf springs to mind) so make sure to look into that before merging these changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.