]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add new spacing helpers
authorJeremy Thomas <bbxdesign@gmail.com>
Sun, 10 May 2020 13:47:06 +0000 (14:47 +0100)
committerJeremy Thomas <bbxdesign@gmail.com>
Sun, 17 May 2020 12:46:40 +0000 (13:46 +0100)
15 files changed:
.gitignore
sass/components/_all.sass
sass/components/list.sass
sass/helpers/_all.sass [new file with mode: 0644]
sass/helpers/color.sass [new file with mode: 0644]
sass/helpers/float.sass [new file with mode: 0644]
sass/helpers/other.sass [new file with mode: 0644]
sass/helpers/overflow.sass [new file with mode: 0644]
sass/helpers/position.sass [new file with mode: 0644]
sass/helpers/spacing.sass [new file with mode: 0644]
sass/helpers/typography.sass [new file with mode: 0644]
sass/helpers/visibility.sass [new file with mode: 0644]
sass/utilities/_all.sass
sass/utilities/derived-variables.sass [deleted file]
sass/utilities/derived-variables.scss [new file with mode: 0644]

index 0df72641f3288202016ce3a2c7a9e6b14bf88450..c3ece8e0df59149f03b4219de91bd77205a5752d 100644 (file)
@@ -3,6 +3,8 @@
 .DS_Store
 .ruby-version
 npm-debug.log
+test.css
+test.css.map
 test.html
 test.sass
 test.css
index 88fd45c5a6483fff2c493a811ea5ca78f37dd6a2..1de2c214ed00a9f759688f65c5a8c258b55f415f 100644 (file)
@@ -4,7 +4,6 @@
 @import "card.sass"
 @import "dropdown.sass"
 @import "level.sass"
-@import "list.sass"
 @import "media.sass"
 @import "menu.sass"
 @import "message.sass"
