Giter Site home page Giter Site logo

shgysk8zer0 / core-css Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 1.43 MB

A collection of CSS styles, categoiezed by files, which are useful on common projects

Home Page: https://npmjs.com/package/@shgysk8zer0/core-css

License: MIT License

CSS 87.55% HTML 6.50% JavaScript 5.95%
css custom-properties mathml styles fonts animations css3

core-css's Introduction

core-css

A collection of stylesheets that enable quick and easy styling with customization

Dependabot Status Node CI Super Linter

GitHub license GitHub issues GitHub pull requests GitHub last commit GitHub release GitHub stars

GitHub followers GitHub forks GitHub stars Twitter Follow

Donate using Liberapay Keybase BTC Keybase PGP


Helpful Links

Overview

Unlike many CSS libraries, this one has the aim of allowing customization and advanced features by utilizing the amazing features of modern CSS. Just changing a --custom-property or two can completely change the theme of a site and, since this is native CSS, you can edit these in your browser and see the results live.

For best results, namely in production, you should transpile your CSS using PostCSS using:

  • cssnano
  • cssnano-preset-default
  • postcss
  • postcss-cli
  • postcss-import
  • postcss-preset-env
  • postcss-url

It is intended to be used with shgysk8zer0/fonts, but that is completely optional. Simply don't use fonts.css and use whatever font stylesheet(s) you want instead.

Example

@import url("./viewport.css");
@import url("./rem.css");
@import url("./fonts.css");
@import url("./animations.css");
@import url("./element.css");
@import url("./class-rules.css");
@import url("./jekyll-highlight.css");

:root {
  /*================= Font Size and loading =================*/
  --desktop-rem: 1.3vw;
  --tablet-rem: 1.5vw;
  --mobile-rem: 3.3vw;
  --main-font: "Roboto";
  --title-font: "Ubuntu";
  --header-font: "Alice";
  --article-font: "Ubuntu";
  --article-header-font: var(--header-font);
  --font-display: optional;

  /*================= Set color vars here =================*/
  --default-color: #010101;
  --alt-color: #FAFAFA;
  --primary-color: #E0E0E0;
  --link-color: var(--accent-color);
  --accent-color: #135f9d;
  --accent-color-2: #0d4a7c;
  --border-color: #2D2D2D;

  /*================= Button styles and config =================*/
  --button-background: var(--accent-color);
  --button-active-background: var(--accent-color-2);
  --button-disabled-background: var(--button-active-background);
  --button-border: border;
  --button-disabled-border: var(--button-border);
  --button-active-border: var(--button-disabled-border);
  --button-color: var(--alt-color);
  --button-active-color: var(--button-color);
  --button-border-radius: 4px;
  --button-accept-background: #1e8709;
  --button-reject-background: #b41e1e;

  /*================== Animation properties ==================*/
  --animation-stagger: 150ms;

  /* ================= Syntax Highlighting ====================*/
  --highlight-color: black;
  --highlight-background: #efefef;
  --highlight-literal-number-color: #CCA418;
}
<body class="border-box scroll-smooth">
  <!-- ... -->
  <dialog class="animation-speed-normal animation-ease-in fade-in font-main">
     <header class="clearfix sticky top background-primary">
      <button type="button" class="background-accent color-alt float-right">
        <svg class="current-color icon">
          <use xlink:href="#close" />
        </svg>
      </button>
    </header>
    <div class="card shadow">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
      incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
      nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
      Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
      eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
      sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>

core-css's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar shgysk8zer0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

araguaci

core-css's Issues

Bugs introduced in v3.0.0

  • Some [hidden] elements displaying (<dialog> & <button>)
  • Lacks :disabled & :active states for new button classes (accept & reject)

display related classes override `hidden`

Steps to reproduce

  1. Create <div class="grid" hidden>

Expected behavior

The element should be hidden

Actual behavior

display: grid overrides the hidden attribute and the element is displayed

Add more usable/useful animations

Current animations are old, lacking, and written for very specific uses.

Add more, and make generic.

  • Add rules to apply transition automatically
  • Add shake animation, for things such as invalid form
  • Add fadeIn & fadeOut animations
  • Add shrink & grow animations
  • Add animations for rotations and fly-in/out
  • Add bounce animation
  • Add animations to slide to/from left/right/top/bottom

Fix width of mobile layouts

Describe the bug
Setting grid-template-columns: auto allows exceeding viewport width in layout CSS

To Reproduce
Steps to reproduce the behavior:
1.NA

Expected behavior
Width should be fixed to screen width

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot_20200617-154347

