Moonshine CSS - 🥃 High-proof atomic CSS framework

Overview

Moonshine CSS

Features

  • 🥃 Minimal and simple atomic CSS framework
  • ⚗️ 100% customizable - build your own CSS framework
  • 🦀 Blazing fast generator written in Rust
  • 🐜 Tiny 1.7 kB runtime
  • ⚛️ CSS-in-JS library for React

Install

npm install --save @econify/moonshine-css
yarn add @econify/moonshine-css

Generate Styles

Create a .moonshinerc file in your project root.

by running

npx distill --init

or by creating a file manually:

{
  "options": {
    "atomStyle": "classAttribute",
    "breakpointModifierStyle": "suffix",
    "breakpointModifierSeperator": "-",
    "breakpoints": {
      "sm": { "minWidth": "576px" },
      "md": { "minWidth": "768px", "maxWidth": "992px" },
      "lg": { "minWidth": "992px" }
    }
  },
  "designTokens": ["./atomic-design-tokens.yml"],
  "templates": [
    "./tachyons-border-box.yml",
    "./tachyons-colors.yml",
    "./tachyons-flex.yml",
    "./tachyons-spacing.yml"
  ],
  "output": {
    "cssVariables": "./dist/variables.css",
    "cssAtoms": "./dist/atoms.css",
    "jsonAtoms": "./dist/atoms.json"
  }
}

then run

npx distill --watch

Usage

import "atomic-styles.css";
isPrimary && "bg-primary text-white" ); export default Demo() { return (
); };">
import { styled } from "@econify/moonshine-css";

const Button = styled.button(
  "bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",
  ({ isPrimary }) => isPrimary && "bg-primary text-white"
);

export default Demo() {
  return (
    <div>
      <Button isPrimary={true}>Click me</Button>
    </div>
  );
};

You can read more about the runtime syntax here.

Acknowledgements

TBD