index bc99428a9a0abdb7c9d8f4b39320043ed7aa1327..23ee365de43704d4a1628d4aa18bcad4118d6476 100644 (file)
@@ -1,39 +1 @@
-$list-background-color: $scheme-main !default
-$list-shadow: 0 2px 3px rgba($scheme-invert, 0.1), 0 0 0 1px rgba($scheme-invert, 0.1) !default
-$list-radius: $radius !default
-
-$list-item-border: 1px solid $border !default
-$list-item-color: $text !default
-$list-item-active-background-color: $link !default
-$list-item-active-color: $link-invert !default
-$list-item-hover-background-color: $background !default
-
-.list
-  @extend %block
-  background-color: $list-background-color
-  border-radius: $list-radius
-  box-shadow: $list-shadow
-  // &.is-hoverable > .list-item:hover:not(.is-active)
-  //   background-color: $list-item-hover-background-color
-  //   cursor: pointer
-
-.list-item
-  display: block
-  padding: 0.5em 1em
-  &:not(a)
-    color: $list-item-color
-  &:first-child
-    border-top-left-radius: $list-radius
-    border-top-right-radius: $list-radius
-  &:last-child
-    border-bottom-left-radius: $list-radius
-    border-bottom-right-radius: $list-radius
-  &:not(:last-child)
-    border-bottom: $list-item-border
-  &.is-active
-    background-color: $list-item-active-background-color
-    color: $list-item-active-color
-
-a.list-item
-  background-color: $list-item-hover-background-color
-  cursor: pointer
+@warn "The list.sass file is DEPRECATED. Please use  sass/components/panel instead."
diff --git a/sass/helpers/_all.sass b/sass/helpers/_all.sass
new file mode 100644 (file)
index 0000000..89ef0a7
--- /dev/null
@@ -0,0 +1,10 @@
+@charset "utf-8"
+
+@import "color.sass"
+@import "float.sass"
+@import "other.sass"
+@import "overflow.sass"
+@import "position.sass"
+@import "spacing.sass"
+@import "typography.sass"
+@import "visibility.sass"
diff --git a/sass/helpers/color.sass b/sass/helpers/color.sass
new file mode 100644 (file)
index 0000000..b2e89ed
--- /dev/null
@@ -0,0 +1,16 @@
+@each $name, $pair in $colors
+  $color: nth($pair, 1)
+  .has-text-#{$name}
+    color: $color !important
+  a.has-text-#{$name}
+    &:hover,
+    &:focus
+      color: bulmaDarken($color, 10%) !important
+  .has-background-#{$name}
+    background-color: $color !important
+
+@each $name, $shade in $shades
+  .has-text-#{$name}
+    color: $shade !important
+  .has-background-#{$name}
+    background-color: $shade !important
diff --git a/sass/helpers/float.sass b/sass/helpers/float.sass
new file mode 100644 (file)
index 0000000..fc77f17
--- /dev/null
@@ -0,0 +1,8 @@
+.is-clearfix
+  +clearfix
+
+.is-pulled-left
+  float: left !important
+
+.is-pulled-right
+  float: right !important
diff --git a/sass/helpers/other.sass b/sass/helpers/other.sass
new file mode 100644 (file)
index 0000000..9aa271b
--- /dev/null
@@ -0,0 +1,8 @@
+.is-radiusless
+  border-radius: 0 !important
+
+.is-shadowless
+  box-shadow: none !important
+
+.is-unselectable
+  @extend %unselectable
diff --git a/sass/helpers/overflow.sass b/sass/helpers/overflow.sass
new file mode 100644 (file)
index 0000000..ef1e3ef
--- /dev/null
@@ -0,0 +1,2 @@
+.is-clipped
+  overflow: hidden !important
diff --git a/sass/helpers/position.sass b/sass/helpers/position.sass
new file mode 100644 (file)
index 0000000..083b36b
--- /dev/null
@@ -0,0 +1,5 @@
+.is-overlay
+  @extend %overlay
+
+.is-relative
+  position: relative !important
diff --git a/sass/helpers/spacing.sass b/sass/helpers/spacing.sass
new file mode 100644 (file)
index 0000000..03b474c
--- /dev/null
@@ -0,0 +1,28 @@
+.is-marginless
+  margin: 0 !important
+
+.is-paddingless
+  padding: 0 !important
+
+$spacing-shortcuts: ("margin": "m", "padding": "p") !default
+$spacing-directions: ("top": "t", "right": "r", "bottom": "b", "left": "l") !default
+$spacing-horizontal: "x" !default
+$spacing-vertical: "y" !default
+$spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5": 1.5rem, "6": 3rem) !default
+
+@each $property, $shortcut in $spacing-shortcuts
+  @each $direction, $suffix in $spacing-directions
+    @each $name, $value in $spacing-values
+      // Cardinal directions
+      .#{$shortcut}#{$suffix}-#{$name}
+        #{$property}-#{$direction}: $value !important
+      // Horizontal axis
+      @if $spacing-horizontal != null
+        .#{$shortcut}#{$spacing-horizontal}-#{$name}
+          #{$property}-left: $value !important
+          #{$property}-right: $value !important
+      // Vertical axis
+      @if $spacing-vertical != null
+        .#{$shortcut}#{$spacing-vertical}-#{$name}
+          #{$property}-top: $value !important
+          #{$property}-bottom: $value !important
diff --git a/sass/helpers/typography.sass b/sass/helpers/typography.sass
new file mode 100644 (file)
index 0000000..eafd7e0
--- /dev/null
@@ -0,0 +1,98 @@
+=typography-size($target:'')
+  @each $size in $sizes
+    $i: index($sizes, $size)
+    .is-size-#{$i}#{if($target == '', '', '-' + $target)}
+      font-size: $size !important
+
++typography-size()
+
++mobile
+  +typography-size('mobile')
+
++tablet
+  +typography-size('tablet')
+
++touch
+  +typography-size('touch')
+
++desktop
+  +typography-size('desktop')
+
++widescreen
+  +typography-size('widescreen')
+
++fullhd
+  +typography-size('fullhd')
+
+$alignments: ('centered': 'center', 'justified': 'justify', 'left': 'left', 'right': 'right')
+
+@each $alignment, $text-align in $alignments
+  .has-text-#{$alignment}
+    text-align: #{$text-align} !important
+
+@each $alignment, $text-align in $alignments
+  +mobile
+    .has-text-#{$alignment}-mobile
+      text-align: #{$text-align} !important
+  +tablet
+    .has-text-#{$alignment}-tablet
+      text-align: #{$text-align} !important
+  +tablet-only
+    .has-text-#{$alignment}-tablet-only
+      text-align: #{$text-align} !important
+  +touch
+    .has-text-#{$alignment}-touch
+      text-align: #{$text-align} !important
+  +desktop
+    .has-text-#{$alignment}-desktop
+      text-align: #{$text-align} !important
+  +desktop-only
+    .has-text-#{$alignment}-desktop-only
+      text-align: #{$text-align} !important
+  +widescreen
+    .has-text-#{$alignment}-widescreen
+      text-align: #{$text-align} !important
+  +widescreen-only
+    .has-text-#{$alignment}-widescreen-only
+      text-align: #{$text-align} !important
+  +fullhd
+    .has-text-#{$alignment}-fullhd
+      text-align: #{$text-align} !important
+
+.is-capitalized
+  text-transform: capitalize !important
+
+.is-lowercase
+  text-transform: lowercase !important
+
+.is-uppercase
+  text-transform: uppercase !important
+
+.is-italic
+  font-style: italic !important
+
+.has-text-weight-light
+  font-weight: $weight-light !important
+.has-text-weight-normal
+  font-weight: $weight-normal !important
+.has-text-weight-medium
+  font-weight: $weight-medium !important
+.has-text-weight-semibold
+  font-weight: $weight-semibold !important
+.has-text-weight-bold
+  font-weight: $weight-bold !important
+
+.is-family-primary
+  font-family: $family-primary !important
+
+.is-family-secondary
+  font-family: $family-secondary !important
+
+.is-family-sans-serif
+  font-family: $family-sans-serif !important
+
+.is-family-monospace
+  font-family: $family-monospace !important
+
+.is-family-code
+  font-family: $family-code !important
diff --git a/sass/helpers/visibility.sass b/sass/helpers/visibility.sass
new file mode 100644 (file)
index 0000000..92477f3
--- /dev/null
@@ -0,0 +1,122 @@
+
+
+$displays: 'block' 'flex' 'inline' 'inline-block' 'inline-flex'
+
+@each $display in $displays
+  .is-#{$display}
+    display: #{$display} !important
+  +mobile
+    .is-#{$display}-mobile
+      display: #{$display} !important
+  +tablet
+    .is-#{$display}-tablet
+      display: #{$display} !important
+  +tablet-only
+    .is-#{$display}-tablet-only
+      display: #{$display} !important
+  +touch
+    .is-#{$display}-touch
+      display: #{$display} !important
+  +desktop
+    .is-#{$display}-desktop
+      display: #{$display} !important
+  +desktop-only
+    .is-#{$display}-desktop-only
+      display: #{$display} !important
+  +widescreen
+    .is-#{$display}-widescreen
+      display: #{$display} !important
+  +widescreen-only
+    .is-#{$display}-widescreen-only
+      display: #{$display} !important
+  +fullhd
+    .is-#{$display}-fullhd
+      display: #{$display} !important
+
+.is-hidden
+  display: none !important
+
+.is-sr-only
+  border: none !important
+  clip: rect(0, 0, 0, 0) !important
+  height: 0.01em !important
+  overflow: hidden !important
+  padding: 0 !important
+  position: absolute !important
+  white-space: nowrap !important
+  width: 0.01em !important
+
++mobile
+  .is-hidden-mobile
+    display: none !important
+
++tablet
+  .is-hidden-tablet
+    display: none !important
+
++tablet-only
+  .is-hidden-tablet-only
+    display: none !important
+
++touch
+  .is-hidden-touch
+    display: none !important
+
++desktop
+  .is-hidden-desktop
+    display: none !important
+
++desktop-only
+  .is-hidden-desktop-only
+    display: none !important
+
++widescreen
+  .is-hidden-widescreen
+    display: none !important
+
++widescreen-only
+  .is-hidden-widescreen-only
+    display: none !important
+
++fullhd
+  .is-hidden-fullhd
+    display: none !important
+
+.is-invisible
+  visibility: hidden !important
+
++mobile
+  .is-invisible-mobile
+    visibility: hidden !important
+
++tablet
+  .is-invisible-tablet
+    visibility: hidden !important
+
++tablet-only
+  .is-invisible-tablet-only
+    visibility: hidden !important
+
++touch
+  .is-invisible-touch
+    visibility: hidden !important
+
++desktop
+  .is-invisible-desktop
+    visibility: hidden !important
+
++desktop-only
+  .is-invisible-desktop-only
+    visibility: hidden !important
+
++widescreen
+  .is-invisible-widescreen
+    visibility: hidden !important
+
++widescreen-only
+  .is-invisible-widescreen-only
+    visibility: hidden !important
+
++fullhd
+  .is-invisible-fullhd
+    visibility: hidden !important
index bf4ecfe3585810c5ad3b6c89bf208d8a0aa983e2..b471577c5e9e7b764915ae76eaf651ea5bdb32d7 100644 (file)
@@ -2,7 +2,7 @@
 
 @import "initial-variables.sass"
 @import "functions.sass"
