oo-loop 1.0.2 → 1.1.0

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.
Files changed (53) hide show
  1. package/dist/loop.css +1 -1
  2. package/package.json +5 -6
  3. package/scss/_fn.scss +13 -0
  4. package/scss/_init.scss +6 -4
  5. package/scss/_loop.scss +1 -1
  6. package/scss/_pre.scss +3 -1
  7. package/scss/base/_type.scss +6 -4
  8. package/scss/components/_button.scss +16 -13
  9. package/scss/components/_column.scss +39 -34
  10. package/scss/components/_template.scss +48 -42
  11. package/scss/components/form/_checkbox.scss +8 -5
  12. package/scss/components/form/_input.scss +4 -2
  13. package/scss/components/form/_radio.scss +9 -6
  14. package/scss/components/form/_select.scss +43 -40
  15. package/scss/components/form/_toggle.scss +7 -4
  16. package/scss/functions/_color.scss +30 -16
  17. package/scss/functions/_convert.scss +24 -9
  18. package/scss/functions/_empty.scss +8 -3
  19. package/scss/functions/_extract.scss +9 -5
  20. package/scss/functions/_list.scss +9 -6
  21. package/scss/functions/_map.scss +15 -44
  22. package/scss/functions/_number.scss +16 -11
  23. package/scss/functions/_replace.scss +7 -4
  24. package/scss/functions/_split.scss +12 -8
  25. package/scss/functions/_strip.scss +3 -1
  26. package/scss/functions/_type.scss +7 -5
  27. package/scss/helpers/_container.scss +4 -2
  28. package/scss/helpers/_miscellaneous.scss +4 -2
  29. package/scss/helpers/_visibility.scss +7 -5
  30. package/scss/mixins/_breakpoint.scss +15 -10
  31. package/scss/mixins/_component.scss +19 -18
  32. package/scss/mixins/_loop.scss +13 -13
  33. package/scss/mixins/_props.scss +17 -14
  34. package/scss/mixins/_utilities.scss +21 -18
  35. package/scss/oo/_all.scss +11 -0
  36. package/scss/oo/_oo.scss +42 -0
  37. package/scss/{functions → oo}/_ooAdd.scss +9 -6
  38. package/scss/oo/_ooAlias.scss +146 -0
  39. package/scss/oo/_ooMerge.scss +41 -0
  40. package/scss/{functions → oo}/_ooParse.scss +20 -16
  41. package/scss/{functions → oo}/_ooPipe.scss +5 -3
  42. package/scss/{functions → oo}/_ooRef.scss +31 -25
  43. package/scss/{functions → oo}/_ooSet.scss +18 -13
  44. package/scss/utilities/_color.scss +3 -1
  45. package/scss/utilities/_float.scss +5 -2
  46. package/scss/utilities/_spacing.scss +3 -1
  47. package/scss/utilities/_typography.scss +3 -1
  48. package/scss/utilities/_wrapper.scss +3 -1
  49. package/CHANGELOG.md +0 -229
  50. package/scss/functions/_all.scss +0 -21
  51. package/scss/functions/_oo.scss +0 -38
  52. package/scss/functions/_ooAlias.scss +0 -96
  53. /package/scss/{functions → oo}/_ooUse.scss +0 -0
@@ -1,3 +1,8 @@
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+ @use 'sass:string';
4
+ @use '../fn';
5
+
1
6
  /// ooSet
2
7
  /// Set value in to map with the ooFormat (default $ooLoop)
3
8
  /// @param string $key ooFormat key
@@ -12,53 +17,53 @@
12
17
  }
13
18
 
