tabulator-tables 5.4.3 → 5.4.4

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 (253) hide show
  1. package/.babelrc.json +3 -3
  2. package/.editorconfig +6 -6
  3. package/.eslintignore +3 -3
  4. package/.eslintrc.js +28 -28
  5. package/.github/ISSUE_TEMPLATE/bug_report.md +58 -58
  6. package/.github/ISSUE_TEMPLATE/documentation.md +14 -14
  7. package/.github/ISSUE_TEMPLATE/feature_request.md +24 -24
  8. package/.github/ISSUE_TEMPLATE/question.md +12 -12
  9. package/.github/workflows/bad-files-check.yml +39 -39
  10. package/.github/workflows/lint-and-test.yml +30 -30
  11. package/CODE_OF_CONDUCT.md +46 -46
  12. package/CONTRIBUTING.md +22 -22
  13. package/LICENSE +20 -20
  14. package/README.md +76 -76
  15. package/bower.json +40 -40
  16. package/build/Bundler.js +185 -185
  17. package/build/rollup.js +6 -6
  18. package/dist/css/tabulator.css +0 -5
  19. package/dist/css/tabulator.css.map +1 -1
  20. package/dist/css/tabulator.min.css +1 -1
  21. package/dist/css/tabulator.min.css.map +1 -1
  22. package/dist/css/tabulator_bootstrap3.css +0 -5
  23. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  24. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  25. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  26. package/dist/css/tabulator_bootstrap4.css +0 -5
  27. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  28. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  29. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  30. package/dist/css/tabulator_bootstrap5.css +0 -5
  31. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  32. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  33. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  34. package/dist/css/tabulator_bulma.css +0 -5
  35. package/dist/css/tabulator_bulma.css.map +1 -1
  36. package/dist/css/tabulator_bulma.min.css +1 -1
  37. package/dist/css/tabulator_bulma.min.css.map +1 -1
  38. package/dist/css/tabulator_materialize.css +0 -5
  39. package/dist/css/tabulator_materialize.css.map +1 -1
  40. package/dist/css/tabulator_materialize.min.css +1 -1
  41. package/dist/css/tabulator_materialize.min.css.map +1 -1
  42. package/dist/css/tabulator_midnight.css +0 -5
  43. package/dist/css/tabulator_midnight.css.map +1 -1
  44. package/dist/css/tabulator_midnight.min.css +1 -1
  45. package/dist/css/tabulator_midnight.min.css.map +1 -1
  46. package/dist/css/tabulator_modern.css +0 -5
  47. package/dist/css/tabulator_modern.css.map +1 -1
  48. package/dist/css/tabulator_modern.min.css +1 -1
  49. package/dist/css/tabulator_modern.min.css.map +1 -1
  50. package/dist/css/tabulator_semanticui.css +102 -107
  51. package/dist/css/tabulator_semanticui.css.map +1 -1
  52. package/dist/css/tabulator_semanticui.min.css +1 -1
  53. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  54. package/dist/css/tabulator_simple.css +0 -5
  55. package/dist/css/tabulator_simple.css.map +1 -1
  56. package/dist/css/tabulator_simple.min.css +1 -1
  57. package/dist/css/tabulator_simple.min.css.map +1 -1
  58. package/dist/css/tabulator_site.css +0 -5
  59. package/dist/css/tabulator_site.css.map +1 -1
  60. package/dist/css/tabulator_site.min.css +1 -1
  61. package/dist/css/tabulator_site.min.css.map +1 -1
  62. package/dist/js/jquery_wrapper.js +55 -55
  63. package/dist/js/tabulator.js +25847 -25711
  64. package/dist/js/tabulator.js.map +1 -1
  65. package/dist/js/tabulator.min.js +2 -2
  66. package/dist/js/tabulator.min.js.map +1 -1
  67. package/dist/js/tabulator_esm.js +25926 -25790
  68. package/dist/js/tabulator_esm.js.map +1 -1
  69. package/dist/js/tabulator_esm.min.js +2 -2
  70. package/dist/js/tabulator_esm.min.js.map +1 -1
  71. package/package.json +65 -65
  72. package/src/js/builds/esm.js +14 -14
  73. package/src/js/builds/jquery_wrapper.js +55 -55
  74. package/src/js/core/ColumnManager.js +730 -730
  75. package/src/js/core/CoreFeature.js +138 -138
  76. package/src/js/core/FooterManager.js +101 -101
  77. package/src/js/core/Module.js +141 -141
  78. package/src/js/core/RowManager.js +1112 -1101
  79. package/src/js/core/Tabulator.js +895 -892
  80. package/src/js/core/TabulatorFull.js +10 -10
  81. package/src/js/core/cell/Cell.js +295 -295
  82. package/src/js/core/cell/CellComponent.js +76 -76
  83. package/src/js/core/column/Column.js +949 -949
  84. package/src/js/core/column/ColumnComponent.js +152 -152
  85. package/src/js/core/column/defaults/options.js +17 -17
  86. package/src/js/core/defaults/options.js +65 -65
  87. package/src/js/core/modules/core.js +2 -2
  88. package/src/js/core/modules/optional.js +34 -34
  89. package/src/js/core/rendering/Renderer.js +203 -203
  90. package/src/js/core/rendering/renderers/BasicHorizontal.js +19 -19
  91. package/src/js/core/rendering/renderers/BasicVertical.js +79 -78
  92. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +577 -577
  93. package/src/js/core/rendering/renderers/VirtualDomVertical.js +579 -579
  94. package/src/js/core/row/PseudoRow.js +44 -44
  95. package/src/js/core/row/Row.js +457 -457
  96. package/src/js/core/row/RowComponent.js +93 -93
  97. package/src/js/core/tools/Alert.js +61 -61
  98. package/src/js/core/tools/ComponentFunctionBinder.js +32 -32
  99. package/src/js/core/tools/DataLoader.js +119 -119
  100. package/src/js/core/tools/DeprecationAdvisor.js +46 -46
  101. package/src/js/core/tools/ExternalEventBus.js +104 -104
  102. package/src/js/core/tools/Helpers.js +46 -46
  103. package/src/js/core/tools/InteractionMonitor.js +321 -321
  104. package/src/js/core/tools/InternalEventBus.js +161 -161
  105. package/src/js/core/tools/ModuleBinder.js +104 -104
  106. package/src/js/core/tools/OptionsList.js +44 -40
  107. package/src/js/core/tools/Popup.js +304 -304
  108. package/src/js/core/tools/TableRegistry.js +61 -61
  109. package/src/js/modules/Accessor/Accessor.js +115 -115
  110. package/src/js/modules/Ajax/Ajax.js +143 -143
  111. package/src/js/modules/Ajax/defaults/config.js +2 -2
  112. package/src/js/modules/Ajax/defaults/contentTypeFormatters.js +44 -44
  113. package/src/js/modules/Ajax/defaults/loaderPromise.js +86 -86
  114. package/src/js/modules/Ajax/defaults/urlGenerator.js +43 -43
  115. package/src/js/modules/Clipboard/Clipboard.js +279 -279
  116. package/src/js/modules/Clipboard/defaults/pasteActions.js +10 -10
  117. package/src/js/modules/Clipboard/defaults/pasteParsers.js +74 -74
  118. package/src/js/modules/ColumnCalcs/CalcComponent.js +47 -47
  119. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +581 -568
  120. package/src/js/modules/ColumnCalcs/defaults/calculations.js +85 -85
  121. package/src/js/modules/Comms/Comms.js +51 -51
  122. package/src/js/modules/DataTree/DataTree.js +603 -603
  123. package/src/js/modules/Download/Download.js +148 -148
  124. package/src/js/modules/Download/defaults/downloaders/csv.js +61 -61
  125. package/src/js/modules/Download/defaults/downloaders/html.js +4 -4
  126. package/src/js/modules/Download/defaults/downloaders/json.js +33 -33
  127. package/src/js/modules/Download/defaults/downloaders/jsonLines.js +31 -31
  128. package/src/js/modules/Download/defaults/downloaders/pdf.js +111 -111
  129. package/src/js/modules/Download/defaults/downloaders/xlsx.js +98 -98
  130. package/src/js/modules/Download/defaults/downloaders.js +14 -14
  131. package/src/js/modules/Edit/Edit.js +735 -736
  132. package/src/js/modules/Edit/List.js +1037 -1033
  133. package/src/js/modules/Edit/defaults/editors/autocomplete.js +11 -11
  134. package/src/js/modules/Edit/defaults/editors/date.js +138 -110
  135. package/src/js/modules/Edit/defaults/editors/datetime.js +125 -97
  136. package/src/js/modules/Edit/defaults/editors/input.js +76 -74
  137. package/src/js/modules/Edit/defaults/editors/list.js +6 -6
  138. package/src/js/modules/Edit/defaults/editors/number.js +109 -107
  139. package/src/js/modules/Edit/defaults/editors/progress.js +126 -126
  140. package/src/js/modules/Edit/defaults/editors/range.js +80 -78
  141. package/src/js/modules/Edit/defaults/editors/select.js +9 -9
  142. package/src/js/modules/Edit/defaults/editors/star.js +145 -145
  143. package/src/js/modules/Edit/defaults/editors/textarea.js +122 -120
  144. package/src/js/modules/Edit/defaults/editors/tickCross.js +94 -96
  145. package/src/js/modules/Edit/defaults/editors/time.js +126 -98
  146. package/src/js/modules/Edit/defaults/editors.js +28 -28
  147. package/src/js/modules/Edit/inputMask.js +73 -73
  148. package/src/js/modules/Export/Export.js +623 -623
  149. package/src/js/modules/Export/ExportColumn.js +10 -10
  150. package/src/js/modules/Export/ExportRow.js +9 -9
  151. package/src/js/modules/Filter/Filter.js +892 -892
  152. package/src/js/modules/Filter/defaults/filters.js +107 -107
  153. package/src/js/modules/Format/Format.js +212 -212
  154. package/src/js/modules/Format/defaults/formatters/buttonCross.js +2 -2
  155. package/src/js/modules/Format/defaults/formatters/buttonTick.js +2 -2
  156. package/src/js/modules/Format/defaults/formatters/color.js +3 -3
  157. package/src/js/modules/Format/defaults/formatters/datetime.js +36 -36
  158. package/src/js/modules/Format/defaults/formatters/datetimediff.js +40 -40
  159. package/src/js/modules/Format/defaults/formatters/handle.js +3 -3
  160. package/src/js/modules/Format/defaults/formatters/html.js +2 -2
  161. package/src/js/modules/Format/defaults/formatters/image.js +39 -39
  162. package/src/js/modules/Format/defaults/formatters/link.js +77 -77
  163. package/src/js/modules/Format/defaults/formatters/lookup.js +9 -9
  164. package/src/js/modules/Format/defaults/formatters/money.js +36 -36
  165. package/src/js/modules/Format/defaults/formatters/plaintext.js +2 -2
  166. package/src/js/modules/Format/defaults/formatters/progress.js +132 -132
  167. package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +43 -43
  168. package/src/js/modules/Format/defaults/formatters/rowSelection.js +59 -59
  169. package/src/js/modules/Format/defaults/formatters/rownum.js +9 -9
  170. package/src/js/modules/Format/defaults/formatters/star.js +37 -37
  171. package/src/js/modules/Format/defaults/formatters/textarea.js +3 -3
  172. package/src/js/modules/Format/defaults/formatters/tickCross.js +21 -21
  173. package/src/js/modules/Format/defaults/formatters/traffic.js +46 -46
  174. package/src/js/modules/Format/defaults/formatters.js +42 -42
  175. package/src/js/modules/FrozenColumns/FrozenColumns.js +299 -299
  176. package/src/js/modules/FrozenRows/FrozenRows.js +169 -159
  177. package/src/js/modules/GroupRows/Group.js +597 -598
  178. package/src/js/modules/GroupRows/GroupComponent.js +66 -66
  179. package/src/js/modules/GroupRows/GroupRows.js +639 -639
  180. package/src/js/modules/History/History.js +171 -171
  181. package/src/js/modules/History/defaults/redoers.js +24 -24
  182. package/src/js/modules/History/defaults/undoers.js +24 -24
  183. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +181 -181
  184. package/src/js/modules/Import/Import.js +193 -193
  185. package/src/js/modules/Import/defaults/importers/array.js +4 -4
  186. package/src/js/modules/Import/defaults/importers/csv.js +62 -62
  187. package/src/js/modules/Import/defaults/importers/json.js +7 -7
  188. package/src/js/modules/Import/defaults/importers.js +8 -8
  189. package/src/js/modules/Interaction/Interaction.js +325 -325
  190. package/src/js/modules/Keybindings/Keybindings.js +172 -172
  191. package/src/js/modules/Keybindings/defaults/actions.js +118 -118
  192. package/src/js/modules/Keybindings/defaults/bindings.js +12 -12
  193. package/src/js/modules/Layout/Layout.js +49 -49
  194. package/src/js/modules/Layout/defaults/modes/fitColumns.js +171 -171
  195. package/src/js/modules/Layout/defaults/modes/fitData.js +9 -9
  196. package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +9 -9
  197. package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +39 -39
  198. package/src/js/modules/Layout/defaults/modes.js +11 -11
  199. package/src/js/modules/Localize/Localize.js +185 -185
  200. package/src/js/modules/Localize/defaults/langs.js +36 -36
  201. package/src/js/modules/Menu/Menu.js +302 -302
  202. package/src/js/modules/MoveColumns/MoveColumns.js +299 -299
  203. package/src/js/modules/MoveRows/MoveRows.js +635 -635
  204. package/src/js/modules/Mutator/Mutator.js +161 -161
  205. package/src/js/modules/Page/Page.js +881 -881
  206. package/src/js/modules/Page/defaults/pageCounters/pages.js +32 -32
  207. package/src/js/modules/Page/defaults/pageCounters/rows.js +39 -39
  208. package/src/js/modules/Page/defaults/pageCounters.js +7 -7
  209. package/src/js/modules/Persistence/Persistence.js +458 -458
  210. package/src/js/modules/Persistence/defaults/readers.js +29 -29
  211. package/src/js/modules/Persistence/defaults/writers.js +12 -12
  212. package/src/js/modules/Popup/Popup.js +231 -231
  213. package/src/js/modules/Print/Print.js +137 -137
  214. package/src/js/modules/ReactiveData/ReactiveData.js +408 -408
  215. package/src/js/modules/ResizeColumns/ResizeColumns.js +309 -309
  216. package/src/js/modules/ResizeRows/ResizeRows.js +111 -111
  217. package/src/js/modules/ResizeTable/ResizeTable.js +159 -159
  218. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +345 -345
  219. package/src/js/modules/SelectRow/SelectRow.js +446 -444
  220. package/src/js/modules/Sort/Sort.js +470 -470
  221. package/src/js/modules/Sort/defaults/sorters/alphanum.js +43 -43
  222. package/src/js/modules/Sort/defaults/sorters/array.js +53 -53
  223. package/src/js/modules/Sort/defaults/sorters/boolean.js +6 -6
  224. package/src/js/modules/Sort/defaults/sorters/date.js +9 -9
  225. package/src/js/modules/Sort/defaults/sorters/datetime.js +43 -43
  226. package/src/js/modules/Sort/defaults/sorters/exists.js +6 -6
  227. package/src/js/modules/Sort/defaults/sorters/number.js +39 -39
  228. package/src/js/modules/Sort/defaults/sorters/string.js +33 -33
  229. package/src/js/modules/Sort/defaults/sorters/time.js +9 -9
  230. package/src/js/modules/Sort/defaults/sorters.js +20 -20
  231. package/src/js/modules/Tooltip/Tooltip.js +130 -130
  232. package/src/js/modules/Validate/Validate.js +305 -305
  233. package/src/js/modules/Validate/defaults/validators.js +138 -138
  234. package/src/scss/tabulator.scss +1464 -1467
  235. package/src/scss/themes/bootstrap/functions4.scss +118 -118
  236. package/src/scss/themes/bootstrap/functions5.scss +302 -302
  237. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +284 -284
  238. package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +544 -544
  239. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +574 -574
  240. package/src/scss/themes/bootstrap/variables3.scss +870 -870
  241. package/src/scss/themes/bootstrap/variables4.scss +930 -930
  242. package/src/scss/themes/bootstrap/variables5.scss +1641 -1641
  243. package/src/scss/themes/bulma/tabulator_bulma.scss +252 -252
  244. package/src/scss/themes/bulma/variables.scss +197 -197
  245. package/src/scss/themes/materialize/tabulator_materialize.scss +265 -265
  246. package/src/scss/themes/materialize/variables.scss +70 -70
  247. package/src/scss/themes/semanticui/tabulator_semanticui.scss +561 -561
  248. package/src/scss/themes/semanticui/variables.scss +839 -839
  249. package/src/scss/themes/semanticui/variables_table.scss +247 -247
  250. package/src/scss/themes/tabulator_midnight.scss +158 -158
  251. package/src/scss/themes/tabulator_modern.scss +231 -231
  252. package/src/scss/themes/tabulator_simple.scss +102 -102
  253. package/src/scss/themes/tabulator_site.scss +189 -189