Comments
  • `box` styled component calls forwardRef on every render

    `box` styled component calls forwardRef on every render

    const box = new Proxy(
      {},
      {
        get: (_target, tagName: string) => {
          if (!(tagName in _target)) {
            _target[tagName] = make(tagName);
          }
          return _target[tagName];
        },
      },
    ) as StyledTags;
    

    Current implementation can cause event handlers to get dropped, because the component is being recreated on each render

    opened by regan-karlewicz 0
  • [CF] (Security) Upgrade

    [CF] (Security) Upgrade "rollup-plugin-license" to resolve vulnerability in MomentJS

    Description

    • Prior to 2.29.4, moment had a bug which causes specific date inputs to use n^2 complexity.
    • The issue is rooted in the code that removes legacy comments (stuff inside parenthesis) from strings during rfc2822 parsing. moment("(".repeat(500000)) will take a few minutes to process.
    • Moonshine uses a version of rollup-plugin-license that depends on a vulnerable version of moment.

    Changes

    opened by craigfay 0
  • Bump vite from 2.9.9 to 2.9.13 in /examples/vite-app

    Bump vite from 2.9.9 to 2.9.13 in /examples/vite-app

    Bumps vite from 2.9.9 to 2.9.13.

    Changelog

    Sourced from vite's changelog.

    2.9.13 (2022-06-27)

    2.9.12 (2022-06-10)

    • fix: outdated optimized dep removed from module graph (#8534) (c0d6c60), closes #8534

    2.9.11 (2022-06-10)

    2.9.10 (2022-06-06)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • [CF]: Standardize Error Handling

    [CF]: Standardize Error Handling

    Changes

    • Introduces the errors module
    • Replaces unwrap() and expect() calls with human-friendly error messages.
    • Remove duplicate type conversion

    Validation

    • Check out this branch
    • Run cargo run -- --init
    • Run cargo run
    • Verify that no unexpected errors occur
    opened by craigfay 0
  • [CF]: Generate Root Variables From Design Tokens

    [CF]: Generate Root Variables From Design Tokens

    Change Notes

    • If RCFile.outputs.css_variables is specified, CSS variables will be generated for all tokens.
    • Templates can inject root variables (instead of hardcoded token values) by using $$group_name.value.
    • Adds RCFile.options.root_variable_prefix to support numerical token keys as CSS Variables.
    opened by craigfay 0
  • [CF,TW]: Introduce YAML Template Syntax

    [CF,TW]: Introduce YAML Template Syntax

    Change Notes

    • Introduces "template syntax" for defining CSS in YAML
    • Preserves the ordering of CSS rules
    • Introduces RCFile.options, which exposes more flexibility
    • Introduces tachyon style templates for "testing"
    opened by craigfay 0
  • :sparkles: Added distill --init

    :sparkles: Added distill --init

    • Added clap CLI parser
    • Added new --init option, which creates .moonshinerc based on template
    • Added new --watch option (which does nothing for now)
    • Added new --debug option (which does nothing for now)
    • Replaced distill <config> with distill --config <config>
    opened by tw00 0
Releases(v0.2.0)
  • v0.2.0(Jul 1, 2022)

    Changelog

    b06a0a4 Merge pull request #26 from Econify/hotfix-bad-merge-conflicts-resolution 6a262e7 revert version bump d13f753 Use correct config 2f587bf 0.2.0 406cd45 [CF / CH]: Support pseudo classes 05a4217 Merge branch 'main' into cf-psuedo-classes c5d8281 Support pseudo classes 487db0e [CF]: ✨ Fix Syntax, Setup Pseudo Class Modifiers c0e681a Comment, fix example template d8bbd3e Merge with master b7e808d Update README faca712 [CF]: Standardize Error Handling 3a727fd Typo 13964c8 Adjust formatting 9b7a169 Handle unwrap e3a6b4f Introduce errors module 43d604a Introduce Exit struct 27285b7 Rename fn a311168 Share ErrorHandler 2084423 Cleanup, pub err handling 6bdb552 Introduce ErrorHandler struct f3b0bdd handle rc file parsing errors 3f1baff handle rc file open errors 706932d Update README c38fa30 Fix syntax, setup pseudo class modifiers

    Source code(tar.gz)
    Source code(zip)
  • v0.1.9(Jun 3, 2022)

    Changelog

    6f76af6 :zap: Use release build, lazy static regex (#15) f2970d1 :bug: Fixed paths distill --init (#22) 5a4e383 :memo: Update licence to ISC (#21)

    Source code(tar.gz)
    Source code(zip)
  • v0.1.8(Jun 3, 2022)

  • v0.1.7(May 31, 2022)

  • v0.1.6(May 31, 2022)

  • v0.1.5(May 31, 2022)

  • v0.1.4(May 31, 2022)

  • v0.1.3(May 31, 2022)

  • v0.1.2(May 31, 2022)

  • v0.1.1(May 31, 2022)

    Changelog

    99b7f42 :construction_worker: Fixed working dir in release action 0f02856 👷 Added Release Workflow (#2) d5e55b5 [CF]: Generate Root Variables From Design Tokens bef3e07 Merge w main 3758c38 :lipstick: Converted all tachyons css to generators (#10) 2518e35 Cleanup c61adea Update rcfile fb299b3 Update README 80c7c4c Allow root variable injections, use prefixes on root variables 7dcc62b Create CSS Variables 48accb2 Merge pull request #12 from Econify/craigfay/breakpoints b5ab092 Resolve merge conflicts 42218e2 Merge w main 4f7fe03 :art: Improved --init option (#11) bc7ceaf Update README 14e5521 Support multiple atom styles, handle edge cases 0cf9046 :memo: Added document on future improvements 4075428 Add breakpoint options bc63e8b Trim selector names 3c3fde9 :wastebasket: Clean up + moved bin to /bin + docs (#9) 291dfa3 Isolate template files 2019735 Introduce breakpoints option efe4c1d 🚨 Added rustfmt config + format (#5) 884591d :sparkles: Added distill --init (#4) f7002f0 [CF,TW]: Introduce YAML Template Syntax a0d1e34 Remove dead module ed59720 Preserve rule order 507de6c Introduce template options, support data attribute atoms, non-atoms 47b9e75 🎨 Added Vite-App example (#7) 66906ec :sparkles: Added support for nested CSS in css template tag literal (#6) d47d442 update README 8ad3e22 finish spacing template 9bc23ad Add missing alignments 526c596 Rename lib -> transformation syntax f638a95 Rename sugar -> template_syntax, cleanup warnings f7e291e Introduce index map to preserve ordering 2c3e25c More flex properties f1fa9fb Support no transformation ca367d0 Infer loop transforms 23c1f8d Introduce yml parsing f4081e1 :art: Updated logo bd6c27c :tada: Initial commit runtime (#3) e4dabed Added cssFromVarMap dc601cb Introduce GH workflow d7ecd98 Support raw declarations f957ace Rename generator, make NPM package be5b92c Introduce RC File Support e55f469 :tada: Initial commit runtime (#1) 0b94899 Separate bin and lib f0146e8 Split config files, rename functions 59ea858 Rename crate f4d1c4f Support pseudo classes 57a0c77 Assign ids to instructions ec108eb Rename, update gitignore 199c35d Rename fns and remove unused 0783457 Change CSS Rule properties 2b7cfc3 Change json syntax 1a71deb Use var() fn in rules 2e9c39c Create rules for global variables f71ea6b Intro helper fn f52fa68 Background colors a37b449 Cleanup 44490ae Use generic instructions c40adb4 Create generic config f3bf910 Preserve key order w BTreeMap c84bd02 Stringify rules 946395a Return rules be75a44 Build rules from config 7355a52 Use command line args dcfbdad Add config properties

    Source code(tar.gz)
    Source code(zip)
Owner
Econify
Econify builds the fastest websites for the best media companies in the world
Econify
A range proof SNARK using Spartan

R1CS Gadgets This repository contains R1CS gadgest I have built using (a slightly modified version of) Spartan. Currently, the two gadgets included ar

Imran Khaliq 4 Sep 21, 2022
Rust implementation for Wlroots (Sway, Wayfire, Hikari, River, etc.) of Gnome Screenshot and Idle DBUS Server, which Upwork uses to capture the screen as proof of work.

?? upwork-wlroots-bridge ?? Rust Implementation for Wlroots (Sway, Wayfire, Hikari, River, etc.) of Gnome Screenshot and Idle DBUS Server (with extra

Daniel Moretti V. 4 Jan 2, 2023
A collection of compilers based around compiling a high level language to a Brainfuck dialect.

tf A collection of compilers based around compiling a high level language to a Brainfuck dialect. Built at, and for, the VolHacks V hackathon during O

adam mcdaniel 6 Nov 25, 2021
Damavand is a quantum circuit simulator. It can run on laptops or High Performance Computing architectures, such CPU distributed architectures or multi GPU distributed architectures.

Damavand is a quantum circuit simulator. It can run on laptops or High Performance Computing architectures, such CPU distributed architectures or multi GPU distributed architectures.

MichelNowak 0 Mar 29, 2022
A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use.

rs-cord A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use. Documentation • Crates.io • Discord Navigation M

Jay3332 4 Sep 24, 2022
High-level PortMidi bindings and wrappers for Rust

High-level PortMidi bindings and wrappers for Rust

Philippe Delrieu 69 Dec 1, 2022
High-level, optionally asynchronous Rust bindings to llama.cpp

llama_cpp-rs Safe, high-level Rust bindings to the C++ project of the same name, meant to be as user-friendly as possible. Run GGUF-based large langua

Binedge.ai 4 Nov 21, 2023
The 峨眉 (EMei) JIT/AOT backend framework.

emei The 峨眉 (EMei) JIT/AOT backend framework. Support Instructions x86_64 mov mov mov_zero_extend_bit8/16 mov_sign_extend_bit8/16/32 mov_rev movs(is m

Lyzh 14 Apr 11, 2022
Nimbus is a framework for building parachain consensus systems on cumulus-based parachains.

Cumulo -- Nimbus ⛈️ Nimbus is a framework for building parachain consensus systems on cumulus-based parachains. Given the regular six-second pulse-lik

null 36 Dec 14, 2022
A Rust framework for building context-sensitive type conversion.

Xylem is a stateful type conversion framework for Rust.

Jonathan Chan Kwan Yin 4 May 11, 2022
OptFrame is an optimization framework focused in metaheuristic techniques

optframe-rust Welcome to OptFrame project in Rust. What is OptFrame? OptFrame is an optimization framework focused in metaheuristic techniques, develo

OptFrame 4 Jan 30, 2022
Elegant, clean Rust development framework

Preview version, will not guarantee the stability of the API! Elegant, clean Rust development framework Core Features Relational database client for M

Ideal World 35 Dec 29, 2022
BlackBird is a framework for Rust Tokio

BlackBird Blackbird is framework like OTP for Erlang. Blackbird is not a Actor Framewrok, it's Behavior for around Tokio task This project currently p

DanyalMh 25 Dec 15, 2022
RustHunter is a modular incident response framework to build and compare environmental baselines

RustHunter is a modular incident response framework to build and compare environmental baselines. It is written in Rust and uses Ansible to collect data across multiple hosts.

Giovanni Pecoraro 13 Dec 12, 2022
Blazingly fast spam classification API built using Rocket Web Framework.

Telegram Antispam API Blazingly fast spam classification API built using Rocket Web Framework. Notes The classifier works in aggressive mode, it can s

Akshay Rajput 13 May 5, 2023
simple lottery maker made with rust, just web framework

Toy project for fun It's just for fun! making plausible lottery numbers for Korea made with rust This lottery web framework generates and presents pla

yacho (bakjuna) 4 Nov 24, 2023
⚡rustygram is a minimal and blazing fast telegram notification framework for Rust

⚡rustygram ⚡rustygram is a minimal and blazing fast telegram notification framework using Rust. Abstracts away the Telegram API complexity so your app

Chia Yong Kang 15 Dec 1, 2023
gRPC client/server for zero-knowledge proof authentication Chaum Pederson Zero-Knowledge Proof in Rust

gRPC client/server for zero-knowledge proof authentication Chaum Pederson Zero-Knowledge Proof in Rust. Chaum Pederson is a zero-knowledge proof proto

Advaita Saha 4 Jun 12, 2023
Atomic Physics Library

Iridium Atomic Physics Library Attempt at making a atomic database. Uses Nubase2020, ENSDF for decay chains, atomic masses, and half-lives. Nubase2020

J.A Sory 14 Jun 19, 2022
Arduino Nano frequency counter with atomic clock accuracy

Arduino Nano frequency counter with atomic clock accuracy Project description and test setup With this project you can measure a frequency from less t

Frank Buss 24 Apr 3, 2022