8000 chore: convert all line endings to Unix (closes #5472, #5473) by jacobmllr95 · Pull Request #5474 · bootstrap-vue/bootstrap-vue · GitHub
[go: up one dir, main page]

Skip to content

chore: convert all line endings to Unix (closes #5472, #5473) #5474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/assets/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 65 additions & 65 deletions src/components/aspect/README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
# Aspect
> The `<b-aspect>` component can be used to maintain a minimum responsive aspect ratio for content.
> When the content is longer than the available height, then the component will expand vertically to
> fit all content. If the content is shorter than the computed aspect height, the component will
> ensure a minimum height is maintained.
## Overview
The default [aspect](<https://en.wikipedia.org/wiki/Aspect_ratio_(image)>) ratio is `1:1` (ratio of
`1`), which makes the height always be at least the same as the width. The `aspect` prop can be used
to specify an arbitrary aspect ratio (i.e. `1.5`) or a ratio as a string such as `'16:9'` or
`'4:3'`.
The width will always be 100% of the available width in the parent element/component.
```html
<template>
<div>
<b-form-group label="Aspect ratio" label-for="ratio" label-cols-md="auto" class="mb-3">
<b-form-select id="ratio" v-model="aspect" :options="aspects"></b-form-select>
</b-form-group>
<b-card>
<b-aspect :aspect="aspect">
This will always be an aspect of "{{ aspect }}",
except when the content is too tall.
</b-aspect>
</b-card>
</div>
</template>
<script>
export default {
data() {
return {
aspect: '16:9',
aspects: [
{ text: '4:3 (SD)', value: '4:3' },
{ text: '1:1 (Square)', value: '1:1' },
{ text: '16:9 (HD)', value: '16:9' },
{ text: '1.85:1 (Widescreen)', value: '1.85:1' },
{ text: '2:1 (Univisium/Superscope)', value: '2:1' },
{ text: '21:9 (Anamorphic)', value: '21:9' },
{ text: '1.43:1 (IMAX)', value: '1.43:1' },
{ text: '3:2 (35mm Film)', value: '3:2' },
{ text: '3:1 (APS-P)', value: '3:1' },
{ text: '4/3 (Same as 4:3)', value: 4 / 3 },
{ text: '16/9 (Same as 16:9)', value: 16 / 9 },
{ text: '3 (Same as 3:1)', value: 3 },
{ text: '2 (Same as 2:1)', value: 2 },
{ text: '1.85 (Same as 1.85:1)', value: 1.85 },
{ text: '1.5', value: 1.5 },
{ text: '1 (Same as 1:1)', value: 1 }
]
}
}
}
</script>
<!-- b-aspect.vue -->
```
## See also
- [`<b-embed>` component](/docs/components/embed) for responsive embeds (videos, iframes, etc)
# Aspect

> The `<b-aspect>` component can be used to maintain a minimum responsive aspect ratio for content.
> When the content is longer than the available height, then the component will expand vertically to
> fit all content. If the content is shorter than the computed aspect height, the component will
> ensure a minimum height is maintained.

## Overview

The default [aspect](<https://en.wikipedia.org/wiki/Aspect_ratio_(image)>) ratio is `1:1` (ratio of
`1`), which makes the height always be at least the same as the width. The `aspect` prop can be used
to specify an arbitrary aspect ratio (i.e. `1.5`) or a ratio as a string such as `'16:9'` or
`'4:3'`.

The width will always be 100% of the available width in the parent element/component.

```html
<template>
<div>
<b-form-group label="Aspect ratio" label-for="ratio" label-cols-md="auto" class="mb-3">
<b-form-select id="ratio" v-model="aspect" :options="aspects"></b-form-select>
</b-form-group>
<b-card>
<b-aspect :aspect="aspect">
This will always be an aspect of "{{ aspect }}",
except when the content is too tall.
</b-aspect>
</b-card>
</div>
</template>

<script>
export default {
data() {
return {
aspect: '16:9',
aspects: [
{ text: '4:3 (SD)', value: '4:3' },
{ text: '1:1 (Square)', value: '1:1' },
{ text: '16:9 (HD)', value: '16:9' },
{ text: '1.85:1 (Widescreen)', value: '1.85:1' },
{ text: '2:1 (Univisium/Superscope)', value: '2:1' },
{ text: '21:9 (Anamorphic)', value: '21:9' },
{ text: '1.43:1 (IMAX)', value: '1.43:1' },
{ text: '3:2 (35mm Film)', value: '3:2' },
{ text: '3:1 (APS-P)', value: '3:1' },
{ text: '4/3 (Same as 4:3)', value: 4 / 3 },
{ text: '16/9 (Same as 16:9)', value: 16 / 9 },
{ text: '3 (Same as 3:1)', value: 3 },
{ text: '2 (Same as 2:1)', value: 2 },
{ text: '1.85 (Same as 1.85:1)', value: 1.85 },
{ text: '1.5', value: 1.5 },
{ text: '1 (Same as 1:1)', value: 1 }
]
}
}
}
</script>

<!-- b-aspect.vue -->
```

## See also

- [`<b-embed>` component](/docs/components/embed) for responsive embeds (videos, iframes, etc)
118 changes: 59 additions & 59 deletions src/components/aspect/aspect.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
import Vue from '../../utils/vue'
import { mathAbs } from '../../utils/math'
import { toFloat } from '../../utils/number'
import normalizeSlotMixin from '../../mixins/normalize-slot'
// --- Constants ---
const NAME = 'BAspect'
const CLASS_NAME = 'b-aspect'
const RX_ASPECT = /^\d+(\.\d*)?[/:]\d+(\.\d*)?$/
const RX_SEPARATOR = /[/:]/
// --- Main Component ---
export const BAspect = /*#__PURE__*/ Vue.extend({
name: NAME,
mixins: [normalizeSlotMixin],
props: {
aspect: {
// Accepts a number (i.e. `16 / 9`, `1`, `4 / 3`)
// Or a string (i.e. '16/9', '16:9', '4:3' '1:1')
type: [Number, String],
default: '1:1'
},
tag: {
type: String,
default: 'div'
}
},
computed: {
padding() {
const aspect = this.aspect
let ratio = 1
if (RX_ASPECT.test(aspect)) {
// Width and/or Height can be a decimal value below `1`, so
// we only fallback to `1` if the value is `0` or `NaN`
const [width, height] = aspect.split(RX_SEPARATOR).map(v => toFloat(v) || 1)
ratio = width / height
} else {
ratio = toFloat(aspect) || 1
}
return `${100 / mathAbs(ratio)}%`
}
},
render(h) {
const $sizer = h('div', {
staticClass: `${CLASS_NAME}-sizer flex-grow-1`,
style: { paddingBottom: this.padding, height: 0 }
})
const $content = h(
'div',
{
staticClass: `${CLASS_NAME}-content flex-grow-1 w-100 mw-100`,
style: { marginLeft: '-100%' }
},
[this.normalizeSlot('default')]
)
return h(this.tag, { staticClass: `${CLASS_NAME} d-flex` }, [$sizer, $content])
}
})
import Vue from '../../utils/vue'
import { mathAbs } from '../../utils/math'
import { toFloat } from '../../utils/number'
import normalizeSlotMixin from '../../mixins/normalize-slot'

// --- Constants ---
const NAME = 'BAspect'
const CLASS_NAME = 'b-aspect'

const RX_ASPECT = /^\d+(\.\d*)?[/:]\d+(\.\d*)?$/
const RX_SEPARATOR = /[/:]/

// --- Main Component ---
export const BAspect = /*#__PURE__*/ Vue.extend({
name: NAME,
mixins: [normalizeSlotMixin],
props: {
aspect: {
// Accepts a number (i.e. `16 / 9`, `1`, `4 / 3`)
// Or a string (i.e. '16/9', '16:9', '4:3' '1:1')
type: [Number, String],
default: '1:1'
},
tag: {
type: String,
default: 'div'
}
},
computed: {
padding() {
const aspect = this.aspect
let ratio = 1
if (RX_ASPECT.test(aspect)) {
// Width and/or Height can be a decimal value below `1`, so
// we only fallback to `1` if the value is `0` or `NaN`
const [width, height] = aspect.split(RX_SEPARATOR).map(v => toFloat(v) || 1)
ratio = width / height
} else {
ratio = toFloat(aspect) || 1
}
return `${100 / mathAbs(ratio)}%`
}
},
render(h) {
const $sizer = h('div', {
staticClass: `${CLASS_NAME}-sizer flex-grow-1`,
style: { paddingBottom: this.padding, height: 0 }
})
const $content = h(
'div',
{
staticClass: `${CLASS_NAME}-content flex-grow-1 w-100 mw-100`,
style: { marginLeft: '-100%' }
},
[this.normalizeSlot('default')]
)
return h(this.tag, { staticClass: `${CLASS_NAME} d-flex` }, [$sizer, $content])
}
})
Loading
0