Skip to content
On this page

This project is in the development stage. npm version

Thanks for support and feedback! npm downloads

Artis JS


A low-level and functional virtual CSS library with no CSS codes. More than 80 Utilities. Infinite Configurations.

Introduction

Artis is a tiny 1.4 kilobytes Virtual CSS javascript library inspired from Virtual DOM. Use the custom syntax in the component styling without actually writing the CSS code, and never increase your project file size by adding CSS codes.

Netlify Status

Benefits

  • No tree-shaking CSS classes
  • No Extra CSS bundling
  • No CSS blocking
  • No CSS codes
  • Fast render

Getting Started

bash
$ npm i artis --save-dev

Playground

The Playground is an online code editor, you can use it for testing or just playing around with Artis.js on the go.

Launch Playground now!

  • Press F1 to open Palette menu to access advanced options.
  • Press Reset button to delete data stored in the browser.

image

API Introduction

Artis.js offers a very minimum learning curve to use the library, set the design() to true to enable CSS styling without writing CSS and no CSS payload. Up to 80+ different type of useful utilities and each utility has countless modifier that allows you to fine-tune the utility more precisely.

The Artis Syntax is look like below,

{utilityName}{:}{valueModifier}

Which is equilvalent to...

html
<div class="textSize:40"></div>
css
font-size: 40px;
js
const style = "textSize:40 textColor:rgba(22,22,22,0.5)";

Let's craft something!

Let's create 2 files below with Vanilla JS by using the native web component.

js
// app.js
import { design } from "artis";

class MainComponent extends HTMLElement {
  constructor() {
    super();
  }
  connectedCallback() {
    const style = `
      p:20
      m:20
      textSize:50
      bgColor:white
      curveRadius:20
    `;
    const tmpl = document.createElement("template");
    tmpl.innerHTML = `
      <div class="${style}">
        Hello World!
      </div>
    `;
    this.appendChild(tmpl.content.cloneNode(true));
    window.onload = () => design(true); // init artis.js
  }
}
customElements.define("main-component", MainComponent);
html
<!-- index.html -->
<body class="m:0 p:0 textColor:black bgColor:white listStyle:none display:flex justifyContent:center alignItems:center">
  <main-component></main-component>
</body>

Create a group of complex styled components and reuse them anywhere in the project.

js
// Example #3

// style.js
export const reset = "m:0 p:0 listStyle:none textSize:16 textColor:black bgColor:white"; // normalizer
export const center = "display:flex justifyContent:center alignItems:center";
export const centerCol = `${center} flexDirection:column`;
export const centerRow = `${center} flexDirection:row`;
export const paddingWide = "pt:60 pb:60 pl:20 pr:20";

// app.js
import {
  reset,
  center,
  centerCol,
  centerRow,
  paddingWide
} from "./style";

That's all you need to learn to use Artis.js. Simply minimalist.

API: Typography

UtilityDOM Style ObjectsUsage
columnCountstyle.columnCountReference
columnFillstyle.columnFillReference
columnGapstyle.columnGapReference
columnRuleColorstyle.columnRuleColorReference
columnRuleStylestyle.columnRuleStyleReference
columnRuleWidthstyle.columnRuleWidthReference
columnSpanstyle.columnSpanReference
fontFamilystyle.fontFamilyReference
fontStylestyle.fontStyleReference
fontWeightvfontWeightReference
lineHeightstyle.lineHeight0px
listStylestyle.listStyleReference
textAlignstyle.textAlignReference
textColorstyle.colorrgba(0,0,0,0)
textDecostyle.textDecorationReference
textDecoColorstyle.textDecorationColorReference
textDirectionstyle.directionReference
textOverflowstyle.textOverflowReference
textSizestyle.fontSize0px
textTransformstyle.textTransformReference
whiteSpacestyle.whiteSpaceReference
wordWrapstyle.wordWrapReference

API: Backgrounds

UtilityDOM Style ObjectsUsage
bgColorstyle.backgroundColorrgba(0,0,0,0)
opacitystyle.opacityOpacity

API: Borders

UtilityDOM Style ObjectsUsage
curveColorstyle.borderColorrgba(0,0,0,0)
curveRadiusstyle.borderRadius0px
curveStylestyle.borderStyleReference
curveWidthstyle.borderWidth0px

API: Sizing

UtilityDOM Style ObjectsUsage
hstyle.height0px
wstyle.width0px
maxHstyle.maxHeightReference
minHstyle.minHeightReference
maxWstyle.maxWidthReference
minWstyle.minWidthReference
vHeightstyle.heightReference
vWidthstyle.widthReference

API: Spacing

UtilityDOM Style ObjectsUsage
mstyle.margin0px
mlstyle.marginLeft0px
mrstyle.marginRight0px
mtstyle.marginTop0px
mbmarginBottom0px
pstyle.padding0px
plstyle.paddingLeft0px
prstyle.paddingRight0px
ptstyle.paddingTop0px
pbstyle.paddingBottom0px

API: Flex

UtilityDOM Style ObjectsUsage
alignContentstyle.alignContentReference
alignItemsstyle.alignItems0px
alignSelfstyle.alignSelfReference
flexBasisstyle.flexBasisReference
flexDefaultstyle.flexReference
flexDirectionstyle.flexDirectionReference
flexGapstyle.gapReference
flexGrowstyle.flexGrowReference
flexShrinkstyle.flexShrinkReference
flexWrapstyle.flexWrapReference
justifyContentstyle.justifyContentReference
orderstyle.orderReference

API: Interactivity

UtilityDOM Style ObjectsUsage
cursorstyle.cursorReference
outlineColorstyle.outlineColorReference
outlineOffsetstyle.outlineOffsetReference
outlineStylestyle.outlineStyleReference
outlineWidthstyle.outlineWidthReference
resizestyle.resizeRefrence
scrollstyle.scrollBehaviourReference
selectstyle.userSelectReference

API: Layouts

UtilityDOM Style ObjectsUsage
leftstyle.left0px
rightstyle.right0px
topstyle.top0px
bottomstyle.bottom0px
clearstyle.clearReference
displaystyle.displayReference
floatstyle.cssfloatReference
overflowstyle.overflowReference
overflowXstyle.overflowXReference
overflowYstyle.overflowYReference
imageFitstyle.objectFitReference
imagePositionstyle.objectPositionReference
positionstyle.positionReference
clipstyle.clipReference
showstyle.visibilityReference
stackstyle.zIndexReference

API: Filters

UtilityDOM Style ObjectsUsage
filterstyle.filterFilter

API: Transforms

UtilityDOM Style ObjectsUsage
transformstyle.transformReference

API: Transitions

UtilityDOM Style ObjectsUsage
transitionstyle.transitionReference

Thanks for reading.

License: MIT