14
19
  @function ooSetSoft($key, $value, $map:null) {
15
- $list: split('.', $key);
20
+ $list: fn.splitDeep('.', $key);
16
21
  $map: if($map == null, $ooLoop, $map);
17
22
 
18
23
  @if isRef($value) {
19
24
  $value: getRefValue($value, $map);
20
25
  }
21
26
 
22
- @if length($list) > 1 {
27
+ @if list.length($list) > 1 {
23
28
  $mapValue: $value;
24
- @for $i from 1 through length($list) {
25
- $mapValue: ( #{nth($list, length($list) - $i + 1)} : $mapValue );
29
+ @for $i from 1 through list.length($list) {
30
+ $mapValue: ( #{list.nth($list, list.length($list) - $i + 1)} : $mapValue );
26
31
  }
27
- $map: mapMergeDeep($map, $mapValue);
32
+ $map: ooMergeDeep($map, $mapValue);
28
33
  } @else {
29
- $map: mapMergeDeep($map, (#{$key}: $value));
34
+ $map: ooMergeDeep($map, (#{$key}: $value));
30
35
  }
31
36
 
32
37
  @return $map;
33
38
  }
34
39
 
35
40
  @function ooSetHard($key, $value, $map:null) {
36
- $list: split('.', $key);
41
+ $list: fn.splitDeep('.', $key);
37
42
  $map: if($map == null, $ooLoop, $map);
38
43
 
39
44
  @if isRef($value) {
40
45
  $value: getRefValue($value, $map);
41
46
  }
42
47
 
43
- @if length($list) > 1 {
44
- $key: replace("#{nth($list , 1)}.", '', $key);
45
- $mapValue: getMapValue($map, nth($list , 1));
48
+ @if list.length($list) > 1 {
49
+ $key: fn.replace("#{list.nth($list , 1)}.", '', $key);
50
+ $mapValue: fn.getMapValue($map, list.nth($list , 1));
46
51
 
47
52
  @if ($mapValue == null) {
48
53
  $mapValue: ();
49
54
  }
50
55
 
51
- $map: map-merge(
56
+ $map: map.merge(
52
57
  $map,
53
58
  (
54
- nth($list, 1): map-merge(
59
+ list.nth($list, 1): map.merge(
55
60
  $mapValue,
56
61
  ooSetHard($key, $value, $mapValue)
57
62
  ),
58
63
  )
59
64
  );
60
65
  } @else {
61
- $map: map-merge($map, ($key: $value));
66
+ $map: map.merge($map, ($key: $value));
62
67
  }
63
68
 
64
69
  @return $map;
@@ -1,8 +1,10 @@
1
+ @use '../fn';
2
+
1
3
  // Color Utilities
2
4
 
3
5
  @mixin Color($param: null) {
4
6
  @include initElement('color', $param);
5
- @if isNotEmpty(oo('color')) {
7
+ @if fn.isNotEmpty(oo('color')) {
6
8
  @include generateUtilities(oo('color'));
7
9
  }
8
10
  }
@@ -1,3 +1,6 @@
1
+ @use 'sass:map';
2
+ @use '../fn';
3
+
1
4
  // FLoat utilites
2
5
 
3
6
  @mixin Float($param: null) {
@@ -14,8 +17,8 @@
14
17
  }
15
18
  }
16
19
  }
17
- @if isNotEmpty(oo('float.values')) {
18
- $float: map-remove(oo('float'), 'clearfix');
20
+ @if fn.isNotEmpty(oo('float.values')) {
21
+ $float: map.remove(oo('float'), 'clearfix');
19
22
  @include generateUtilities((float: $float));
20
23
  }
21
24
  }
@@ -1,8 +1,10 @@
1
+ @use '../fn';
2
+
1
3
  // Spacing
2
4
 
3
5
  @mixin Spacing($param: null) {
4
6
  @include initElement('spacing', $param);
5
- @if isNotEmpty(oo('spacing')) {
7
+ @if fn.isNotEmpty(oo('spacing')) {
6
8
  @include generateUtilities(oo('spacing'));
7
9
  }
8
10
  }
@@ -1,8 +1,10 @@
1
+ @use '../fn';
2
+
1
3
  // Typography utilites
2
4
 
3
5
  @mixin Typography($param: null) {
4
6
  @include initElement('typo', $param);
5
- @if oo('typo') {
7
+ @if fn.isNotEmpty(oo('typo')) {
6
8
  @include generateUtilities(oo('typo'));
7
9
  }
8
10
  }
@@ -1,8 +1,10 @@
1
+ @use '../fn';
2
+
1
3
  // Wrapper
2
4
 
3
5
  @mixin Wrapper($param: null) {
4
6
  @include initElement('wrapper', $param);
5
- @if isNotEmpty(oo('wrapper')) {
7
+ @if fn.isNotEmpty(oo('wrapper')) {
6
8
  @include generateUtilities((wrapper: oo('wrapper')));
7
9
  }
8
10
  }
package/CHANGELOG.md DELETED
@@ -1,229 +0,0 @@
1
- # Loop changelog
2
-
3
- ## 1.0.2: 2022-04-04
4
-
5
- ### Fixes
6
- - Fix `pointbreak()` on rem unit
7
- - Fix generating double properties when merging custom map with camelCase `props`
8
- - Fix the lost of references when merging custom config on `init`
9
- - Bump dependencies
10
-
11
- ## 1.0.1 : 2020-07-30
12
-
13
- - Add missing `states` properties in variants
14
- - Fix rule to add any pseudo elements, states and pseudo-selectors from `props`
15
- - Bump lodash from 4.17.15 to 4.17.19
16
-
17
- ## 1.0.0
18
-
19
- ### Changes
20
- - Unify all `props` to use kebab-case css properties
21
- - `dataAttr` is set to *false* by default, back to `oo-component` from start
22
- - Form inputs components are not included by default except for `oo-input`
23
-
24
- ### Features
25
- - Add `variants` property to column
26
- - Ability to generate variants component only from the config map
27
-
28
- ## 1.0.0-beta.2
29
-
30
- - Reset properly the column to auto on breakpoint `auto@sm` `auto@md` `auto@lg`
31
-
32
- ## 1.0.0-beta.1
33
-
34
- - Fix spread operator chaining
35
- - Add option to set a size for a template area column
36
-
37
- ## 1.0.0-beta
38
-
39
- New Version implementing the single config map approach for the framework settings
40
-
41
- - Initialize Loop from `ooInit()` and launch it from `ooCreate()`
42
- - Configuration from Functions `ooSet()` `ooAdd()` `ooPipe()`
43
- - New Column and Form syntax
44
- - New Template component
45
- - New Utilities structure
46
-
47
- ## 0.4.17
48
-
49
- * Fix Radio button on IE 11
50
-
51
- ## 0.4.16
52
-
53
- * Fix radio checkmark alignment on old browser
54
-
55
- ## 0.4.15
56
-
57
- * Fix Toggle compatibility with older browser
58
-
59
- ## 0.4.14
60
-
61
- * `loopBreakpoints()` correctly generates utilities from `$breakpoints` parameter (Was always reading from global `$breakpoints-classes`)
62
-
63
- ## 0.4.13
64
-
65
- * Remove scaling on button active status to avoid adding conflict in a case where the button needs to be animated
66
-
67
- ## 0.4.12
68
-
69
- * Fix grid when it contains elements with overflow content
70
-
71
- ## 0.4.11
72
-
73
- ### Features
74
- * Ability to have a set of vertical gutters for `oo-column` via the variable `$columns-v-gutter-sizes`
75
- * Responsive v-gutter modifiers `v-gutter-${gutterName}@{breakpoint}` (assign the needed breakpoints to `$columns-v-gutter-sizes-breakpoints-classes`) see doc for more info.
76
-
77
- **Sample of use**
78
-
79
- ```html
80
- <div oo-column="row v-gutter-less v-gutter-tiny@sm v-gutter-small@md v-gutter-large@lg">
81
- <div oo-column="col"></div>
82
- <div oo-column="col"></div>
83
- <div oo-column="col"></div>
84
- </div>
85
- ```
86
-
87
- ### Changes
88
- * The variable `$anchor-color-hover` gets a darker version of `$anchor-color` as default value. (No more `$color-secondary`)
89
-
90
- ### Functions
91
- New functions available to facilitate the reuse of values coming from Map type variables
92
- * `getColors($keyName)` to get value from the `$colors` map
93
- * `getTextColors($keyName)` to get value from the `$text-colors` map
94
- * `getBgColors($keyName)` to get value from the `$bg-colors` map
95
- * `getBorderColors($keyName)` to get value from the `$border-colors` map
96
- * `getTextSizes($keyName)` to get value from the `$text-sizes` map
97
- * `getMapValue($map, $key)` get map value by passing the map to retrieve from and the name of the key . (Combination of sass functions `map-get` and `map-has-key`)
98
-
99
- ## 0.4.10
100
- * `normalize.css` has been removed from dependencies and moved to its own loop partial `loop/scss/base/_normalize.scss`
101
- * Allowing the use of loop without any javascript task runner building the css file.
102
-
103
- ## 0.4.9
104
-
105
- * Fix `Textarea` height and max-width when using `oo-form="input"`
106
- * Fix custom input paddings bug created by firefox fix from `v0.4.8`
107
-
108
- ## 0.4.8
109
-
110
- * Fix Firefox form inputs and selects (get the same height)
111
- * Fix typo, correct class name => `.container-fluid` now working
112
-
113
- ## 0.4.7
114
-
115
- ### Features
116
- * `oo-grid="areas"` Add template areas to Grid
117
- * `order-{$number}@{$breakpoint}` Add order modifier to `oo-grid="col"`
118
- * `$font-size-root` Root font-size is now modifiable (default = 62.5%)
119
- * `$spacing-ratio` Ratio to translate px into rem. Spacing generated values are rem but className still use the pixel number for better representation
120
- * `$use-grid-layout` `$use-grid-areas` `$use-grid-order` `$use-grid-gap` `$use-v-grid-gap` Variables to turn on/off the options
121
-
122
- ### Deprecated
123
- * `inArray()` function in favour of `inList()` and `InNotList()`
124
-
125
- ## 0.4.6
126
-
127
- * Ability to have responsive gutter modifiers `gutter-${gutterName}@{breakpoint}` (assign the needed breakpoints to `$columns-gutter-sizes-breakpoints-classes`) see doc for more info.
128
-
129
- **Sample of use**
130
-
131
- ```html
132
- <div oo-column="row gutter-less gutter-tiny@sm gutter-small@md gutter-large@lg">
133
- <div oo-column="col"></div>
134
- <div oo-column="col"></div>
135
- <div oo-column="col"></div>
136
- </div>
137
- ```
138
-
139
- ## 0.4.5
140
-
141
- **The column system has been reverted to the old one to avoid overloading the css file with rules**.
142
-
143
- The v0.4.4 handling the hotfix for gutters on the new column was adding 48 rules per gutter.
144
- The default gutters tiny and less were then adding 96 extra rules instead of 4 on the previous one.
145
-
146
- The ability to have different gutters makes the use of the oo-column flexible to cover lots of purposes.
147
- In a project we're working on, we're already using 5 extra gutters generating 240 more rules instead of 10
148
-
149
- Those significant numbers made us revert the changes made on v0.4.3 and v0.4.4
150
-
151
- ## 0.4.4
152
-
153
- * Recalculate the columns with the different gutters
154
-
155
- ## 0.4.3
156
-
157
- * New approach to the column system, to be able to style and apply classes to `oo-column="col-*"` without implicating the gutter.
158
-
159
- ```html
160
- <div oo-column="row">
161
- <div oo-column="col" class="bg-primary"></div>
162
- <div oo-column="col" class="border-primary"></div>
163
- </div>
164
- ```
165
-
166
- ## 0.4.2
167
-
168
- * Add `$input-focus-border-color` variable to change the color of the border on focus state
169
-
170
- ## 0.4.0
171
-
172
- ### Features
173
- * Breakpoint option to wrapper `$wrapper-breakpoints-classes` (`.wrapper-tiny@sm`...)
174
- * Handle Float utility with variables
175
- * Spacing variables `$v-spacing-from` `$v-spacing-to` `$h-spacing-from` `$h-spacing-to`
176
- * `$btn-border-color` variable added
177
- * `$btn-colors` and `$btn-outline-colors` variables added (custom colors mapType)
178
- * Function `isString` `isList` `isMap` as well as `isNotString` `isNotList` `isNotMap`
179
-
180
- ### Bug fixes
181
- * Mixin dependencies including in the mixin file
182
- * Toggle refactor
183
- * `isEmpty` correctly returning false
184
- * Grid responsive columns and rows
185
-
186
- ### Changes
187
- * Single variables `$h*-font-size` and `$heading-font-sizes-breakpoints` are not used anymore. All the sizes are set in `$heading-font-sizes` allowing map values for breakpoints.
188
- * `$heading-letter-spacing-list` replaced by `$heading-letter-spacing-tags`
189
-
190
- ### Deprecated
191
- * `.wrapper` in favor of `.wrapper-medium`
192
- * `large` `tiny` as default gutter values
193
- * `danger` `warning` `success` as default color values (let the user decide to add them)
194
- * $text-transforms `capitalize` `lowercase` as default values (let the user decide to add them)
195
- * `.text-italic` in favor of `.font-italic`
196
-
197
- ### Removals
198
- * All utility addon variabes. `$text-sizes-addon` `$text-alignments-addon` `$text-transforms-addon` `$text-decorations-addon` `$font-styles-addon` `$font-weights-addon` `$font-families-addon` `$letter-spacings-addon` `$text-colors-addon` `$bg-colors-addon` `$border-colors-addon`
199
- * `code.scss` not needed for main loop (been moved to looper)
200
- * `.disabled` not having the characteristics to be on main loop (been moved to looper)
201
- * `form="group"` too specific, not loop philosophy (been moved to looper)
202
-
203
- ## 0.3.9
204
-
205
- * Fix Radio resizing, and transition conflict (same bug as checkbox)
206
-
207
- ## 0.3.8
208
-
209
- * Fix checkbox resizing, and transition conflict
210
-
211
- ## 0.3.7
212
-
213
- * Add `normalize.css` dependency
214
-
215
- ## 0.3.6
216
-
217
- * Add `form="group"` to create input group
218
-
219
- ## 0.3.5
220
-
221
- * Added to npm as `oo-loop`
222
-
223
- ## 0.3.4
224
-
225
- * Launch Loop beta
226
-
227
- ## 0.2.0
228
-
229
- * Differentiates components from utilities
@@ -1,21 +0,0 @@
1
- @import
2
- 'type',
3
- 'empty',
4
- 'split',
5
- 'extract',
6
- 'replace',
7
- 'strip',
8
- 'number',
9
- 'color',
10
- 'list',
11
- 'map',
12
- 'convert',
13
- 'oo',
14
- 'ooSet',
15
- 'ooAdd',
16
- 'ooPipe',
17
- 'ooUse',
18
- 'ooAlias',
19
- 'ooRef',
20
- 'ooParse'
21
- ;
@@ -1,38 +0,0 @@
1
- /// oo
2
- /// Get value from a map with the ooFormat (default $ooLoop)
3
- /// @param string $key ooFormat key
4
- /// @param map|null $map the map to update (default $ooLoop)
5
- /// @return mixed
6
-
7
- @function oo($key, $map:null) {
8
- $map: if($map == null, $ooLoop, $map);
9
-
10
- // double check if quotes exist (issue with some sass version and PostCSS Parser)
11
- @if str-slice($key, 1, 1) == '"' and str-slice($key, str-length($key), - 1) == '"' {
12
- $key: str-slice($key, 2, str-length($key) - 1);
13
- }
14
-
15
- @if str-index($key, '.') == null {
16
- @return getMapValue($map, $key);
17
- }
18
-
19
- $list: split('.', $key);
20
-
21
- @for $i from 1 through length($list) {
22
- $value: getMapValue($map, nth($list, $i));
23
- @if $i == length($list) and isEmpty($value) {
24
- $value: getMapValue($map, toKebabCase(nth($list, $i)));
25
- }
26
- $map: $value;
27
- }
28
-
29
- @return $map;
30
- }
31
-
32
- /// ooPrefix
33
- /// get loop prefix
34
- /// @return string
35
-
36
- @function ooPrefix() {
37
- @return if(oo(dataAttr) == true, 'data-oo', 'oo');
38
- }
@@ -1,96 +0,0 @@
1
- $ooAlias: (
2
- (
3
- name: 'ooDarken',
4
- function: 'darken',
5
- params: ('color', 'number'),
6
- ),
7
- (
8
- name: 'ooLighten',
9
- function: 'lighten',
10
- params: ('color', 'number'),
11
- ),
12
- );
13
-
14
-
15
- // Aliases function used before init
16
-
17
- @function ooDarken($value, $percentage) {
18
- @if isNotColor($value) {
19
- @return $value;
20
- }
21
- @return darken($value, $percentage);
22
- }
23
- @function ooLighten($value, $percentage) {
24
- @if isNotColor($value) {
25
- @return $value;
26
- }
27
- @return lighten($value, $percentage);
28
- }
29
-
30
- /// isAlias
31
- /// check if a string is a sass alias function
32
- /// @param string $string the string to check
33
- /// @return bool
34
-
35
- @function isAlias($string) {
36
- @if isNotString($string) {
37
- @return false;
38
- }
39
-
40
- $isAlias: false;
41
- @each $alias in $ooAlias {
42
- $aliasName: getMapValue($alias, 'name');
43
- $aliasLength: str-length($aliasName);
44
- @if str-slice(#{$string}, 1, $aliasLength + 1) == '#{$aliasName}(' and str-slice(#{$string}, str-length(#{$string})) == ')' {
45
- $isAlias: true;
46
- }
47
- }
48
- @return $isAlias;
49
- }
50
-
51
-
52
- /// getAliasValue
53
- /// retrieve the value of an alias function
54
- /// @param string $string The complete alias function
55
- /// @param string $value Value of the 1st parameter
56
- /// @return bool
57
-
58
- /// @todo review, simplify
59
-
60
- @function getAliasValue($string, $param:null) {
61
- $currentAlias: null;
62
- $function: null;
63
- $params: split(',', inspect($string));
64
-
65
- $param1: nth($params, 1);
66
- @each $alias in $ooAlias {
67
- $aliasName: getMapValue($alias, 'name');
68
- $aliasLength: str-length($aliasName);
69
- @if str-slice($string, 1, $aliasLength) == $aliasName {
70
- $currentAlias: $alias;
71
- $function: getMapValue($alias, 'function');
72
- $param1: stripSpaces(str-slice($param1, $aliasLength + 2, str-length($param1)));
73
- @if function-exists('get-function') {
74
- $function: get-function($function);
75
- }
76
- }
77
- }
78
-
79
- $param1: if($param == null, $param1, $param);
80
-
81
- @if length($params) > 1 {
82
- $paramLeft: removeInList($params, 1);
83
- $param2: stripSpaces(str-slice(#{$paramLeft}, 1, -2));
84
-
85
- $currentAliasParams: getMapValue($currentAlias, 'params');
86
- $param1: toType(nth($currentAliasParams, 1), $param1);
87
- $param2: toType(nth($currentAliasParams, 2), $param2);
88
-
89
- @if type-of($param1) != nth($currentAliasParams, 1) or type-of($param2) != nth($currentAliasParams, 2) {
90
- @return $string;
91
- }
92
-
93
- @return call($function, $param1, $param2);
94
- }
95
- @return call($function, $param1);
96
- }
File without changes