Git Product home page Git Product logo

ancestor's Issues

feat: Improve CSS utility props support

Description

Nowadays, we don't support all CSS props. We can improve by supporting props like overflow, list-style, outline, etc.

Props

  • gap
  • list-style
  • list-style-type
  • list-style-position
  • list-style-image
  • outline
  • text-decoration
  • background-size
  • background-position
  • background-image

feat: Allow custom type for `Spacing.t` and `Radius.t`

Description

Nowadays, the module Spacing (and Radius) is using an int type to represent the scale factor. Sometimes, the design team defines scale factor that allows something 1.25x of spacing/radius. Ancestor doesn't have support for this kind of value since the Spacing.t (and Radius.t) is just a type alias for int.

Proposal

We should allow user set a custom type for these modules. This is probably a breaking change, but we can also provide a migration guide on the release notes.

Draft

TBD

docs: Update documentation

  • <Stack />
  • Style props (Color.t vs Config.colors)
  • Customization (zIndex, colors, etc)
  • useResponsiveValue(...)

feat: Themed colors

Description

The current color API is based on the Color.t module. We could provide a feature that relies on the module functor to create a variant based approach like Chakra UI or Material UI.

Draft

module Ancestor = Ancestor.Make({
  type color = [
    | #gray100
    | #gray200
    | #primary100
    | #primary200
   ]
   
   let colors = color => switch color {
     | #gray100 => "#caca"
     | #gray200 => "#cecece"
     | #primary100 => "#f36"
     | #primary200 => "#f33"
   }
})

// Usage
<Box bgColor=[xs(#gray100)] color=[xs(#100)]>
</Box>

feat: `<Hidden mode=#js />`

Description

Add a js mode to the Hidden component.

Draft

open Ancestor

// Mode / Implementation type
type mode = [#js | #css]

// Usage 
<Hidden on=[#xs(true), #md(false)] mode=#js>
....
</Hidden>

Feature: <Hidden />

Feature: <Hidden />

Responsively toggle the visibility of components.

Draft

open Ancestor

<Hidden in=[#xxs(true), #md(false)] implementation=#css>
  .....
</Hidden>

References

Add CSS column-count

Add CSS column-count Property.
๐Ÿ‡ง๐Ÿ‡ท Adicionar a Propriedade de contagem de colunas CSS (column-cout).

New customization API

Customization API

  • Spacing
  • Border Radius
  • Breakpoints
  • ZIndex
  • CSS in JS Library

Drafts

1. Using a .js config file (ancestor.config.js)

Generating the customization file using a .js config file.

// ancestor.config.js
export default {
 breakpoints: {
   xs: 0,
   sm: 400,
   lg: 720,
 },
 spacing: v => v * 8,
 zIndex: {
   base: 0,
   above: 5,
   aboveAll, 
 }
}
// Ancestor.res
module AncestorX = Ancestor.Make({
  type breakpoints<'a> = {
    xs?: 'a,
    sm?: 'a,
    lg?: 'a,
  }
  type fields = Xs | Sm | Lg
  let encode = breakpoints => [
    (Xs, breakpoints.xs),
    (Sm, breakpoints.sm),
    (Lg, breakpoints.lg),
  ]
  let sizeByBreakpoints = breakpoint =>
    switch breakpoint {
    | Xs => 0
    | Sm => 400
    | Lg => 1280
    }


  type zIndex = [ #base | #above | #aboveAll]
  let zIndex = v => switch v {
   | #base => 0
   | #above => 5
   | #aboveAll => 10
  }

  type colors = Ancestor_Css.Color.t
  let colors = v => v

  type spacing = int
  let spacing = spacing => #px(spacing * 8)

  type radius = int
  let radius = radius => #px(radius * 8)


  let css = Ancestor_Emotion.css
})

2. Using a PPX

Generating the breakpoints record using a PPX.

// Ancestor.res
module AncestorX = Ancestor.Make({
  @ancestor.breakpoints
  type breakpoints = Xs | Sm | Lg
  let sizeByBreakpoints = breakpoint =>
    switch breakpoint {
    | Xs => 0
    | Sm => 400
    | Lg => 1280
   }


  type zIndex = [ #base | #above | #aboveAll]
  let zIndex = v => switch v {
   | #base => 0
   | #above => 5
   | #aboveAll => 10
  }

  type colors = Ancestor_Css.Color.t
  let colors = v => v

  type spacing = int
  let spacing = spacing => #px(spacing * 8)

  type radius = int
  let radius = radius => #px(radius * 8)


  let css = Ancestor_Emotion.css
})

Improve CSS utility props support

Description

Nowadays, we don't support all CSS props. We can improve by supporting props like overflow, list-style, outline, etc.

Props

  • cursor
  • overflow
  • overflow-x
  • overflow-y
  • visibility
  • list-style
  • list-style-type
  • outline
  • outline-style
  • text-decoration
  • text-decoration-style
  • background-size
  • background-position
  • background-cover
  • transform
  • border-(top|bottom|left|right)-style
  • border-(top|bottom|left|right)-width
  • border-(top|bottom|left|right)-color

Quality: Snapshot testing

Description

Add snapshot tests using jest + emotion-jest.

Modules / Components

  • Hidden
  • Base
  • Box
  • Grid

Feature: Custom CSS in JS Library

Description

Allow customize the CSS in JS library through module functors.

Draft

module CustomAncestor = Ancestor.Make({
  ...
  // Custom CSS function (e.g @emotion/css, styled-components, goober)
 @module("goober") external css: string => string = "css"
})

feat: Support pseudo selectors

Draft

<Box 
   _hover=style(~bgColor=[xs(Colors.red)], ())
   _active=style(
     ~color=[xs(Colors.gray), 
     ~bgColor=[xs(Colors.red], 
     (),
   )
/>
// Using new optional fields API
<Box 
   _hover={ "bgColor": { "xs": Colors.red } }
   _active={ 
     "color": { "xs" : Colors.gray }, 
     "bgColor": { "xs": Colors.red } 
   }
/>

Documentation

Description

We need to create documentation for the library. Since we're using ReScript it will be greater if we have a simple way to create documentation about the library's components, props, functions, and types.

Tasks

  • Translate from pt-br to en-us
  • "What and Why?" section
  • Installation section
  • Getting started section
  • Documentation of all responsive props
  • Examples section
  • Documentation of all components and props
  • Documentation of all functions and types

System props

  • borderRadius
  • border
  • borderRight
  • borderLeft
  • borderTop
  • borderBottom
  • bgColor
  • color
  • display
  • justifyContent
  • flexDirection
  • alignItems
  • flexBasis
  • flexWrap
  • flexGrow
  • alignContent
  • alignSelf
  • justifySelf
  • flexFlow
  • p
  • px
  • py
  • pt
  • pb
  • pl
  • pr
  • m
  • mx
  • my
  • mt
  • mb
  • ml
  • mr
  • textAlign
  • fontWeight
  • fontSize
  • letterSpacing
  • lineHeight
  • width
  • height
  • minW
  • minH
  • maxW
  • maxH
  • position
  • top
  • bottom
  • left
  • right
  • zIndex
  • boxSizing

Feature: Support main CSS properties

Description

Support all CSS props related to layout primitives.

Texts

  • font-size
  • letter-spacing
  • text-align
  • font-weight

General

  • border-radius
  • background-color๐Ÿ’ก
  • color๐Ÿ’ก
  • border (*-top,*-left, etc) ๐Ÿ’ก

Lists

  • list-style

Flex

  • flex-flow
  • flex-grow
  • align-content
  • align-self
  • justify-self

Notes

๐Ÿ’ก - Analysis

Why use ppx-ts?

Hi,

I saw you are using @greenlabs/ppx-ts/ppx (keyOf) only at core/Ancestor.res#5.

I'm wondering if it would make sense to just hard-code this one type manually?

Personally - as a future ancestor user - I'd like to see as few ppx's involved as possible. - for the sake of simplicity and performance

feat: Typography tokens

Description

We could add support for custom tokens related to font properties:

  • line-height
  • font-family
  • font-size
  • font-weight
  • letter-spacing

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.