mediacube-ui 0.1.345 → 0.1.347
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/0.mediacube-ui.umd.js +50 -0
- package/dist/assets/img/icons.3b7d59b2f49c67a2a3a4566b8ab233fd.svg +1 -0
- package/dist/assets/img/no_table_data.236cd56f46cfb71fc363b008d4ca70d5.png +0 -0
- package/dist/assets/img/no_user.e0030d6e54e2400e1181fd22b83cf8ae.png +0 -0
- package/dist/mediacube-ui.umd.js +1 -0
- package/package.json +14 -16
- package/src/assets/icons.svg +1 -1
- package/src/assets/tokens/tokens.json +5 -0
- package/dist/mediacube-ui.common.js +0 -378
- package/src/elements/McAvatar/McAvatar.vue +0 -274
- package/src/elements/McBadge/McBadge.vue +0 -148
- package/src/elements/McButton/McButton.vue +0 -841
- package/src/elements/McChip/McChip.vue +0 -300
- package/src/elements/McCropper/McCropper.vue +0 -133
- package/src/elements/McDate/McDate.vue +0 -105
- package/src/elements/McDatePicker/McDatePicker.vue +0 -902
- package/src/elements/McField/McFieldCheckbox/McFieldCheckbox.vue +0 -332
- package/src/elements/McField/McFieldRadio/McFieldRadioButton/McFieldRadioButton.vue +0 -201
- package/src/elements/McField/McFieldRadio/McFieldRadioGroup/McFieldRadioGroup.vue +0 -194
- package/src/elements/McField/McFieldSelect/McFieldSelect.vue +0 -1087
- package/src/elements/McField/McFieldText/McFieldText.vue +0 -969
- package/src/elements/McField/McFieldToggle/McFieldToggle.vue +0 -268
- package/src/elements/McInfinityLoadingIndicator/McInfinityLoadingIndicator.vue +0 -97
- package/src/elements/McNotification/McNotification.vue +0 -209
- package/src/elements/McProgress/McProgress.vue +0 -218
- package/src/elements/McRangeSlider/McRangeSlider.vue +0 -195
- package/src/elements/McSeparator/McSeparator.vue +0 -143
- package/src/elements/McSlideUpDown/McSlideUpDown.vue +0 -157
- package/src/elements/McSvgIcon/McSvgIcon.vue +0 -127
- package/src/elements/McTabs/McTab/McTab.vue +0 -187
- package/src/elements/McTabs/McTabs/McTabs.vue +0 -531
- package/src/elements/McTitle/McTitle.vue +0 -365
- package/src/elements/McTooltip/McTooltip.vue +0 -334
- package/src/helpers/consts.js +0 -3
- package/src/helpers/delayedAction.js +0 -26
- package/src/helpers/storybookFunctions.js +0 -20
- package/src/helpers/storybookVariables.js +0 -24
- package/src/mixins/equalFieldHeight.js +0 -59
- package/src/mixins/fieldErrors.js +0 -28
- package/src/patterns/McAccordion/McAccordion.vue +0 -53
- package/src/patterns/McCells/McCell/McCell.vue +0 -101
- package/src/patterns/McChat/McChat.vue +0 -305
- package/src/patterns/McChat/McChatComment/McChatComment.vue +0 -265
- package/src/patterns/McChat/McChatForm/McChatForm.vue +0 -147
- package/src/patterns/McCollapse/McCollapse.vue +0 -280
- package/src/patterns/McDrawer/McDrawer.vue +0 -146
- package/src/patterns/McDropdown/McDropdown.vue +0 -247
- package/src/patterns/McDropdown/McDropdownPanel/McDropdownPanel.vue +0 -40
- package/src/patterns/McFakeScroll/McFakeScroll.vue +0 -277
- package/src/patterns/McFilter/McFilter.vue +0 -847
- package/src/patterns/McFilter/McFilterChip/McFilterChip.vue +0 -83
- package/src/patterns/McFilter/McFilterTags/McFilterTags.vue +0 -374
- package/src/patterns/McFilter/McFilterTypeDate/McFilterTypeDate.vue +0 -70
- package/src/patterns/McFilter/McFilterTypeRange/McFilterTypeRange.vue +0 -132
- package/src/patterns/McFilter/McFilterTypeRelation/McFilterTypeRelation.vue +0 -221
- package/src/patterns/McFilter/McFilterTypeSimple/McFilterTypeSimple.vue +0 -161
- package/src/patterns/McFilter/McFilterTypeText/McFilterTypeText.vue +0 -62
- package/src/patterns/McGrid/McGridCol/McGridCol.vue +0 -165
- package/src/patterns/McGrid/McGridRow/McGridRow.vue +0 -158
- package/src/patterns/McModal/McModal.vue +0 -680
- package/src/patterns/McOverlay/McOverlay.vue +0 -78
- package/src/patterns/McPreview/McPreview.vue +0 -118
- package/src/patterns/McSideBar/McSideBar/McSideBar.vue +0 -387
- package/src/patterns/McSideBar/McSideBarBottom/McSideBarBottom.vue +0 -125
- package/src/patterns/McSideBar/McSideBarButton/McSideBarButton.vue +0 -252
- package/src/patterns/McSideBar/McSideBarCenter/McSideBarCenter.vue +0 -367
- package/src/patterns/McSideBar/McSideBarTop/McSideBarTop.vue +0 -238
- package/src/patterns/McStack/McStack.vue +0 -158
- package/src/patterns/McTable/McTable/McTable.vue +0 -854
- package/src/patterns/McTable/McTableCol/McTableCol.vue +0 -296
- package/src/patterns/McTableCard/McTableCard.vue +0 -135
- package/src/patterns/McTableCard/McTableCardHeader/McTableCardHeader.vue +0 -74
- package/src/patterns/McTopBar/McTopBar.vue +0 -153
- package/src/patterns/McWrapScroll/McWrapScroll.vue +0 -291
- package/src/styles/_functions.scss +0 -187
- package/src/styles/_mixins.scss +0 -612
- package/src/styles/_spacing.scss +0 -33
- package/src/styles/_variables.scss +0 -23
- package/src/styles/global.scss +0 -308
- package/src/styles/main.scss +0 -4
- package/src/styles/table.scss +0 -10
- package/src/styles/toast.scss +0 -55
- package/src/templates/layouts/McContentFixed/McContentFixed.vue +0 -60
- package/src/templates/layouts/McMain/McMain.vue +0 -115
- package/src/templates/layouts/McRoot/McRoot.vue +0 -45
- package/src/tokens/animations.scss +0 -9
- package/src/tokens/border-radius.scss +0 -26
- package/src/tokens/box-shadows.scss +0 -28
- package/src/tokens/colors.scss +0 -82
- package/src/tokens/durations.scss +0 -7
- package/src/tokens/easings.scss +0 -6
- package/src/tokens/font-families.scss +0 -8
- package/src/tokens/font-sizes.scss +0 -23
- package/src/tokens/font-weights.scss +0 -9
- package/src/tokens/gradients.scss +0 -18
- package/src/tokens/letter-spacings.scss +0 -6
- package/src/tokens/line-heights.scss +0 -22
- package/src/tokens/media-queries.scss +0 -32
- package/src/tokens/opacities.scss +0 -8
- package/src/tokens/sizes.scss +0 -47
- package/src/tokens/spacings.scss +0 -38
- package/src/tokens/z-indexes.scss +0 -14
- package/src/utils/dayjs.js +0 -19
- package/src/utils/filters.js +0 -11
- package/src/utils/getTokens.js +0 -41
- package/src/utils/load-icons.js +0 -3
- package/src/utils/treeSearch.js +0 -30
- package/src/utils/webFontLoader.js +0 -12
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="tagName" :class="wrapperClasses" class="mc-wrap-scroll__wrapper">
|
|
3
|
-
<div ref="scrollContainer" :class="containerClasses" :style="containerStyles" @mousedown="onMouseDown">
|
|
4
|
-
<mc-grid-row
|
|
5
|
-
v-bind="containerProps"
|
|
6
|
-
:style="{ 'pointer-events': drag_options.is_drag ? 'none' : 'auto' }"
|
|
7
|
-
class="mc-wrap-scroll__row"
|
|
8
|
-
>
|
|
9
|
-
<slot />
|
|
10
|
-
</mc-grid-row>
|
|
11
|
-
</div>
|
|
12
|
-
</component>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import McGridRow from '../McGrid/McGridRow/McGridRow'
|
|
17
|
-
export default {
|
|
18
|
-
name: 'McWrapScroll',
|
|
19
|
-
components: {
|
|
20
|
-
McGridRow,
|
|
21
|
-
},
|
|
22
|
-
props: {
|
|
23
|
-
wrap: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: false,
|
|
26
|
-
},
|
|
27
|
-
gutterY: {
|
|
28
|
-
type: Number,
|
|
29
|
-
default: 0,
|
|
30
|
-
},
|
|
31
|
-
gutterX: {
|
|
32
|
-
type: Number,
|
|
33
|
-
default: 0,
|
|
34
|
-
},
|
|
35
|
-
justify: {
|
|
36
|
-
type: String,
|
|
37
|
-
},
|
|
38
|
-
scrollable: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
gutterBottom: {
|
|
43
|
-
type: [Number, String],
|
|
44
|
-
default: null,
|
|
45
|
-
},
|
|
46
|
-
hasScroll: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false,
|
|
49
|
-
},
|
|
50
|
-
withBlur: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false,
|
|
53
|
-
},
|
|
54
|
-
moreSpace: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: false,
|
|
57
|
-
},
|
|
58
|
-
rtl: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
scrollSpeed: {
|
|
63
|
-
type: Number,
|
|
64
|
-
default: 1,
|
|
65
|
-
},
|
|
66
|
-
tagName: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: 'div',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
data: () => ({
|
|
72
|
-
drag_options: {
|
|
73
|
-
scroll_pos: 0,
|
|
74
|
-
start_client_pos: 0,
|
|
75
|
-
distance: 0,
|
|
76
|
-
is_drag: false,
|
|
77
|
-
mouse_is_down: false,
|
|
78
|
-
},
|
|
79
|
-
show_left_blur: false,
|
|
80
|
-
show_right_blur: false,
|
|
81
|
-
observer: null,
|
|
82
|
-
}),
|
|
83
|
-
computed: {
|
|
84
|
-
containerProps() {
|
|
85
|
-
return {
|
|
86
|
-
wrap: this.wrap,
|
|
87
|
-
align: 'stretch',
|
|
88
|
-
gutterY: this.gutterY,
|
|
89
|
-
gutterX: this.gutterX,
|
|
90
|
-
justify: this.justify,
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
containerClasses() {
|
|
94
|
-
return {
|
|
95
|
-
'mc-wrap-scroll': true,
|
|
96
|
-
'mc-wrap-scroll--scrollable': this.scrollable,
|
|
97
|
-
'mc-wrap-scroll--no-scroll': !this.hasScroll,
|
|
98
|
-
'mc-wrap-scroll--more-space': this.moreSpace,
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
containerStyles() {
|
|
102
|
-
return {
|
|
103
|
-
['--mc-wrap-scroll-bottom']: `var(--space-${this.gutterBottom})`,
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
wrapperClasses() {
|
|
107
|
-
return {
|
|
108
|
-
[`mc-wrap-scroll__wrapper--left-blur`]: this.withBlur && this.show_left_blur,
|
|
109
|
-
[`mc-wrap-scroll__wrapper--right-blur`]: this.withBlur && this.show_right_blur,
|
|
110
|
-
[`mc-wrap-scroll__wrapper--more-space`]: this.moreSpace,
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
mounted() {
|
|
115
|
-
window.addEventListener('mousemove', this.onMouseMove)
|
|
116
|
-
window.addEventListener('mouseup', this.onMouseUp)
|
|
117
|
-
this.init()
|
|
118
|
-
this.$nextTick(() => this.handlerScroll())
|
|
119
|
-
},
|
|
120
|
-
beforeDestroy() {
|
|
121
|
-
window.removeEventListener('mousemove', this.onMouseMove)
|
|
122
|
-
window.removeEventListener('mouseup', this.onMouseUp)
|
|
123
|
-
this.bodyEl && this.bodyEl.removeEventListener('scroll', this.handlerScroll)
|
|
124
|
-
this.observer && this.observer.disconnect()
|
|
125
|
-
},
|
|
126
|
-
methods: {
|
|
127
|
-
init() {
|
|
128
|
-
this.bodyEl = this.$refs.scrollContainer
|
|
129
|
-
if (this.bodyEl) {
|
|
130
|
-
this.bodyEl.addEventListener('scroll', this.handlerScroll)
|
|
131
|
-
if (this.withBlur) this.createMutationObserver()
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
handlerScroll() {
|
|
135
|
-
this.$emit('content-scrolled')
|
|
136
|
-
if (!this.withBlur) return
|
|
137
|
-
try {
|
|
138
|
-
const container_width = Math.ceil(this.bodyEl.getBoundingClientRect()?.width)
|
|
139
|
-
const scroll_width = Math.ceil(this.bodyEl.scrollWidth)
|
|
140
|
-
const scroll_left = Math.ceil(this.bodyEl.scrollLeft)
|
|
141
|
-
// Левый блюр
|
|
142
|
-
this.show_left_blur = this.rtl
|
|
143
|
-
? scroll_width > container_width && scroll_width - 10 > Math.abs(scroll_left) + container_width
|
|
144
|
-
: scroll_left
|
|
145
|
-
// Правый блюр
|
|
146
|
-
this.show_right_blur = this.rtl
|
|
147
|
-
? Math.abs(scroll_left) > 1
|
|
148
|
-
: scroll_width > container_width && scroll_width > Math.abs(scroll_left) + container_width
|
|
149
|
-
} catch (e) {
|
|
150
|
-
this.$errorHandler({ e })
|
|
151
|
-
this.show_left_blur = false
|
|
152
|
-
this.show_right_blur = false
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
createMutationObserver() {
|
|
156
|
-
try {
|
|
157
|
-
this.observer = new MutationObserver(this.handlerScroll)
|
|
158
|
-
|
|
159
|
-
const config = {
|
|
160
|
-
attributes: true,
|
|
161
|
-
childList: true,
|
|
162
|
-
subtree: true,
|
|
163
|
-
}
|
|
164
|
-
this.observer.observe(this.bodyEl, config)
|
|
165
|
-
} catch (e) {
|
|
166
|
-
this.$errorHandler(
|
|
167
|
-
{
|
|
168
|
-
e,
|
|
169
|
-
},
|
|
170
|
-
() => {
|
|
171
|
-
console.error('Error when try to create observer in McWrapScroll')
|
|
172
|
-
},
|
|
173
|
-
)
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
onMouseDown(e) {
|
|
177
|
-
const dragOptions = this.drag_options
|
|
178
|
-
dragOptions.start_client_pos = e.clientX
|
|
179
|
-
dragOptions.mouse_is_down = true
|
|
180
|
-
dragOptions.scroll_pos = this.$refs.scrollContainer.scrollLeft
|
|
181
|
-
// Удалить все выделения на странице, иначе скролл "лагает" если где то на странице есть выделение
|
|
182
|
-
if (window.getSelection) {
|
|
183
|
-
let sel = window.getSelection()
|
|
184
|
-
sel.removeAllRanges()
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
onMouseMove(e) {
|
|
188
|
-
const dragOptions = this.drag_options
|
|
189
|
-
if (!dragOptions.mouse_is_down) return
|
|
190
|
-
dragOptions.distance = e.clientX - dragOptions.start_client_pos
|
|
191
|
-
if (Math.abs(dragOptions.distance) > 2 && !dragOptions.is_drag) {
|
|
192
|
-
dragOptions.is_drag = true
|
|
193
|
-
}
|
|
194
|
-
if (dragOptions.is_drag) {
|
|
195
|
-
this.$refs.scrollContainer.scrollTo({
|
|
196
|
-
left: dragOptions.scroll_pos - dragOptions.distance * this.scrollSpeed,
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
Math.abs(this.scroll_pos) && (dragOptions.scroll_pos = 0)
|
|
200
|
-
},
|
|
201
|
-
onMouseUp() {
|
|
202
|
-
this.drag_options.is_drag && (this.drag_options.is_drag = false)
|
|
203
|
-
this.drag_options.mouse_is_down = false
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
}
|
|
207
|
-
</script>
|
|
208
|
-
|
|
209
|
-
<style lang="scss">
|
|
210
|
-
@import '../../styles/mixins';
|
|
211
|
-
.mc-wrap-scroll {
|
|
212
|
-
$block-name: &;
|
|
213
|
-
$more-space-indent: $space-200;
|
|
214
|
-
--mc-wrap-scroll-bottom: #{$space-zero};
|
|
215
|
-
padding-bottom: var(--mc-wrap-scroll-bottom);
|
|
216
|
-
margin-bottom: -(var(--mc-wrap-scroll-bottom));
|
|
217
|
-
&.mc-wrap-scroll--scrollable {
|
|
218
|
-
overflow-x: auto;
|
|
219
|
-
overflow-y: hidden;
|
|
220
|
-
}
|
|
221
|
-
&--more-space {
|
|
222
|
-
padding: $more-space-indent;
|
|
223
|
-
margin: -(#{$more-space-indent});
|
|
224
|
-
}
|
|
225
|
-
&.mc-wrap-scroll--no-scroll {
|
|
226
|
-
@include hide-scrollbar();
|
|
227
|
-
}
|
|
228
|
-
&__wrapper {
|
|
229
|
-
position: relative;
|
|
230
|
-
@mixin blur-common-styles {
|
|
231
|
-
@include pseudo();
|
|
232
|
-
top: 0;
|
|
233
|
-
bottom: 0;
|
|
234
|
-
width: $space-500;
|
|
235
|
-
z-index: 2;
|
|
236
|
-
pointer-events: none;
|
|
237
|
-
user-select: none;
|
|
238
|
-
}
|
|
239
|
-
@mixin right-blur {
|
|
240
|
-
background: linear-gradient(to left, #{$color-bg-gray}, rgba($color-bg-gray, 0));
|
|
241
|
-
}
|
|
242
|
-
@mixin left-blur {
|
|
243
|
-
background: linear-gradient(to right, #{$color-bg-gray}, rgba($color-bg-gray, 0));
|
|
244
|
-
}
|
|
245
|
-
&--more-space {
|
|
246
|
-
padding: $more-space-indent;
|
|
247
|
-
margin: -(#{$more-space-indent});
|
|
248
|
-
&#{$block-name}__wrapper {
|
|
249
|
-
&--left-blur {
|
|
250
|
-
#{$block-name} {
|
|
251
|
-
padding-inline-start: 0;
|
|
252
|
-
margin-inline-start: 0;
|
|
253
|
-
}
|
|
254
|
-
&::before {
|
|
255
|
-
top: $more-space-indent;
|
|
256
|
-
bottom: $more-space-indent;
|
|
257
|
-
inset-inline-start: $more-space-indent;
|
|
258
|
-
@include left-blur;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
&--right-blur {
|
|
262
|
-
#{$block-name} {
|
|
263
|
-
padding-right: 0;
|
|
264
|
-
margin-right: 0;
|
|
265
|
-
}
|
|
266
|
-
&::after {
|
|
267
|
-
top: $more-space-indent;
|
|
268
|
-
bottom: $more-space-indent;
|
|
269
|
-
inset-inline-end: $more-space-indent;
|
|
270
|
-
@include right-blur;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
&--left-blur {
|
|
276
|
-
&::before {
|
|
277
|
-
@include blur-common-styles;
|
|
278
|
-
@include left-blur;
|
|
279
|
-
inset-inline-start: 0;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
&--right-blur {
|
|
283
|
-
&::after {
|
|
284
|
-
@include blur-common-styles;
|
|
285
|
-
@include right-blur;
|
|
286
|
-
inset-inline-end: 0;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
</style>
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/* GLOBAL FUNCTIONS
|
|
2
|
-
--------------------------------------------- */
|
|
3
|
-
|
|
4
|
-
// Create a tint
|
|
5
|
-
//
|
|
6
|
-
// @param {Color} $color to tint
|
|
7
|
-
// @param {Number} $percentage of `$color` in returned color
|
|
8
|
-
// @return {Color}
|
|
9
|
-
@function tint($color, $percentage) {
|
|
10
|
-
@return mix(white, $color, $percentage);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Create a shade
|
|
14
|
-
//
|
|
15
|
-
// @param {Color} $color to shade
|
|
16
|
-
// @param {Number} $percentage of `$color` in returned color
|
|
17
|
-
// @return {Color}
|
|
18
|
-
@function shade($color, $percentage) {
|
|
19
|
-
@return mix(black, $color, $percentage);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Calculate color difference
|
|
23
|
-
// See https://www.w3.org/TR/AERT/#color-contrast for algorithm
|
|
24
|
-
//
|
|
25
|
-
// @param {Color} $color of foreground
|
|
26
|
-
// @param {Color} $color of background
|
|
27
|
-
// @return {Boolean}
|
|
28
|
-
@function color-difference($foreground, $background) {
|
|
29
|
-
$r: (max(red($foreground), red($background))) - (min(red($foreground), red($background)));
|
|
30
|
-
$g: (max(green($foreground), green($background))) - (min(green($foreground), green($background)));
|
|
31
|
-
$b: (max(blue($foreground), blue($background))) - (min(blue($foreground), blue($background)));
|
|
32
|
-
$sum-rgb: $r + $g + $b;
|
|
33
|
-
|
|
34
|
-
@if $sum-rgb < 350 {
|
|
35
|
-
@return "false";
|
|
36
|
-
} @else {
|
|
37
|
-
@return "true";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Set text color based on contrast
|
|
42
|
-
//
|
|
43
|
-
// @param {Color} $color to set
|
|
44
|
-
// @param {Color} $background color to test
|
|
45
|
-
// @param {Color} $fallback color to set in case contrast check fails
|
|
46
|
-
@function set-text-color($color, $background, $fallback: null) {
|
|
47
|
-
@if $fallback == null {
|
|
48
|
-
$fallback: #000;
|
|
49
|
-
}
|
|
50
|
-
@if (color-difference($color, $background) == "false") {
|
|
51
|
-
@return $fallback;
|
|
52
|
-
} @else {
|
|
53
|
-
@return $color;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/// Darkens the foreground color by the background color. This is the same as the
|
|
58
|
-
/// “multiply” filter in graphics apps.
|
|
59
|
-
///
|
|
60
|
-
/// @param {Color} $foreground - The color to darken.
|
|
61
|
-
/// @param {Color} $background - The background to base darkening on.
|
|
62
|
-
/// @return {Color} The modified color.
|
|
63
|
-
@function color-multiply($foreground, $background: null) {
|
|
64
|
-
@if $background == null {
|
|
65
|
-
$background: #ffffff;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@return calc(#{$foreground} * #{$background} / 255);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/// Returns the value in rem for a given pixel value.
|
|
72
|
-
/// @param {Number} $value - The pixel value to be converted.
|
|
73
|
-
/// @return {Number} The converted value in rem.
|
|
74
|
-
@function rem($value) {
|
|
75
|
-
$unit: unit($value);
|
|
76
|
-
|
|
77
|
-
@if $unit == "rem" {
|
|
78
|
-
@return $value;
|
|
79
|
-
} @else if $unit == "px" {
|
|
80
|
-
@return calc((#{$value} / #{$font-size-300}) * 1rem);
|
|
81
|
-
} @else if $unit == "em" {
|
|
82
|
-
@return calc((#{$unit} / (1em)) * 1rem);
|
|
83
|
-
} @else {
|
|
84
|
-
@error "Value must be in px, em, or rem.";
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/// Returns the value in pixels for a given rem value.
|
|
89
|
-
/// @param {Number} $value - The rem value to be converted.
|
|
90
|
-
/// @return {Number} The converted value in pixels.
|
|
91
|
-
@function px($value) {
|
|
92
|
-
$unit: unit($value);
|
|
93
|
-
|
|
94
|
-
@if $unit == "px" {
|
|
95
|
-
@return $value;
|
|
96
|
-
} @else if $unit == "em" {
|
|
97
|
-
@return calc((#{$value} / (1em)) * #{$font-size-300});
|
|
98
|
-
} @else if $unit == "rem" {
|
|
99
|
-
@return calc((#{$value} / (1rem)) * #{$font-size-300});
|
|
100
|
-
} @else {
|
|
101
|
-
@error "Value must be in rem, em, or px.";
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/// Returns the list of available names in a given map.
|
|
106
|
-
/// @param {Map} $map - The map of data to list the names from.
|
|
107
|
-
/// @param {Number} $map - The level of depth to get names from.
|
|
108
|
-
/// @return {String} The list of names in the map.
|
|
109
|
-
@function available-names($map, $level: 1) {
|
|
110
|
-
@if type-of($map) != "map" {
|
|
111
|
-
@return null;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
$output: "";
|
|
115
|
-
$newline: "\A ";
|
|
116
|
-
|
|
117
|
-
@if $level == 1 {
|
|
118
|
-
@each $key, $value in $map {
|
|
119
|
-
$output: $output + "#{$newline}- #{$key} #{available-names($value, $level + 1)}";
|
|
120
|
-
}
|
|
121
|
-
} @else {
|
|
122
|
-
$output: "(";
|
|
123
|
-
$i: 1;
|
|
124
|
-
|
|
125
|
-
@each $key, $value in $map {
|
|
126
|
-
$sep: if($i < length($map), ", ", "");
|
|
127
|
-
$output: $output + "#{$key}#{$sep}#{available-names($value, $level + 1)}";
|
|
128
|
-
$i: $i + 1;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
$output: $output + ")";
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@return $output;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Преобразование пикселей в em на основе переменной с базовым размером шрифта
|
|
139
|
-
* (указывается в px) проекта.
|
|
140
|
-
* @param {number} $px Число без единиц измерения, кол-во пикселей
|
|
141
|
-
* @param {string} $font-size Число пикселей, размер конт. шрифта на проекте
|
|
142
|
-
* @return {string} Результат преобразования $px в em на основе $font-size
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
@function px-to-em($px, $font-size) {
|
|
146
|
-
@return calc(((#{$px} * 100 / calc(#{$font-size} / (1px))) / 100) * 1em);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Преобразование пикселей в множитель
|
|
151
|
-
* @param {number} $line-height Число без единиц измерения, высота строки
|
|
152
|
-
* @param {number} $font-size Число без единиц измерения, размер шрифта
|
|
153
|
-
* @return {number} Результат преобразования $line-height в множитель на основе $font-size
|
|
154
|
-
*/
|
|
155
|
-
@function line-height($line-height, $font-size) {
|
|
156
|
-
@return calc(round(calc((#{$line-height} / #{$font-size}) * 100)) / 100);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
@function sum($numbers...) {
|
|
160
|
-
$sum: 0;
|
|
161
|
-
@each $number in $numbers {
|
|
162
|
-
$sum: $sum + $number;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
@return $sum;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
@function diff($from, $numbers...) {
|
|
169
|
-
@each $number in $numbers {
|
|
170
|
-
$from: $from - $number;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@return $from;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
@function multiplication($from, $numbers...) {
|
|
177
|
-
@each $number in $numbers {
|
|
178
|
-
$from: $from * $number;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
@return $from;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@function swapSign($number) {
|
|
185
|
-
|
|
186
|
-
@return -$number;
|
|
187
|
-
}
|