@@ -1,302 +1,302 @@
1
- // Bootstrap functions
2
- //
3
- // Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
4
-
5
- // Ascending
6
- // Used to evaluate Sass maps like our grid breakpoints.
7
- @mixin _assert-ascending($map, $map-name) {
8
- $prev-key: null;
9
- $prev-num: null;
10
- @each $key, $num in $map {
11
- @if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
12
- // Do nothing
13
- } @else if not comparable($prev-num, $num) {
14
- @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
15
- } @else if $prev-num >= $num {
16
- @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
17
- }
18
- $prev-key: $key;
19
- $prev-num: $num;
20
- }
21
- }
22
-
23
- // Starts at zero
24
- // Used to ensure the min-width of the lowest breakpoint starts at 0.
25
- @mixin _assert-starts-at-zero($map, $map-name: "$grid-breakpoints") {
26
- @if length($map) > 0 {
27
- $values: map-values($map);
28
- $first-value: nth($values, 1);
29
- @if $first-value != 0 {
30
- @warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
31
- }
32
- }
33
- }
34
-
35
- // Colors
36
- @function to-rgb($value) {
37
- @return red($value), green($value), blue($value);
38
- }
39
-
40
- // stylelint-disable scss/dollar-variable-pattern
41
- @function rgba-css-var($identifier, $target) {
42
- @if $identifier == "body" and $target == "bg" {
43
- @return rgba(var(--#{$variable-prefix}#{$identifier}-bg-rgb), var(--#{$variable-prefix}#{$target}-opacity));
44
- } @if $identifier == "body" and $target == "text" {
45
- @return rgba(var(--#{$variable-prefix}#{$identifier}-color-rgb), var(--#{$variable-prefix}#{$target}-opacity));
46
- } @else {
47
- @return rgba(var(--#{$variable-prefix}#{$identifier}-rgb), var(--#{$variable-prefix}#{$target}-opacity));
48
- }
49
- }
50
-
51
- @function map-loop($map, $func, $args...) {
52
- $_map: ();
53
-
54
- @each $key, $value in $map {
55
- // allow to pass the $key and $value of the map as an function argument
56
- $_args: ();
57
- @each $arg in $args {
58
- $_args: append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
59
- }
60
-
61
- $_map: map-merge($_map, ($key: call(get-function($func), $_args...)));
62
- }
63
-
64
- @return $_map;
65
- }
66
- // stylelint-enable scss/dollar-variable-pattern
67
-
68
- @function varify($list) {
69
- $result: null;
70
- @each $entry in $list {
71
- $result: append($result, var(--#{$variable-prefix}#{$entry}), space);
72
- }
73
- @return $result;
74
- }
75
-
76
- // Internal Bootstrap function to turn maps into its negative variant.
77
- // It prefixes the keys with `n` and makes the value negative.
78
- @function negativify-map($map) {
79
- $result: ();
80
- @each $key, $value in $map {
81
- @if $key != 0 {
82
- $result: map-merge($result, ("n" + $key: (-$value)));
83
- }
84
- }
85
- @return $result;
86
- }
87
-
88
- // Get multiple keys from a sass map
89
- @function map-get-multiple($map, $values) {
90
- $result: ();
91
- @each $key, $value in $map {
92
- @if (index($values, $key) != null) {
93
- $result: map-merge($result, ($key: $value));
94
- }
95
- }
96
- @return $result;
97
- }
98
-
99
- // Merge multiple maps
100
- @function map-merge-multiple($maps...) {
101
- $merged-maps: ();
102
-
103
- @each $map in $maps {
104
- $merged-maps: map-merge($merged-maps, $map);
105
- }
106
- @return $merged-maps;
107
- }
108
-
109
- // Replace `$search` with `$replace` in `$string`
110
- // Used on our SVG icon backgrounds for custom forms.
111
- //
112
- // @author Hugo Giraudel
113
- // @param {String} $string - Initial string
114
- // @param {String} $search - Substring to replace
115
- // @param {String} $replace ('') - New value
116
- // @return {String} - Updated string
117
- @function str-replace($string, $search, $replace: "") {
118
- $index: str-index($string, $search);
119
-
120
- @if $index {
121
- @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
122
- }
123
-
124
- @return $string;
125
- }
126
-
127
- // See https://codepen.io/kevinweber/pen/dXWoRw
128
- //
129
- // Requires the use of quotes around data URIs.
130
-
131
- @function escape-svg($string) {
132
- @if str-index($string, "data:image/svg+xml") {
133
- @each $char, $encoded in $escaped-characters {
134
- // Do not escape the url brackets
135
- @if str-index($string, "url(") == 1 {
136
- $string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
137
- } @else {
138
- $string: str-replace($string, $char, $encoded);
139
- }
140
- }
141
- }
142
-
143
- @return $string;
144
- }
145
-
146
- // Color contrast
147
- // See https://github.com/twbs/bootstrap/pull/30168
148
-
149
- // A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
150
- // stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
151
- $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
152
-
153
- @function color-contrast($background, $color-contrast-dark: $color-contrast-dark, $color-contrast-light: $color-contrast-light, $min-contrast-ratio: $min-contrast-ratio) {
154
- $foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
155
- $max-ratio: 0;
156
- $max-ratio-color: null;
157
-
158
- @each $color in $foregrounds {
159
- $contrast-ratio: contrast-ratio($background, $color);
160
- @if $contrast-ratio > $min-contrast-ratio {
161
- @return $color;
162
- } @else if $contrast-ratio > $max-ratio {
163
- $max-ratio: $contrast-ratio;
164
- $max-ratio-color: $color;
165
- }
166
- }
167
-
168
- @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}...";
169
-
170
- @return $max-ratio-color;
171
- }
172
-
173
- @function contrast-ratio($background, $foreground: $color-contrast-light) {
174
- $l1: luminance($background);
175
- $l2: luminance(opaque($background, $foreground));
176
-
177
- @return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
178
- }
179
-
180
- // Return WCAG2.0 relative luminance
181
- // See https://www.w3.org/WAI/GL/wiki/Relative_luminance
182
- // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
183
- @function luminance($color) {
184
- $rgb: (
185
- "r": red($color),
186
- "g": green($color),
187
- "b": blue($color)
188
- );
189
-
190
- @each $name, $value in $rgb {
191
- $value: if(divide($value, 255) < .03928, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
192
- $rgb: map-merge($rgb, ($name: $value));
193
- }
194
-
195
- @return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
196
- }
197
-
198
- // Return opaque color
199
- // opaque(#fff, rgba(0, 0, 0, .5)) => #808080
200
- @function opaque($background, $foreground) {
201
- @return mix(rgba($foreground, 1), $background, opacity($foreground) * 100);
202
- }
203
-
204
- // scss-docs-start color-functions
205
- // Tint a color: mix a color with white
206
- @function tint-color($color, $weight) {
207
- @return mix(white, $color, $weight);
208
- }
209
-
210
- // Shade a color: mix a color with black
211
- @function shade-color($color, $weight) {
212
- @return mix(black, $color, $weight);
213
- }
214
-
215
- // Shade the color if the weight is positive, else tint it
216
- @function shift-color($color, $weight) {
217
- @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
218
- }
219
- // scss-docs-end color-functions
220
-
221
- // Return valid calc
222
- @function add($value1, $value2, $return-calc: true) {
223
- @if $value1 == null {
224
- @return $value2;
225
- }
226
-
227
- @if $value2 == null {
228
- @return $value1;
229
- }
230
-
231
- @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
232
- @return $value1 + $value2;
233
- }
234
-
235
- @return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
236
- }
237
-
238
- @function subtract($value1, $value2, $return-calc: true) {
239
- @if $value1 == null and $value2 == null {
240
- @return null;
241
- }
242
-
243
- @if $value1 == null {
244
- @return -$value2;
245
- }
246
-
247
- @if $value2 == null {
248
- @return $value1;
249
- }
250
-
251
- @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
252
- @return $value1 - $value2;
253
- }
254
-
255
- @if type-of($value2) != number {
256
- $value2: unquote("(") + $value2 + unquote(")");
257
- }
258
-
259
- @return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
260
- }
261
-
262
- @function divide($dividend, $divisor, $precision: 10) {
263
- $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
264
- $dividend: abs($dividend);
265
- $divisor: abs($divisor);
266
- @if $dividend == 0 {
267
- @return 0;
268
- }
269
- @if $divisor == 0 {
270
- @error "Cannot divide by 0";
271
- }
272
- $remainder: $dividend;
273
- $result: 0;
274
- $factor: 10;
275
- @while ($remainder > 0 and $precision >= 0) {
276
- $quotient: 0;
277
- @while ($remainder >= $divisor) {
278
- $remainder: $remainder - $divisor;
279
- $quotient: $quotient + 1;
280
- }
281
- $result: $result * 10 + $quotient;
282
- $factor: $factor * .1;
283
- $remainder: $remainder * 10;
284
- $precision: $precision - 1;
285
- @if ($precision < 0 and $remainder >= $divisor * 5) {
286
- $result: $result + 1;
287
- }
288
- }
289
- $result: $result * $factor * $sign;
290
- $dividend-unit: unit($dividend);
291
- $divisor-unit: unit($divisor);
292
- $unit-map: (
293
- "px": 1px,
294
- "rem": 1rem,
295
- "em": 1em,
296
- "%": 1%
297
- );
298
- @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
299
- $result: $result * map-get($unit-map, $dividend-unit);
300
- }
301
- @return $result;
302
- }
1
+ // Bootstrap functions
2
+ //
3
+ // Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
4
+
5
+ // Ascending
6
+ // Used to evaluate Sass maps like our grid breakpoints.
7
+ @mixin _assert-ascending($map, $map-name) {
8
+ $prev-key: null;
9
+ $prev-num: null;
10
+ @each $key, $num in $map {
11
+ @if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
12
+ // Do nothing
13
+ } @else if not comparable($prev-num, $num) {
14
+ @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
15
+ } @else if $prev-num >= $num {
16
+ @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
17
+ }
18
+ $prev-key: $key;
19
+ $prev-num: $num;
20
+ }
21
+ }
22
+
23
+ // Starts at zero
24
+ // Used to ensure the min-width of the lowest breakpoint starts at 0.
25
+ @mixin _assert-starts-at-zero($map, $map-name: "$grid-breakpoints") {
26
+ @if length($map) > 0 {
27
+ $values: map-values($map);
28
+ $first-value: nth($values, 1);
29
+ @if $first-value != 0 {
30
+ @warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
31
+ }
32
+ }
33
+ }
34
+
35
+ // Colors
36
+ @function to-rgb($value) {
37
+ @return red($value), green($value), blue($value);
38
+ }
39
+
40
+ // stylelint-disable scss/dollar-variable-pattern
41
+ @function rgba-css-var($identifier, $target) {
42
+ @if $identifier == "body" and $target == "bg" {
43
+ @return rgba(var(--#{$variable-prefix}#{$identifier}-bg-rgb), var(--#{$variable-prefix}#{$target}-opacity));
44
+ } @if $identifier == "body" and $target == "text" {
45
+ @return rgba(var(--#{$variable-prefix}#{$identifier}-color-rgb), var(--#{$variable-prefix}#{$target}-opacity));
46
+ } @else {
47
+ @return rgba(var(--#{$variable-prefix}#{$identifier}-rgb), var(--#{$variable-prefix}#{$target}-opacity));
48
+ }
49
+ }
50
+
51
+ @function map-loop($map, $func, $args...) {
52
+ $_map: ();
53
+
54
+ @each $key, $value in $map {
55
+ // allow to pass the $key and $value of the map as an function argument
56
+ $_args: ();
57
+ @each $arg in $args {
58
+ $_args: append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
59
+ }
60
+
61
+ $_map: map-merge($_map, ($key: call(get-function($func), $_args...)));
62
+ }
63
+
64
+ @return $_map;
65
+ }
66
+ // stylelint-enable scss/dollar-variable-pattern
67
+
68
+ @function varify($list) {
69
+ $result: null;
70
+ @each $entry in $list {
71
+ $result: append($result, var(--#{$variable-prefix}#{$entry}), space);
72
+ }
73
+ @return $result;
74
+ }
75
+
76
+ // Internal Bootstrap function to turn maps into its negative variant.
77
+ // It prefixes the keys with `n` and makes the value negative.
78
+ @function negativify-map($map) {
79
+ $result: ();
80
+ @each $key, $value in $map {
81
+ @if $key != 0 {
82
+ $result: map-merge($result, ("n" + $key: (-$value)));
83
+ }
84
+ }
85
+ @return $result;
86
+ }
87
+
88
+ // Get multiple keys from a sass map
89
+ @function map-get-multiple($map, $values) {
90
+ $result: ();
91
+ @each $key, $value in $map {
92
+ @if (index($values, $key) != null) {
93
+ $result: map-merge($result, ($key: $value));
94
+ }
95
+ }
96
+ @return $result;
97
+ }
98
+
99
+ // Merge multiple maps
100
+ @function map-merge-multiple($maps...) {
101
+ $merged-maps: ();
102
+
103
+ @each $map in $maps {
104
+ $merged-maps: map-merge($merged-maps, $map);
105
+ }
106
+ @return $merged-maps;
107
+ }
108
+
109
+ // Replace `$search` with `$replace` in `$string`
110
+ // Used on our SVG icon backgrounds for custom forms.
111
+ //
112
+ // @author Hugo Giraudel
113
+ // @param {String} $string - Initial string
114
+ // @param {String} $search - Substring to replace
115
+ // @param {String} $replace ('') - New value
116
+ // @return {String} - Updated string
117
+ @function str-replace($string, $search, $replace: "") {
118
+ $index: str-index($string, $search);
119
+
120
+ @if $index {
121
+ @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
122
+ }
123
+
124
+ @return $string;
125
+ }
126
+
127
+ // See https://codepen.io/kevinweber/pen/dXWoRw
128
+ //
129
+ // Requires the use of quotes around data URIs.
130
+
131
+ @function escape-svg($string) {
132
+ @if str-index($string, "data:image/svg+xml") {
133
+ @each $char, $encoded in $escaped-characters {
134
+ // Do not escape the url brackets
135
+ @if str-index($string, "url(") == 1 {
136
+ $string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
137
+ } @else {
138
+ $string: str-replace($string, $char, $encoded);
139
+ }
140
+ }
141
+ }
142
+
143
+ @return $string;
144
+ }
145
+
146
+ // Color contrast
147
+ // See https://github.com/twbs/bootstrap/pull/30168
148
+
149
+ // A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
150
+ // stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
151
+ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
152
+
153
+ @function color-contrast($background, $color-contrast-dark: $color-contrast-dark, $color-contrast-light: $color-contrast-light, $min-contrast-ratio: $min-contrast-ratio) {
154
+ $foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
155
+ $max-ratio: 0;
156
+ $max-ratio-color: null;
157
+
158
+ @each $color in $foregrounds {
159
+ $contrast-ratio: contrast-ratio($background, $color);
160
+ @if $contrast-ratio > $min-contrast-ratio {
161
+ @return $color;
162
+ } @else if $contrast-ratio > $max-ratio {
163
+ $max-ratio: $contrast-ratio;
164
+ $max-ratio-color: $color;
165
+ }
166
+ }
167
+
168
+ @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}...";
169
+
170
+ @return $max-ratio-color;
171
+ }
172
+
173
+ @function contrast-ratio($background, $foreground: $color-contrast-light) {
174
+ $l1: luminance($background);
175
+ $l2: luminance(opaque($background, $foreground));
176
+
177
+ @return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
178
+ }
179
+
180
+ // Return WCAG2.0 relative luminance
181
+ // See https://www.w3.org/WAI/GL/wiki/Relative_luminance
182
+ // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
183
+ @function luminance($color) {
184
+ $rgb: (
185
+ "r": red($color),
186
+ "g": green($color),
187
+ "b": blue($color)
188
+ );
189
+
190
+ @each $name, $value in $rgb {
191
+ $value: if(divide($value, 255) < .03928, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
192
+ $rgb: map-merge($rgb, ($name: $value));
193
+ }
194
+
195
+ @return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
196
+ }
197
+
198
+ // Return opaque color
199
+ // opaque(#fff, rgba(0, 0, 0, .5)) => #808080
200
+ @function opaque($background, $foreground) {
201
+ @return mix(rgba($foreground, 1), $background, opacity($foreground) * 100);
202
+ }
203
+
204
+ // scss-docs-start color-functions
205
+ // Tint a color: mix a color with white
206
+ @function tint-color($color, $weight) {
207
+ @return mix(white, $color, $weight);
208
+ }
209
+
210
+ // Shade a color: mix a color with black
211
+ @function shade-color($color, $weight) {
212
+ @return mix(black, $color, $weight);
213
+ }
214
+
215
+ // Shade the color if the weight is positive, else tint it
216
+ @function shift-color($color, $weight) {
217
+ @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
218
+ }
219
+ // scss-docs-end color-functions
220
+
221
+ // Return valid calc
222
+ @function add($value1, $value2, $return-calc: true) {
223
+ @if $value1 == null {
224
+ @return $value2;
225
+ }
226
+
227
+ @if $value2 == null {
228
+ @return $value1;
229
+ }
230
+
231
+ @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
232
+ @return $value1 + $value2;
233
+ }
234
+
235
+ @return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
236
+ }
237
+
238
+ @function subtract($value1, $value2, $return-calc: true) {
239
+ @if $value1 == null and $value2 == null {
240
+ @return null;
241
+ }
242
+
243
+ @if $value1 == null {
244
+ @return -$value2;
245
+ }
246
+
247
+ @if $value2 == null {
248
+ @return $value1;
249
+ }
250
+
251
+ @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
252
+ @return $value1 - $value2;
253
+ }
254
+
255
+ @if type-of($value2) != number {
256
+ $value2: unquote("(") + $value2 + unquote(")");
257
+ }
258
+
259
+ @return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
260
+ }
261
+
262
+ @function divide($dividend, $divisor, $precision: 10) {
263
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
264
+ $dividend: abs($dividend);
265
+ $divisor: abs($divisor);
266
+ @if $dividend == 0 {
267
+ @return 0;
268
+ }
269
+ @if $divisor == 0 {
270
+ @error "Cannot divide by 0";
271
+ }
272
+ $remainder: $dividend;
273
+ $result: 0;
274
+ $factor: 10;
275
+ @while ($remainder > 0 and $precision >= 0) {
276
+ $quotient: 0;
277
+ @while ($remainder >= $divisor) {
278
+ $remainder: $remainder - $divisor;
279
+ $quotient: $quotient + 1;
280
+ }
281
+ $result: $result * 10 + $quotient;
282
+ $factor: $factor * .1;
283
+ $remainder: $remainder * 10;
284
+ $precision: $precision - 1;
285
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
286
+ $result: $result + 1;
287
+ }
288
+ }
289
+ $result: $result * $factor * $sign;
290
+ $dividend-unit: unit($dividend);
291
+ $divisor-unit: unit($divisor);
292
+ $unit-map: (
293
+ "px": 1px,
294
+ "rem": 1rem,
295
+ "em": 1em,
296
+ "%": 1%
297
+ );
298
+ @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
299
+ $result: $result * map-get($unit-map, $dividend-unit);
300
+ }
301
+ @return $result;
302
+ }