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