2.0.0-beta.1 • Published 7 months ago

@coffeekraken/sugar v2.0.0-beta.1

Weekly downloads
25
License
MIT
Repository
-
Last release
7 months ago

Sugar

Coffeekraken Sugar

npm npm npm

Sugar gives you a lot of cool stuff to enhance your codebase. It basically does nothing by default but let you grab what you want from it. It can be the colors management feature, as well as the spaces management, helper classes, etc...

We like to think about this toolkit as

A little (but powerful) sugar in your codebase

Table of content

  1. Goals
  2. Install
  3. Quick start
  4. Sass features
  5. JS features
  6. What sugar does not

Goals

The primary goal of this toolkit is to cover these needs:

  1. Give you a way to organize your codebase (colors, fonts, etc...)
    • Sugar does not tells you how your folders need to be layed out
    • Help you to stay organized inside your code - Colors - Fonts - Etc...
    • Help a lot when you need to work in team
  2. Give you access to a large number of useful mixins like:
  3. Give you access to some cool effects that you can tweak like:
  4. Provide some useful daily use javascript functions like:
  5. Provide some powerful javascript classes like:
    • SWebComponent : Base class to create webcomponent based on react methods naming (componentWillMount, componentMount, etc...)
    • SBinder : Allows you to bind object properties to another object
    • SWatcher : Allows you to monitor object properties
    • STimer : Nice little class to handle timers (start, stop, pause, onTick, etc...)
    • And many more...
  6. Plenty web components based on the SWebComponent class
    • These web components are separated into outside packages
    • Official sugar web components are published on the Coffeekraken NPM organisation
    • Well tested components

Install

npm install @coffeekraken/sugar --save

Release the kraken !!! 🦑

Quick start

Here's how to get started quickly:

SASS (scss)

// import sugar
@use "node_modules/@coffeekraken/sugar/index" as sugar;