Desktop (please complete the following information):

  • OS: *
  • Browser: *
  • Version: *

Smartphone (please complete the following information):

  • Device: *
  • OS: *
  • Browser: *
  • Version: *

Additional context
Setting grid-template-columns: 100% seems to resolve this.

Implement Custom Property registration

Is your feature request related to a problem? Please describe.
Invalid custom property values can mess things up, such as registering a full background when something is for use only as a color.

Describe the solution you'd like
There are two options: CSS's @property (not yet supported) and JS's CSS.registerProperty()

Describe alternatives you've considered
Not really any alternatives that aren't highly manual.

Additional context
Sample implementation (bugs with <button type="share-button"> for some reason):

custom-properties.json

[
  {
    "name": "--default-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#343434"
  }, {
    "name": "--primary-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#fafafa"
  }, {
    "name": "--accent-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#4688f4"
  }, {
    "name": "--alt-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#fefefe"
  }, {
    "name": "--button-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#4688f4"
  }, {
    "name": "--button-background",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#4688f4"
  }, {
    "name": "--button-active-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#4688f4"
  }, {
    "name": "--button-active-background",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#5c93ea"
  }, {
    "name": "--button-disabled-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#4e4e4e"
  }, {
    "name": "--button-disabled-background",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#787878"
  }, {
    "name": "--button-padding",
    "syntax": "*",
    "inherits": true,
    "initialValue": "0.4rem"
  }, {
    "name": "--button-border-radius",
    "syntax": "<length>",
    "inherits": true,
    "initialValue": "8px"
  }, {
    "name": "--scrollbar-color",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#4688f4"
  }, {
    "name": "--scrollbar-track",
    "syntax": "<color>",
    "inherits": true,
    "initialValue": "#fafafa"
  }, {
    "name": "--desktop-rem",
    "syntax": "<length>",
    "inherits": true,
    "initialValue": "1.3vmax"
  }, {
    "name": "--tablet-rem",
    "syntax": "<length>",
    "inherits": true,
    "initialValue": "1.6vmax"
  }, {
    "name": "--mobile-rem",
    "syntax": "<length>",
    "inherits": true,
    "initialValue": "20px"
  }, {
    "name": "--main-font",
    "syntax": "<custom-ident>",
    "inherits": true,
    "initialValue": "sans-serif"
  }, {
    "name": "--title-font",
    "syntax": "<custom-ident>",
    "inherits": true,
    "initialValue": "serif"
  }, {
    "name": "--article-font",
    "syntax": "<custom-ident>",
    "inherits": true,
    "initialValue": "sans-serif"
  }
]

index.js

if (CSS.registerProperty instanceof Function) {
	fetch('/custom-properties.json').then(resp => resp.json()).then(rules => rules.forEach(({
		name,
		syntax = '*',
		inherits = false,
		initialValue = null,
	} = {}) => {
		console.info({name, syntax, inherits, initialValue});
		try {
			CSS.registerProperty({name, syntax, inherits, initialValue});
		} catch (err) {
			console.error(err);
		}
	})).catch(console.error);
}

Add :not(:defined) [slot] hiding

This allows hiding of content intended only if the element is defined, such as markers on a map. Other elements might be allowed to be visible even if not supported, so this needs to have added conditions.

Would really like to also detect support for :defined, but @supports selector () has much worse support anyways, making it useless.

Add stylesheet for Jekyll-style syntax highlighting

Grab the/a stylesheet, convert what makes sense to CSS custom properties, and try to inherit values where possible (If there is a color for numbers, floats inherit this value by custom property unless a specif value is set for floats)

Will also need to remove any pre > code colors & backgrounds from element.css

Sidebar moved in mobile-toggle-sidebar layout when open in Desktop

Describe the bug
mobile-toggle-sidebar layout applies styles to sidebar in desktop.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://ads.kernvalley.us
  2. Open Responsive Design Mode
  3. Select a mobile option
  4. Click button to open sidebar
  5. Exit Responsive Design Mode

Expected behavior
Sidebar should no longer be transformed/moved

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Fedora 29
  • Browser: Firefox
  • Version: 83

Smartphone (please complete the following information):

  • Device: Pixel 2XL
  • OS: Android 11
  • Browser: Chrome
  • Version: 87

Additional context
I think that this just needs an @media

Misc findings

  • <textarea>s in .form-group resize horizontally rather than vertically
  • .btn classes sometimes missing border rules
  • --button-primary-background-dark is not set

Update README

Need something useful here. This is one of my more useful projects, so give it all the special treatment.

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.