nightshade 0.2.0 → 1.0.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.npmignore DELETED
@@ -1,3 +0,0 @@
1
- assets/
2
- node_modules/
3
- index.html
package/README.md DELETED
@@ -1,128 +0,0 @@
1
- # Nightshade — base for team-specific CSS framework
2
-
3
- ## Usage
4
-
5
- Install via npm:
6
-
7
- ```
8
- npm i --save nightshade
9
- ```
10
-
11
- Import from your Stylus entry point:
12
-
13
- ```
14
- // main.styl
15
-
16
- // variable overrides go here
17
-
18
- @import 'nightshade';
19
-
20
- // your app components go there
21
- ```
22
-
23
- ## Conventions
24
-
25
- Good classnames:
26
-
27
- * `.my-component`
28
- * `.my-component-subComponent`
29
- * `.my-component--modifier`
30
-
31
- Bad classnames:
32
-
33
- * `.myComponent`, `.my_component` (prefer single delimiters styls)
34
- * `.my-component-subcomponent-subsubstuff` (too much nesting, leave up to 2 levels)
35
-
36
- Variables:
37
-
38
- * start with dollar $ (b/c Stylus emits unresolved variables as text)
39
- * use dash as name separator
40
- * name components specificity: from least specific to most specific
41
- * component variable scheme: `$what[-state]-property`
42
-
43
- Good variable names:
44
-
45
- * `$color-primary`, `$color-warning`, `$color-critical` (base variables)
46
- * `$type-small`, `$type-large` (base variables)
47
- * `$link-color`, `$link-active-color` (component variables)
48
-
49
- Selector specificity:
50
-
51
- * general rule is to avoid nesting to decrease selector weight,
52
- thus making component maintainable
53
- * some nesting does make sense, most likely the nested part is a semantic tag
54
- (e.g. `.basket h1`, `.page aside`, etc.)
55
- * good justification is actual CSS output, never nest unless that's
56
- what you would actually type into plain CSS
57
-
58
- ## Base variables
59
-
60
- Typographic essentials:
61
-
62
- * `$font-size` — base font size (applied to html, default 16px)
63
- * `$font-main` — main font stack
64
- * `$font-weight-normal` — normal font weight (default 300)
65
- * `$font-weight-bold` — normal font weight (default 600)
66
-
67
- Color scheme:
68
-
69
- * `$color-base` (backdrop, white)
70
- * `$color-default` (default ui color for buttons, input borders, etc., gray)
71
- * `$color-primary` (brand accent color)
72
- * `$color-warning` (self-explanatory, amber)
73
- * `$color-critical` (self-explanatory, blood)
74
-
75
- Typographic sizes:
76
-
77
- * `$type-larger` (1.5em)
78
- * `$type-large` (1.2em)
79
- * `$type-normal` (1em)
80
- * `$type-small` (0.85em)
81
- * `$type-smaller` (0.75em)
82
-
83
- These are used to produce modifiers (e.g. `.btn--primary`, `.btn--small`,
84
- `.color--primary`, `.type-small`, etc.).
85
-
86
- It's easy to both add/remove or override colors and sizes:
87
-
88
- ```
89
- // Let's add success and secondary to our color scheme
90
- $colors = 'base' 'default' 'primary' 'secondary' 'success' 'warning' 'critical'
91
-
92
- $color-secondary = #d43
93
- $color-secondary-text = #fff // optional, useful if contrast detector
94
- // doesn't do what you want
95
- $color-success = #3a5
96
-
97
- @import 'nightshade'
98
-
99
- // That's it! Classes like .btn--secondary and .btn--success are generated.
100
- ```
101
-
102
- ## Directory structure
103
-
104
- * core — globals
105
-
106
- * variables — base variables (component variables should reside elsewhere)
107
- * mixins
108
- * reset — mimalistic user-agent resets
109
- * base — styles for base tags: html, body, img, a, etc.
110
- * helpers — general-purpose classnames with no semantic (to be listed in Vocabulary)
111
-
112
- * components
113
-
114
- * filename === component name === toplevel classname
115
- * avoid nesting, unless nested part uses tag semantics
116
- (e.g. `.input-group input` or `.myArticle h1`)
117
- * avoid non-component classnames (bad: `.label`, `.grid .row`, `.grid .grid-cell`, good: `.grid-row`, `.grid-cell`, `.form-label`)
118
- * avoid > 2 levels of nesting (bad: `.grid-row-cell`)
119
- * it's also ok for some components to contain another components (e.g. `.ctl-group` to contain `.btn` and `.input`)
120
-
121
- ## Vocabulary
122
-
123
- Each team should maintain its own UI stencils vocabulary so that random classnames
124
- won't popup out of nowhere.
125
-
126
- Remember, the whole point of framework/spec is reducing cognitive load.
127
- Everyone should learn this vocabulary and use proper terms
128
- both in code and in communication.
@@ -1,112 +0,0 @@
1
- $btn-border-width ?= 1px;
2
-
3
- .btn {
4
- position: relative;
5
- z-index: 1;
6
-
7
- display: inline-flex;
8
- align-items: center;
9
- justify-content: center;
10
-
11
- box-sizing: border-box;
12
- padding: 0 .75em;
13
- margin: 0;
14
- border: $btn-border-width solid transparent;
15
- height: $ctl-height;
16
-
17
- vertical-align: baseline;
18
- outline: 0;
19
- cursor: pointer;
20
- touch-action: manipulation;
21
- user-select: none;
22
-
23
- border-radius: $ctl-radius;
24
- font: inherit;
25
- white-space: nowrap
26
- text-indent: 0;
27
-
28
- background: WHITE;
29
-
30
- &::-moz-focus-inner {
31
- border: 0;
32
- padding: 0;
33
- }
34
-
35
- &:active, &.active {
36
- z-index: 2;
37
- }
38
-
39
- * + * {
40
- margin-left: .5em;
41
- }
42
-
43
- }
44
-
45
- for $c in $colors {
46
- $color = lookup('$color-' + $c);
47
- $text = lookup('$color-' + $c + '-text');
48
- $border = lookup('$color-' + $c + '-border');
49
-
50
- .btn--{$c}-outline, a.btn--{$c}-outline {
51
- background: transparent;
52
- color: $color;
53
- border-color: $color;
54
-
55
- &:hover {
56
- border-color: $border;
57
- color: $border;
58
- }
59
- }
60
-
61
- .btn--{$c}, a.btn--{$c} {
62
- background: $color;
63
- color: $text;
64
- border-color: $border;
65
- border-bottom-color: darken($border, 15%);
66
-
67
- if dark($color) {
68
- text-shadow: 0 1px 1px darken($color, 15%);
69
- }
70
-
71
- &:hover {
72
- background: darken($color, 5%);
73
- }
74
-
75
- &:active, &.active {
76
- background: darken($color, 12%);
77
- border-color: darken($border, 15%);
78
- box-shadow: 0 3px 5px darken($border, 10%) inset;
79
- if dark($color) {
80
- color: #fff;
81
- text-shadow: 0 0 8px rgba(#fff, .15);
82
- }
83
- }
84
-
85
- &[disabled] {
86
- opacity: .5;
87
- background: desaturate($color, 25%);
88
- cursor: not-allowed;
89
- }
90
-
91
- }
92
-
93
- }
94
-
95
- .btn--block {
96
- display: flex;
97
- width: 100%;
98
- }
99
-
100
- // Preserve same metrics, but no visuals
101
- .btn--hollow {
102
- border: 0;
103
- background: transparent;
104
- }
105
-
106
- // Size modifiers
107
-
108
- for $s in $sizes {
109
- .btn--{$s} {
110
- font-size: lookup('$type-' + $s);
111
- }
112
- }
@@ -1,19 +0,0 @@
1
- .container {
2
- padding-left: $gap;
3
- padding-right: $gap;
4
- margin-left: auto;
5
- margin-right: auto;
6
- box-sizing: border-box;
7
- width: 100%;
8
- min-height: 0;
9
-
10
- transition: width .3s, padding .3s, min-height .3s;
11
- }
12
-
13
- @media (min-width: $screen-large-min) {
14
-
15
- .container--fixed {
16
- width: $screen-large-min;
17
- }
18
-
19
- }
@@ -1,27 +0,0 @@
1
- .ctl-group {
2
- display: inline-flex;
3
- flex-flow: row nowrap;
4
-
5
- > * {
6
- position: relative;
7
- z-index: 2;
8
- border-radius: 0;
9
- margin-left: -1px;
10
-
11
- &:first-child {
12
- margin-left: 0;
13
- border-top-left-radius: $ctl-radius;
14
- border-bottom-left-radius: $ctl-radius;
15
- }
16
-
17
- &:last-child {
18
- border-top-right-radius: $ctl-radius;
19
- border-bottom-right-radius: $ctl-radius;
20
- }
21
- }
22
-
23
- > input {
24
- z-index: 1;
25
- }
26
-
27
- }
@@ -1,84 +0,0 @@
1
- .grid {
2
- display: flex;
3
- flex-flow: row wrap;
4
- align-items: center;
5
- }
6
-
7
- .grid--top { align-items: flex-start }
8
- .grid--bottom { align-items: flex-end }
9
- .grid--baseline { align-items: baseline }
10
- .grid--stretch { align-items: stretch }
11
- .grid--distribute { justify-content: space-between }
12
- .grid--scatter { justify-content: space-around }
13
-
14
- .grid--gap {
15
- margin: -($gap / 2);
16
-
17
- &.block {
18
- margin-top: ($gap / 2);
19
- margin-bottom: ($gap / 2);
20
- }
21
-
22
- > .cell {
23
- margin: ($gap / 2);
24
- }
25
- }
26
-
27
- .cell {
28
- flex: 100%;
29
- box-sizing: border-box;
30
- min-width: 1px;
31
- }
32
-
33
- .cell--top { align-self: flex-start }
34
- .cell--bottom { align-self: flex-end }
35
- .cell--center { align-self: center }
36
- .cell--baseline { align-self: baseline }
37
- .cell--stretch { align-self: stretch }
38
-
39
- .cell--min { flex: 0 0 auto }
40
-
41
- .cell--1of1 { flex: 100% }
42
- .cell--1of2 { flex: 50% }
43
- .cell--1of3 { flex: 33.33% }
44
- .cell--2of3 { flex: 66.66% }
45
- .cell--1of4 { flex: 25% }
46
- .cell--3of4 { flex: 75% }
47
-
48
- for i in (1..8) {
49
- .cell--{i} { flex: i }
50
- }
51
-
52
- @media (min-width: $screen-medium-min) {
53
-
54
- .cell--m-min { flex: 0 0 auto}
55
-
56
- .cell--m-1of1 { flex: 100% }
57
- .cell--m-1of2 { flex: 50% }
58
- .cell--m-1of3 { flex: 33.33% }
59
- .cell--m-2of3 { flex: 66.66% }
60
- .cell--m-1of4 { flex: 25% }
61
- .cell--m-3of4 { flex: 75% }
62
-
63
- for i in (1..8) {
64
- .cell--m-{i} { flex: i }
65
- }
66
-
67
- }
68
-
69
- @media (min-width: $screen-large-min) {
70
-
71
- .cell--l-min { flex: 0 0 auto }
72
-
73
- .cell--l-1of1 { flex: 100% }
74
- .cell--l-1of2 { flex: 50% }
75
- .cell--l-1of3 { flex: 33.33% }
76
- .cell--l-2of3 { flex: 66.66% }
77
- .cell--l-1of4 { flex: 25% }
78
- .cell--l-3of4 { flex: 75% }
79
-
80
- for i in (1..8) {
81
- .cell--l-{i} { flex: i }
82
- }
83
-
84
- }
@@ -1,5 +0,0 @@
1
- @import './btn'
2
- @import './input'
3
- @import './ctl-group'
4
- @import './grid'
5
- @import './container'
@@ -1,63 +0,0 @@
1
- .input {
2
- position: relative;
3
- z-index: 1;
4
-
5
- display: inline-block;
6
- box-sizing: border-box
7
- padding: 0 .5em;
8
- height: $ctl-height;
9
-
10
- vertical-align: baseline;
11
- outline: 0;
12
-
13
- border-width: 1px;
14
- border-style: solid;
15
- border-color: $color-default-border;
16
- border-radius: $ctl-radius;
17
- background: WHITE;
18
- box-shadow: 0 1px 3px $color-default inset;
19
-
20
- &:focus {
21
- border-color: $color-primary
22
- box-shadow: 0 0 6px rgba($color-primary, .5);
23
- }
24
-
25
- &.invalid {
26
- border-color: $color-critical;
27
- box-shadow: 0 0 6px rgba($color-critical, .5);
28
- }
29
-
30
- &[disabled] {
31
- background: $color-default;
32
- color: $color-muted;
33
- }
34
-
35
- }
36
-
37
- textarea.input {
38
- height: auto;
39
- white-space: pre-wrap;
40
- resize: none;
41
- }
42
-
43
- .input--block {
44
- display: block;
45
- width: 100%;
46
- }
47
-
48
- for $s in $sizes {
49
- .input--{$s} {
50
- font-size: lookup('$type-' + $s);
51
- }
52
- }
53
-
54
- .input--hollow {
55
-
56
- &, &:focus {
57
- padding-left: 0;
58
- padding-right: 0;
59
- border: 0;
60
- background: transparent;
61
- box-shadow: none;
62
- }
63
- }
package/core/base.styl DELETED
@@ -1,82 +0,0 @@
1
- html {
2
- min-height: 100vh;
3
- font: $font-weight-normal $font-size/$line-height $font-main;
4
- text-rendering: optimizeLegibility;
5
- perspective: 1000px;
6
-
7
- color: $body-color;
8
- background: $body-background;
9
- }
10
-
11
- if ($font-antialias) {
12
- @media (-webkit-min-device-pixel-ratio: 2),
13
- (-webkit-min-device-pixel-ratio: 192),
14
- (min-resolution: 192dppx) {
15
- html {
16
- -moz-osx-font-smoothing: grayscale;
17
- -webkit-font-smoothing: antialiased;
18
- }
19
- }
20
- }
21
-
22
- a {
23
- color: $link-color;
24
- cursor: pointer;
25
-
26
- &:hover {
27
- color: lighten($link-color, 20%);
28
- }
29
- }
30
-
31
- label {
32
- cursor: pointer;
33
- }
34
-
35
- strong, .strong {
36
- font-weight: $font-weight-bold;
37
- }
38
-
39
- em, .em {
40
- font-style: italic;
41
- }
42
-
43
- strike, .strike {
44
- text-decoration: line-through
45
- }
46
-
47
- p, ul, ol, li, dl, dt, dd, figure, figcaption, table, pre {
48
- margin: $gap 0;
49
- }
50
-
51
- ul, ol {
52
- padding-left: 2em;
53
- }
54
-
55
- h1, h2, h3, h4, h5, h6 {
56
- margin: .618em 0;
57
- }
58
-
59
- h1 {
60
- font-size: 2.25rem;
61
- }
62
-
63
- h2 {
64
- font-size: 1.75rem;
65
- }
66
-
67
- h3 {
68
- font-size: 1.44rem;
69
- }
70
-
71
- h4 {
72
- font-size: 1.25rem;
73
- }
74
-
75
- pre, code {
76
- font-family: $font-code;
77
- }
78
-
79
- img {
80
- vertical-align: middle;
81
- max-width: 100%;
82
- }
package/core/helpers.styl DELETED
@@ -1,56 +0,0 @@
1
- .relative { position: relative }
2
-
3
- .block { margin: $gap 0 }
4
- .block--small { margin: $gap-small 0 }
5
- .block--large { margin: $gap-large 0 }
6
-
7
- .hidden { display: none }
8
- .no-overflow { overflow: hidden }
9
-
10
- .align-left { text-align: left }
11
- .align-center { text-align: center }
12
- .align-right { text-align: right }
13
-
14
- .screen { min-height: 100vh }
15
-
16
- // Responsive show/hide
17
-
18
- @media (max-width: $screen-small-max) {
19
- .hide-s {
20
- display: none !important
21
- }
22
- }
23
-
24
- @media (min-width: $screen-medium-min) {
25
- .show-s {
26
- display: none !important
27
- }
28
- }
29
-
30
- @media (min-width: $screen-large-min) {
31
- .hide-l {
32
- display: none !important
33
- }
34
- }
35
-
36
- @media (max-width: $screen-medium-max) {
37
- .show-l {
38
- display: none !important
39
- }
40
- }
41
-
42
- // Colors
43
-
44
- for $c in $colors {
45
- .color--{$c} {
46
- color: lookup('$color-' + $c);
47
- }
48
- }
49
-
50
- // Sized
51
-
52
- for $s in $sizes {
53
- .type--{$s} {
54
- font-size: lookup('$type-' + $s);
55
- }
56
- }
package/core/index.styl DELETED
@@ -1,6 +0,0 @@
1
- @import './swatches'
2
- @import './mixins'
3
- @import './variables'
4
- @import './reset'
5
- @import './base'
6
- @import './helpers'
package/core/mixins.styl DELETED
@@ -1,12 +0,0 @@
1
- $color-text(colr) {
2
- if (dark(colr)) {
3
- lighten(colr, 90%);
4
- } else {
5
- darken(colr, 80%);
6
- }
7
- }
8
-
9
- $color-border(colr) {
10
- shade(colr, 15%);
11
- }
12
-
package/core/reset.styl DELETED
@@ -1,32 +0,0 @@
1
- html, body, form, fieldset, img, iframe, hr {
2
- margin: 0;
3
- padding: 0;
4
- border: 0;
5
- font-size: 100%;
6
- }
7
-
8
- button, input, select, textarea,
9
- ul, ol, li, dl, dt, dd,
10
- blockquote, p {
11
- font: inherit;
12
- white-space: inherit;
13
- padding: 0;
14
- margin: 0;
15
- border: 0;
16
- }
17
-
18
- h1, h2, h3, h4, h5, h6 {
19
- font-size: inherit;
20
- font-style: inherit;
21
- font-weight: inherit;
22
- }
23
-
24
- table {
25
- border-collapse: collapse;
26
- border-spacing: 0;
27
- }
28
-
29
- a {
30
- text-decoration: none;
31
- outline: 0;
32
- }