// configure your sugar
@include sugar.setup((// configuration here...));

// init (required to be just after sugar.setup calls)
@include sugar.init();

// generate the classes if you want
@include sugar.classes();

JS

In javascript, you just need to import what you want from the toolkit like so:

import STimer from "@coffeekraken/sugar/js/class/STimer";
// etc...

Sass features

Here's a list of features that the toolkit will offer you. Don't worry, it seems like a lot, but you don't need to use all of them to start. Just pick what you need and let the rest aside...

  • Colors : Manage, organize and use colors easily - Named colors - Easy modifiers - Helper classes (optional) - And more...
  • Fonts : Keep your fonts really organized - Names fonts - Helper mixins - Helper classes (optional) - And more...
  • Typography : Full stack typography management - Helper mixins - Helper classes (optional) (lowercase, uppercase, aligns, etc...) - And more...
  • Sizes : Manage sizes ratios to keep consistent margins, etc... - Named sizes (smaller, small, default, etc...) - Fully customizable - Ratio based - And more...
  • Spaces : Full stack spaces management - Named spaces (share sizes names) - Helper classes (optional) - .m-b-small : Margin bottom small - .m-t-big : Margin top big - .p-l : Padding left (default) - Etc... - Helper mixins - And more...
  • Look and feel : Handle how your components (atoms) looks across your site - em unit based - Helper mixins - Ensure a consistent feel across your website - And more...
  • Filters : Manage and keep your filters organized - Named filters - Helper mixins - Helper classes (optional) - And more...
  • Transitions : Manage and keep your transitions organized - Named transitions - Helper mixins - Helper classes (optional) - And more...
  • And many more cool stuffs like: - A bunch of cool mixins to discover - Utils functions like : - convert : Convert from a unit to another - is : Easily advanced variables type checking - And more... - We let you discover the rest by yourself...

JS features

Sugar provide a lot of cool functions and classes that you can use inside your project. The main goal sugar try to achieve is to give you some cool tools that you can or not use. It's your choice and sugar will never force you in any way.

All the javascript capabilities of sugar are well structured and splited inside the repository so you will be able to grab only what you want from it. Here's some examples of functions and classes you might load in your project:

import whenAttribute from "@coffeekraken/sugar/js/dom/whenAttribute";
import closest from "@coffeekraken/sugar/js/dom/closest";
import whenInViewport from "@coffeekraken/sugar/js/dom/whenInViewport";
import whenAttribute from "@coffeekraken/sugar/js/dom/whenAttribute";
import closestNotVisible from "@coffeekraken/sugar/js/dom/closestNotVisible";
import SColor from "@coffeekraken/sugar/js/class/SColor";
import STimer from "@coffeekraken/sugar/js/class/STimer";
import SWebComponent from "@coffeekraken/sugar/js/core/SWebComponent";
// etc...
  • Classes : Set of useful classes like: - STimer : Handle times with nice control like start, stop, pause, etc... - SColor : Manipulate colors and access your sass registered colors - And more...
  • DOM Helpers : Set of useful DOM related functions like: - closest : Equivalent of the jQuery closest functions - whenInViewport : Let you know when an element enter the viewport the first time - whenAttribute : Let you know when an element has a specifiy attribute (or that an attribute is a string, etc...) - scrollTo : Animate the scroll to a certain element in the page - And more
  • Easings : Set of easings functions
  • Filters : Cool js filters like: - SGooeySvgFilter : Make a gooey effect like in this demo - SGradientSvgFilter : Apply an SVG gradient filter on top of any HTMLElement - SMotionblurSvgFilter : Monitor an HTMLElement movement and apply a nice motion blur accordingly
  • Features : Additional auto-applied DOM behaviors
  • Utils : Utils function for strings, colors, objects, etc... like: - throttle : Throttle a function call - isColor : Check if is a valid color - isEmail : Check if is a valid email - whenProperty : Be notified when a property exist or match a certain check function - And more...

What Sugar does not

Sugar has some goals it try to achieve, and have also some things that it does intentionally not like:

  1. Vendor prefixing your CSS
  2. Implement polyfills like webcomponent.js, etc...
    • You will need to integrate them yourself when you need to...
  3. Force you to use his features
    • Grab what you want from the toolkit, keep the rest aside...

Coffeekraken

We are a young collective of front-end creative developers with one goal in mind. Build tools to make every team working day life better. This is our first and only concern. All our tools are build around that purpose. All what we provide are some cool tools that you can use the way you want. These tools features cover a large scope of the front-end workflow (styleguide generation, colors/fonts management, etc...). You can use only the parts that you need and let the rest aside...

Coffeekraken

@coffeekraken/monorepo@coffeekraken/code-playground@infinitebrahmanuniverse/nolb-_cof@everything-registry/sub-chunk-187@zalastax/nolb-_cof@coffeekraken/s-form-style@coffeekraken/s-form-validate-feature@coffeekraken/s-front@coffeekraken/s-frontend-checker@coffeekraken/s-frontend-server@coffeekraken/s-frontspec@coffeekraken/s-markdown-builder@coffeekraken/s-media@coffeekraken/s-monorepo@coffeekraken/s-package@coffeekraken/s-panel-component@coffeekraken/s-parallax-feature@coffeekraken/s-postcss-builder@coffeekraken/s-postcss-sugar-plugin@coffeekraken/s-process@coffeekraken/s-promise@coffeekraken/s-range-component@coffeekraken/s-sugar-config@coffeekraken/s-sugar-element@coffeekraken/s-sugar-feature@coffeekraken/s-sugar-json@coffeekraken/s-theme@coffeekraken/s-theme-switcher-component@coffeekraken/s-timer@coffeekraken/button-style@coffeekraken/cli@coffeekraken/codemirror-webcomponent@coffeekraken/compile-server@coffeekraken/dialog-webcomponent@coffeekraken/drawer-webcomponent@coffeekraken/s-appear-feature@coffeekraken/s-bench@coffeekraken/s-builder@coffeekraken/s-class@coffeekraken/s-classmap@coffeekraken/s-clipboard-copy-component@coffeekraken/s-code-example-component@coffeekraken/s-code-formatter@coffeekraken/s-code-formatter-prettier@coffeekraken/s-color@coffeekraken/s-color-picker-component@coffeekraken/s-component-utils@coffeekraken/s-conductor@coffeekraken/s-config@coffeekraken/s-config-adapter@coffeekraken/s-config-folder-adapter@coffeekraken/s-data-file-js@coffeekraken/s-data-file-php@coffeekraken/s-datetime-picker-component@coffeekraken/s-descriptor@coffeekraken/s-docblock@coffeekraken/s-docmap@coffeekraken/s-duration@coffeekraken/s-env@coffeekraken/s-event-emitter@coffeekraken/s-favicon-builder@coffeekraken/s-feature@coffeekraken/s-file@coffeekraken/s-filtrable-input-component@coffeekraken/s-floating-feature@coffeekraken/s-glob@coffeekraken/s-handlebars@coffeekraken/s-images-builder@coffeekraken/s-inline-feature@coffeekraken/s-interface@coffeekraken/s-kitchen@coffeekraken/s-lit-component@coffeekraken/s-log@coffeekraken/s-page-transition-feature@coffeekraken/s-rating-component@coffeekraken/s-refocus-feature@coffeekraken/s-request@coffeekraken/s-scroll-component@coffeekraken/s-sitemap-builder@coffeekraken/s-slider-component@coffeekraken/s-state@coffeekraken/s-static-builder@coffeekraken/s-stdio@coffeekraken/dropdown-style@coffeekraken/icon-webcomponent@coffeekraken/interactive-demo-webcomponent@coffeekraken/node-blade-php@coffeekraken/notification-webcomponent@coffeekraken/pre-view@coffeekraken/s-activate-feature@coffeekraken/s-config-inline-adapter@coffeekraken/s-dashboard@coffeekraken/s-data-file-generic@coffeekraken/s-type@coffeekraken/s-typescript-builder@coffeekraken/s-typography-style@coffeekraken/s-url@coffeekraken/s-validator@coffeekraken/s-view-renderer@coffeekraken/s-view-renderer-engine-blade
2.0.0-beta.1

7 months ago

2.0.0-alpha.20

2 years ago

2.0.0-alpha.19

2 years ago

2.0.0-alpha.7

2 years ago

2.0.0-alpha.8

2 years ago

2.0.0-alpha.9

2 years ago

2.0.0-alpha.11

2 years ago

2.0.0-alpha.3

2 years ago

2.0.0-alpha.10

2 years ago

2.0.0-alpha.4

2 years ago

2.0.0-alpha.5

2 years ago

2.0.0-alpha.6

2 years ago

2.0.0-alpha.0

2 years ago

2.0.0-alpha.1

2 years ago

2.0.0-alpha.2

2 years ago

2.0.0-alpha.18

2 years ago

2.0.0-alpha.17

2 years ago

2.0.0-alpha.16

2 years ago

2.0.0-alpha.15

2 years ago

2.0.0-alpha.14

2 years ago

2.0.0-alpha.13

2 years ago

2.0.0-alpha.12

2 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago