diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 31e7523..88e6dff 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -9,9 +9,9 @@ jobs: matrix: node-version: [20.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: yarn diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..ddd2155 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,26 @@ +name: Node.js CI + +on: + push: + branches: [ master ] + +jobs: + gh-pages: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + - run: yarn install --frozen-lockfile + - run: yarn test --coverage + - name: Publish to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./coverage/lcov-report diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53b369c..a1faa8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,9 +11,9 @@ jobs: matrix: node-version: [20.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: yarn diff --git a/addon/atoms.d.ts b/addon/atoms.d.ts index 04a5ed1..6875be1 100644 --- a/addon/atoms.d.ts +++ b/addon/atoms.d.ts @@ -4,240 +4,680 @@ import {NanoRenderer} from '../types/nano'; type TLength = string | number; export interface Atoms { + // Positioning + + /** + * Short for `position` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + pos?: CSS.Property.Position; + + /** + * Short for `top` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + t?: CSS.Property.Top; + /** - * Short for `display` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `right` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + r?: CSS.Property.Right; + + /** + * Short for `bottom` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + b?: CSS.Property.Bottom; + + /** + * Short for `left` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + l?: CSS.Property.Left; + + /** + * Short for `z-index` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + z?: CSS.Property.ZIndex; + + + // Layout (box model) + + /** + * Short for `display` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ d?: CSS.Property.Display; /** - * Short for `margin` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `visibility` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + vis?: CSS.Property.Visibility; + + /** + * Short for `width` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + w?: CSS.Property.Width; + + /** + * Short for `min-width` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + minW?: CSS.Property.MinWidth; + + /** + * Short for `max-width` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + maxW?: CSS.Property.MaxWidth; + + /** + * Short for `height` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + h?: CSS.Property.Height; + + /** + * Short for `min-height` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + minH?: CSS.Property.MinHeight; + + /** + * Short for `max-height` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + maxH?: CSS.Property.MaxHeight; + + /** + * Short for `overflow` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + ov?: CSS.Property.Overflow; + + /** + * Short for `overflow-x` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + ovx?: CSS.Property.OverflowX; + + /** + * Short for `overflow-y` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + ovy?: CSS.Property.OverflowX; + + /** + * Short for `box-sizing` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bxz?: CSS.Property.BoxSizing; + + /** + * Short for `clip` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + cl?: CSS.Property.Clip; + + /** + * Short for `clip-path` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + clp?: CSS.Property.ClipPath; + + /** + * Short for `table-layout` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + clr?: CSS.Property.Clear; + + /** + * Short for `table-layout` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + tbl?: CSS.Property.TableLayout; + + + // Flexbox + + /** + * Short for `flex` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + fl?: CSS.Property.Flex; + + /** + * Short for `flex-direction` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + fld?: CSS.Property.FlexDirection; + + /** + * Short for `flex-grow` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + flg?: CSS.Property.FlexGrow; + + /** + * Short for `flex-shrink` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + fls?: CSS.Property.FlexShrink; + + /** + * Short for `flex-basis` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + flb?: CSS.Property.FlexBasis; + + /** + * Short for `flex-wrap` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + flw?: CSS.Property.FlexWrap; + + /** + * Short for `justify-content` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + jc?: CSS.Property.JustifyContent; + + /** + * Short for `align-items` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + ai?: CSS.Property.AlignItems; + + /** + * Short for `align-content` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + ac?: CSS.Property.AlignContent; + + /** + * Short for `align-self` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + as?: CSS.Property.AlignSelf; + + + // Margins + + /** + * Short for `margin` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + mr?: CSS.Property.Margin; + + /** + * Short for `margin-top` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + mrt?: CSS.Property.MarginTop; + + /** + * Short for `margin-right` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + mrr?: CSS.Property.MarginRight; + + /** + * Short for `margin-bottom` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + mrb?: CSS.Property.MarginBottom; + + /** + * Short for `margin-left` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + mrl?: CSS.Property.MarginLeft; + + /** + * Same as `mr`. + * @deprecated Use `mr` instead. */ mar?: CSS.Property.Margin; /** - * Short for `margin-top` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `mrt`. + * @deprecated Use `mrt` instead. */ - mart?: CSS.Property.MarginBottom; + mart?: CSS.Property.MarginTop; /** - * Short for `margin-right` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `mrr`. + * @deprecated Use `mrr` instead. */ - marr?: CSS.Property.MarginBottom; + marr?: CSS.Property.MarginRight; /** - * Short for `margin-bottom` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `mrb`. + * @deprecated Use `mrb` instead. */ marb?: CSS.Property.MarginBottom; /** - * Short for `margin-left` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `mrl`. + * @deprecated Use `mrl` instead. + */ + marl?: CSS.Property.MarginLeft; + + // Paddings + + /** + * Short for `padding` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + pd?: CSS.Property.Padding; + + /** + * Short for `padding-top` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + pdt?: CSS.Property.PaddingTop; + + /** + * Short for `padding-right` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - marl?: CSS.Property.MarginBottom; + pdr?: CSS.Property.PaddingRight; /** - * Short for `padding` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `padding-bottom` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + pdb?: CSS.Property.PaddingBottom; + + /** + * Short for `padding-left` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + pdl?: CSS.Property.PaddingLeft; + + /** + * Same as `pd`. + * @deprecated Use `pd` instead. */ pad?: CSS.Property.Padding; /** - * Short for `padding-top` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `pdt`. + * @deprecated Use `pdt` instead. */ - padt?: CSS.Property.PaddingBottom; + padt?: CSS.Property.PaddingTop; /** - * Short for `padding-right` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `pdr`. + * @deprecated Use `pdr` instead. */ - padr?: CSS.Property.PaddingBottom; + padr?: CSS.Property.PaddingRight; /** - * Short for `padding-bottom` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `pdb`. + * @deprecated Use `pdb` instead. */ padb?: CSS.Property.PaddingBottom; /** - * Short for `padding-left` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Same as `pdl`. + * @deprecated Use `pdl` instead. */ - padl?: CSS.Property.PaddingBottom; + padl?: CSS.Property.PaddingLeft; + + + // Borders /** - * Short for `border` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ bd?: CSS.Property.BorderBottom; /** - * Short for `border-top` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border-top` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - bdt?: CSS.Property.BorderBottom; + bdt?: CSS.Property.BorderTop; /** - * Short for `border-right` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border-right` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - bdr?: CSS.Property.BorderBottom; + bdr?: CSS.Property.BorderRight; /** - * Short for `border-bottom` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border-bottom` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ bdb?: CSS.Property.BorderBottom; /** - * Short for `border-left` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border-left` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - bdl?: CSS.Property.BorderBottom; + bdl?: CSS.Property.BorderLeft; /** - * Short for `border-radius` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border-radius` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ bdrad?: CSS.Property.BorderRadius; /** - * Short for `color` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `border-color` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bdc?: CSS.Property.BorderColor; + + /** + * Short for `border-style` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bds?: CSS.Property.BorderStyle; + + /** + * Short for `outline` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + out?: CSS.Property.Outline; + + /** + * Short for `box-shadow` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bxsh?: CSS.Property.BoxShadow; + + + // Colors + + /** + * Short for `color` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ col?: CSS.Property.Color; /** - * Short for `opacity` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `opacity` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ op?: number | string; /** - * Short for `background` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `background` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ bg?: CSS.Property.Background; /** - * Short for `background-color` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `background-color` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ bgc?: CSS.Property.BackgroundColor; /** - * Short for `font-size` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `background-image` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bgi?: CSS.Property.BackgroundImage; + + /** + * Short for `background-repeat` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bgr?: CSS.Property.BackgroundRepeat; + + /** + * Short for `background-attachment` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bga?: CSS.Property.BackgroundAttachment; + + /** + * Short for `background-position` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bgp?: CSS.Property.BackgroundPosition; + + /** + * Short for `background-size` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bgs?: CSS.Property.BackgroundSize; + + /** + * Short for `background-origin` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bgo?: CSS.Property.BackgroundOrigin; + + /** + * Short for `background-clip` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bgcl?: CSS.Property.BackgroundClip; + + /** + * Short for `backdrop-filter` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bdfl?: CSS.Property.BackdropFilter; + + /** + * Short for `backface-visibility` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + bfvis?: CSS.Property.BackfaceVisibility; + + // Text + + /** + * Short for `font` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + f?: CSS.Property.Font; + + /** + * Short for `font-size` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ fz?: CSS.Property.FontSize; /** - * Short for `font-style` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `font-style` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ fs?: CSS.Property.FontStyle; /** - * Short for `font-weight` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `font-weight` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ fw?: CSS.Property.FontWeight; /** - * Short for `font-family` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `font-family` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ ff?: CSS.Property.FontFamily; /** - * Short for `line-height` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `text-align` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - lh?: CSS.Property.LineHeight; + ta?: CSS.Property.TextAlign; /** - * Short for `box-sizing` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `text-decoration` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - bxz?: CSS.Property.BoxSizing; + td?: CSS.Property.TextDecoration; /** - * Short for `cursor` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `text-transform` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - cur?: CSS.Property.Cursor; + tt?: CSS.Property.TextTransform; /** - * Short for `overflow` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `text-shadow` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - ov?: CSS.Property.Overflow; + ts?: CSS.Property.TextShadow; /** - * Short for `position` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `text-overflow` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - pos?: CSS.Property.Position; + tov?: CSS.Property.TextOverflow; /** - * Short for `list-style` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `word-wrap` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - ls?: CSS.Property.ListStyle; + ww?: CSS.Property.WordWrap; /** - * Short for `text-align` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `letter-spacing` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - ta?: CSS.Property.TextAlign; + lts?: CSS.Property.LetterSpacing; /** - * Short for `text-decoration` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `white-space` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - td?: CSS.Property.TextDecoration; + ws?: CSS.Property.WhiteSpace; /** - * Short for `float` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `line-height` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - fl?: CSS.Property.Float; + lh?: CSS.Property.LineHeight; /** - * Short for `width` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `vertical-align` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - w?: CSS.Property.Width; + va?: CSS.Property.VerticalAlign; + + + // Pointer /** - * Short for `min-width` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `cursor` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - minW?: CSS.Property.MinWidth; + cur?: CSS.Property.Cursor; /** - * Short for `max-width` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `pointer-events` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - maxW?: CSS.Property.MaxWidth; + pe?: CSS.Property.PointerEvents; /** - * Short for `min-height` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `user-select` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - minH?: CSS.Property.MinHeight; + us?: CSS.Property.UserSelect; + + + // Animations /** - * Short for `max-height` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - maxH?: CSS.Property.MaxHeight; + an?: CSS.Property.Animation; /** - * Short for `height` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation-name` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - h?: CSS.Property.Height; + ann?: CSS.Property.AnimationName; /** - * Short for `transition` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation-duration` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - trs?: CSS.Property.Transition; + and?: CSS.Property.AnimationDuration; /** - * Short for `outline` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation-fill-mode` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - out?: CSS.Property.Outline; + anf?: CSS.Property.AnimationFillMode; /** - * Short for `visibility` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation-iteration-count` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - vis?: CSS.Property.Visibility; + anit?: CSS.Property.AnimationIterationCount; /** - * Short for `word-wrap` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation-play-state` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - ww?: CSS.Property.WordWrap; + anp?: CSS.Property.AnimationPlayState; /** - * Short for `content` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `animation-timing-function` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - con?: CSS.Property.Content; + ant?: CSS.Property.AnimationTimingFunction; /** - * Short for `z-index` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `transition` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ - z?: CSS.Property.ZIndex; + trs?: CSS.Property.Transition; /** - * Short for `transform` property. Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + * Short for `transform` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). */ tr?: CSS.Property.Transform; + + + // SVG + + /** + * Short for `stroke` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + st?: CSS.Property.Stroke; + + /** + * Short for `stroke-width` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + stw?: CSS.Property.StrokeWidth; + + /** + * Short for `stroke-linecap` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + stl?: CSS.Property.StrokeLinecap; + + + // Other + + /** + * Short for `list-style` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + ls?: CSS.Property.ListStyle; + + /** + * Short for `content` property. + * Requires [`atoms` addon](https://github.com/streamich/nano-css/blob/master/docs/atoms.md). + */ + con?: CSS.Property.Content; } export function addon(nano: NanoRenderer); diff --git a/addon/atoms.js b/addon/atoms.js index 1c0a4d1..d0a209c 100644 --- a/addon/atoms.js +++ b/addon/atoms.js @@ -1,58 +1,202 @@ 'use strict'; +var pos = 'position', + t = 'top', + r = 'right', + b = 'bottom', + l = 'left', + w = 'width', + h = 'height', + ov = 'overflow', + col = 'color', + con = 'content', + ovx = ov + '-x', + ovy = ov + '-y', + fl = 'flex', + fld = fl + '-direction', + flg = fl + '-grow', + fls = fl + '-shrink', + flb = fl + '-basis', + flw = fl + '-wrap', + align = 'align', + ai = align + '-items', + ac = align + '-' + con, + as = align + '-self', + mr = 'margin', + mrt = mr + '-' + t, + mrr = mr + '-' + r, + mrb = mr + '-' + b, + mrl = mr + '-' + l, + pd = 'padding', + pdt = pd + '-' + t, + pdr = pd + '-' + r, + pdb = pd + '-' + b, + pdl = pd + '-' + l, + bd = 'border', + bdt = bd + '-' + t, + bdr = bd + '-' + r, + bdb = bd + '-' + b, + bdl = bd + '-' + l, + bdrad = bd + '-radius', + bg = 'background', + bgc = bg + '-' + col, + bgi = bg + '-image', + bgr = bg + '-repeat', + bga = bg + '-attachment', + bgp = bg + '-position', + bgs = bg + '-size', + bgo = bg + '-origin', + bgcl = bg + '-clip', + style = 'style', + f = 'font', + fz = f + '-size', + fs = f + '-' + style, + fw = f + '-weight', + ff = f + '-family', + text = 'text', + ta = text + '-align', + td = text + '-decoration', + tt = text + '-transform', + ts = text + '-shadow', + tov = text + '-overflow', + st = 'stroke', + stw = st + '-width', + stl = st + '-linecap', + an = 'animation', + ann = an + '-name' + ; + var atoms = exports.atoms = { + // Positioning + pos, + t, + r, + b, + l, + z: 'z-index', + + // Layout (box model) d: 'display', + vis: 'visibility', + w, + h, + minW: 'min-' + w, + maxW: 'max-' + w, + minH: 'min-' + h, + maxH: 'max-' + h, + ov, + ovx, + ovy, + bxz: 'box-sizing', + cl: 'clip', + clp: 'clip-path', + clr: 'clear', + tbl: 'table-layout', + + // Flexbox + fl, + fld, + flg, + fls, + flb, + flw, + jc: 'justify-' + con, + ai, + ac, + as, + + // Margins + mr, + mrt, + mrr, + mrb, + mrl, + mar: mr, + mart: mrt, + marr: mrr, + marb: mrb, + marl: mrl, + + // Paddings + pd, + pdt, + pdr, + pdb, + pdl, + pad: pd, + padt: pdt, + padr: pdr, + padb: pdb, + padl: pdl, + + // Borders + bd, + bdt, + bdr, + bdb, + bdl, + bdrad, + bdc: bd + '-' + col, + bds: bd + '-' + style, + out: 'outline', + bxsh: 'box-shadow', - mar: 'margin', - mart: 'margin-top', - marr: 'margin-right', - marb: 'margin-bottom', - marl: 'margin-left', - pad: 'padding', - padt: 'padding-top', - padr: 'padding-right', - padb: 'padding-bottom', - padl: 'padding-left', - - bd: 'border', - bdt: 'border-top', - bdr: 'border-right', - bdb: 'border-bottom', - bdl: 'border-left', - bdrad: 'border-radius', - - col: 'color', + // Colors + col, op: 'opacity', - bg: 'background', - bgc: 'background-color', + bg, + bgc, + bgi, + bgr, + bga, + bgp, + bgs, + bgo, + bgcl, + bdfl: 'backdrop-filter', + bfvis: 'backface-visibility', - fz: 'font-size', - fs: 'font-style', - fw: 'font-weight', - ff: 'font-family', + // Text + f, + fz, + fs, + fw, + ff, + ta, + td, + tt, + ts, + tov, + ww: 'word-wrap', + lts: 'letter-spacing', + ws: 'white-space', + lh: 'line-' + h, + va: 'vertical-' + align, - lh: 'line-height', - bxz: 'box-sizing', + // Pointer cur: 'cursor', - ov: 'overflow', - pos: 'position', - ls: 'list-style', - ta: 'text-align', - td: 'text-decoration', - fl: 'float', - w: 'width', - minW: 'min-width', - maxW: 'max-width', - minH: 'min-height', - maxH: 'max-height', - h: 'height', + pe: 'pointer-events', + us: 'user-select', + + // Animations + an, + ann, + and: an + '-duration', + anf: an + '-fill-mode', + anit: an + '-iteration-count', + anp: an + '-play-state', + ant: an + '-timing-function', trs: 'transition', - out: 'outline', - vis: 'visibility', - ww: 'word-wrap', - con: 'content', - z: 'z-index', tr: 'transform', + + // SVG + st, + stw, + stl, + + // Other + ls: 'list-' + style, + con, }; exports.addon = function (renderer) {