-@import "derived-variables.sass"
+@import "derived-variables.scss"
 @import "animations.sass"
 @import "mixins.sass"
 @import "controls.sass"
diff --git a/sass/utilities/derived-variables.sass b/sass/utilities/derived-variables.sass
deleted file mode 100644 (file)
index 18a7f46..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-$primary: $turquoise !default
-
-$info: $cyan !default
-$success: $green !default
-$warning: $yellow !default
-$danger: $red !default
-
-$light: $white-ter !default
-$dark: $grey-darker !default
-
-// Invert colors
-
-$orange-invert: findColorInvert($orange) !default
-$yellow-invert: findColorInvert($yellow) !default
-$green-invert: findColorInvert($green) !default
-$turquoise-invert: findColorInvert($turquoise) !default
-$cyan-invert: findColorInvert($cyan) !default
-$blue-invert: findColorInvert($blue) !default
-$purple-invert: findColorInvert($purple) !default
-$red-invert: findColorInvert($red) !default
-
-$primary-invert: findColorInvert($primary) !default
-$primary-light: findLightColor($primary) !default
-$primary-dark: findDarkColor($primary) !default
-$info-invert: findColorInvert($info) !default
-$info-light: findLightColor($info) !default
-$info-dark: findDarkColor($info) !default
-$success-invert: findColorInvert($success) !default
-$success-light: findLightColor($success) !default
-$success-dark: findDarkColor($success) !default
-$warning-invert: findColorInvert($warning) !default
-$warning-light: findLightColor($warning) !default
-$warning-dark: findDarkColor($warning) !default
-$danger-invert: findColorInvert($danger) !default
-$danger-light: findLightColor($danger) !default
-$danger-dark: findDarkColor($danger) !default
-$light-invert: findColorInvert($light) !default
-$dark-invert: findColorInvert($dark) !default
-
-// General colors
-
-$scheme-main: $white !default
-$scheme-main-bis: $white-bis !default
-$scheme-main-ter: $white-ter !default
-$scheme-invert: $black !default
-$scheme-invert-bis: $black-bis !default
-$scheme-invert-ter: $black-ter !default
-
-$background: $white-ter !default
-
-$border: $grey-lighter !default
-$border-hover: $grey-light !default
-$border-light: $grey-lightest !default
-$border-light-hover: $grey-light !default
-
-// Text colors
-
-$text: $grey-dark !default
-$text-invert: findColorInvert($text) !default
-$text-light: $grey !default
-$text-strong: $grey-darker !default
-
-// Code colors
-
-$code: $red !default
-$code-background: $background !default
-
-$pre: $text !default
-$pre-background: $background !default
-
-// Link colors
-
-$link: $blue !default
-$link-invert: findColorInvert($link) !default
-$link-light: findLightColor($link) !default
-$link-dark: findDarkColor($link) !default
-$link-visited: $purple !default
-
-$link-hover: $grey-darker !default
-$link-hover-border: $grey-light !default
-
-$link-focus: $grey-darker !default
-$link-focus-border: $blue !default
-
-$link-active: $grey-darker !default
-$link-active-border: $grey-dark !default
-
-// Typography
-
-$family-primary: $family-sans-serif !default
-$family-secondary: $family-sans-serif !default
-$family-code: $family-monospace !default
-
-$size-small: $size-7 !default
-$size-normal: $size-6 !default
-$size-medium: $size-5 !default
-$size-large: $size-4 !default
-
-// Lists and maps
-$custom-colors: null !default
-$custom-shades: null !default
-
-$colors: mergeColorMaps(("white": ($white, $black), "black": ($black, $white), "light": ($light, $light-invert), "dark": ($dark, $dark-invert), "primary": ($primary, $primary-invert, $primary-light, $primary-dark), "link": ($link, $link-invert, $link-light, $link-dark), "info": ($info, $info-invert, $info-light, $info-dark), "success": ($success, $success-invert, $success-light, $success-dark), "warning": ($warning, $warning-invert, $warning-light, $warning-dark), "danger": ($danger, $danger-invert, $danger-light, $danger-dark)), $custom-colors) !default
-$shades: mergeColorMaps(("black-bis": $black-bis, "black-ter": $black-ter, "grey-darker": $grey-darker, "grey-dark": $grey-dark, "grey": $grey, "grey-light": $grey-light, "grey-lighter": $grey-lighter, "white-ter": $white-ter, "white-bis": $white-bis), $custom-shades) !default
-
-$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6 $size-7 !default
diff --git a/sass/utilities/derived-variables.scss b/sass/utilities/derived-variables.scss
new file mode 100644 (file)
index 0000000..54a0358
--- /dev/null
@@ -0,0 +1,132 @@
+$primary: $turquoise !default;
+
+$info   : $cyan !default;
+$success: $green !default;
+$warning: $yellow !default;
+$danger : $red !default;
+
+$light  : $white-ter !default;
+$dark   : $grey-darker !default;
+
+// Invert colors
+
+$orange-invert   : findColorInvert($orange) !default;
+$yellow-invert   : findColorInvert($yellow) !default;
+$green-invert    : findColorInvert($green) !default;
+$turquoise-invert: findColorInvert($turquoise) !default;
+$cyan-invert     : findColorInvert($cyan) !default;
+$blue-invert     : findColorInvert($blue) !default;
+$purple-invert   : findColorInvert($purple) !default;
+$red-invert      : findColorInvert($red) !default;
+
+$primary-invert  : findColorInvert($primary) !default;
+$primary-light   : findLightColor($primary) !default;
+$primary-dark    : findDarkColor($primary) !default;
+$info-invert     : findColorInvert($info) !default;
+$info-light      : findLightColor($info) !default;
+$info-dark       : findDarkColor($info) !default;
+$success-invert  : findColorInvert($success) !default;
+$success-light   : findLightColor($success) !default;
+$success-dark    : findDarkColor($success) !default;
+$warning-invert  : findColorInvert($warning) !default;
+$warning-light   : findLightColor($warning) !default;
+$warning-dark    : findDarkColor($warning) !default;
+$danger-invert   : findColorInvert($danger) !default;
+$danger-light    : findLightColor($danger) !default;
+$danger-dark     : findDarkColor($danger) !default;
+$light-invert    : findColorInvert($light) !default;
+$dark-invert     : findColorInvert($dark) !default;
+
+// General colors
+
+$scheme-main       : $white !default;
+$scheme-main-bis   : $white-bis !default;
+$scheme-main-ter   : $white-ter !default;
+$scheme-invert     : $black !default;
+$scheme-invert-bis : $black-bis !default;
+$scheme-invert-ter : $black-ter !default;
+
+$background        : $white-ter !default;
+
+$border            : $grey-lighter !default;
+$border-hover      : $grey-light !default;
+$border-light      : $grey-lightest !default;
+$border-light-hover: $grey-light !default;
+
+// Text colors
+
+$text       : $grey-dark !default;
+$text-invert: findColorInvert($text) !default;
+$text-light : $grey !default;
+$text-strong: $grey-darker !default;
+
+// Code colors
+
+$code           : $red !default;
+$code-background: $background !default;
+
+$pre            : $text !default;
+$pre-background : $background !default;
+
+// Link colors
+
+$link              : $blue !default;
+$link-invert       : findColorInvert($link) !default;
+$link-light        : findLightColor($link) !default;
+$link-dark         : findDarkColor($link) !default;
+$link-visited      : $purple !default;
+
+$link-hover        : $grey-darker !default;
+$link-hover-border : $grey-light !default;
+
+$link-focus        : $grey-darker !default;
+$link-focus-border : $blue !default;
+
+$link-active       : $grey-darker !default;
+$link-active-border: $grey-dark !default;
+
+// Typography
+
+$family-primary  : $family-sans-serif !default;
+$family-secondary: $family-sans-serif !default;
+$family-code     : $family-monospace !default;
+
+$size-small : $size-7 !default;
+$size-normal: $size-6 !default;
+$size-medium: $size-5 !default;
+$size-large : $size-4 !default;
+
+// Lists and maps
+$custom-colors: null !default;
+$custom-shades: null !default;
+
+$colors: mergeColorMaps(
+(
+  "white"  : ($white, $black),
+  "black"  : ($black, $white),
+  "light"  : ($light, $light-invert),
+  "dark"   : ($dark, $dark-invert),
+  "primary": ($primary, $primary-invert, $primary-light, $primary-dark),
+  "link"   : ($link, $link-invert, $link-light, $link-dark),
+  "info"   : ($info, $info-invert, $info-light, $info-dark),
+  "success": ($success, $success-invert, $success-light, $success-dark),
+  "warning": ($warning, $warning-invert, $warning-light, $warning-dark),
+  "danger" : ($danger, $danger-invert, $danger-light, $danger-dark)),
+  $custom-colors
+) !default;
+
+$shades: mergeColorMaps(
+(
+  "black-bis"   : $black-bis,
+  "black-ter"   : $black-ter,
+  "grey-darker" : $grey-darker,
+  "grey-dark"   : $grey-dark,
+  "grey"        : $grey,
+  "grey-light"  : $grey-light,
+  "grey-lighter": $grey-lighter,
+  "white-ter"   : $white-ter,
+  "white-bis"   : $white-bis),
+  $custom-shades
+) !default;
+
+$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6 $size-7 !default;