Content-Length: 650608 | pFad | http://github.com/bootstrap-vue/bootstrap-vue/pull/6141/files

EF feat(refactor): code enhancements for easier Vue 3 migration (closes #6124, #6139) by jacobmllr95 · Pull Request #6141 · bootstrap-vue/bootstrap-vue · GitHub
Skip to content

feat(refactor): code enhancements for easier Vue 3 migration (closes #6124, #6139) #6141

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 73 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1593500
feat(refactor): code improvements for easier Vue 3 migration
jacobmllr95 Dec 6, 2020
10025b0
Merge branch 'dev' into feat-code-enhancements
jacobmllr95 Dec 6, 2020
6b24488
chore(deps): regenerate lockfile
jacobmllr95 Dec 6, 2020
16d9423
fix(build): add missing `package.json` files for private components
jacobmllr95 Dec 6, 2020
411bf07
chore: bump BundleWatch values
jacobmllr95 Dec 6, 2020
26d05dd
Update progress-bar.js
jacobmllr95 Dec 6, 2020
918f582
Update tab.js
jacobmllr95 Dec 6, 2020
09085b3
Update bv-tooltip-template.js
jacobmllr95 Dec 6, 2020
735537d
Update props.js
jacobmllr95 Dec 6, 2020
97e5c20
Update props.spec.js
jacobmllr95 Dec 6, 2020
01207f1
Update tabs.js
jacobmllr95 Dec 6, 2020
5603883
Update tab.js
jacobmllr95 Dec 6, 2020
f07a3f7
Update progress-bar.js
jacobmllr95 Dec 6, 2020
47eaf6a
Update tbody.js
jacobmllr95 Dec 6, 2020
d6ac48b
Update td.js
jacobmllr95 Dec 6, 2020
7cbd170
Update tfoot.js
jacobmllr95 Dec 6, 2020
ba640fa
Update thead.js
jacobmllr95 Dec 6, 2020
f5fa9bc
Update tr.js
jacobmllr95 Dec 6, 2020
f154c96
Update time.js
jacobmllr95 Dec 6, 2020
ddad5fc
Update bv-tooltip-template.js
jacobmllr95 Dec 6, 2020
e0c295b
Update form-radio-check.js
jacobmllr95 Dec 6, 2020
f2ef5f5
Update collapse.js
jacobmllr95 Dec 6, 2020
fe9c20b
Update collapse.js
jacobmllr95 Dec 6, 2020
316c57c
Update form-radio-check.js
jacobmllr95 Dec 6, 2020
4917dc3
Update form-radio.js
jacobmllr95 Dec 6, 2020
6bbf6b2
Update safe-types.js
jacobmllr95 Dec 6, 2020
d052d23
Update common-props.json
jacobmllr95 Dec 6, 2020
91d5610
Update package.json
jacobmllr95 Dec 6, 2020
b7636cf
Update package.json
jacobmllr95 Dec 6, 2020
fd2416a
chore: alphabetically sort component meta information
jacobmllr95 Dec 6, 2020
348d506
chore(refactor): add `slots` constants for all slot names
jacobmllr95 Dec 6, 2020
5517eb0
Update safe-types.js
jacobmllr95 Dec 6, 2020
a2fa666
Update README.md
jacobmllr95 Dec 6, 2020
91911d0
Update avatar.js
jacobmllr95 Dec 6, 2020
9867966
Update alert.js
jacobmllr95 Dec 6, 2020
08de62a
Update form-radio-check.js
jacobmllr95 Dec 6, 2020
e3df0c3
chore(docs): add `ariaControls` to common props
jacobmllr95 Dec 6, 2020
fb6dbee
Update form-datepicker.js
jacobmllr95 Dec 7, 2020
7b95a93
Update form-timepicker.js
jacobmllr95 Dec 7, 2020
1b06fa3
Update componentdoc.vue
jacobmllr95 Dec 7, 2020
745f8b5
chore(refactor): move all custom event names to `events` constants
jacobmllr95 Dec 7, 2020
6faef1f
Update dropdown.js
jacobmllr95 Dec 7, 2020
852eb71
Update slots.js
jacobmllr95 Dec 7, 2020
3d6b935
Update form-spinbutton.js
jacobmllr95 Dec 7, 2020
5f39a22
Update form-rating.js
jacobmllr95 Dec 7, 2020
e192bc8
Update modal.js
jacobmllr95 Dec 7, 2020
cdb9a47
Update sidebar.js
jacobmllr95 Dec 7, 2020
8c27564
Update slots.js
jacobmllr95 Dec 7, 2020
678fe55
Update pagination.js
jacobmllr95 Dec 7, 2020
7b9da13
Update pagination.js
jacobmllr95 Dec 7, 2020
13c25df
chore(docs): add missing documentation for slots
jacobmllr95 Dec 7, 2020
19850f0
Update package.json
jacobmllr95 Dec 7, 2020
58c8310
Update componentdoc.vue
jacobmllr95 Dec 7, 2020
ca454ce
feat(popover/tooltip): use `normalizeSlotMixin`
jacobmllr95 Dec 7, 2020
cef708c
Update card-img-lazy.js
jacobmllr95 Dec 7, 2020
92fdf1c
Update package.json
jacobmllr95 Dec 7, 2020
d525e35
Update package.json
jacobmllr95 Dec 7, 2020
36f0f2d
chore(docs): improve prop XSS warnings
jacobmllr95 Dec 7, 2020
5adc0e6
Update package.json
jacobmllr95 Dec 7, 2020
e0d9a3f
Update bv-tooltip-template.js
jacobmllr95 Dec 7, 2020
a776499
Update bv-popover-template.js
jacobmllr95 Dec 7, 2020
132b76a
Update bv-tooltip-template.js
jacobmllr95 Dec 7, 2020
72190c5
Update bv-popper.js
jacobmllr95 Dec 7, 2020
3bd5b06
fix: `required` prop handling
jacobmllr95 Dec 7, 2020
1b2c38b
Update tooltip.js
jacobmllr95 Dec 7, 2020
f13a3d2
Merge remote-tracking branch 'origen/dev' into feat-code-enhancements
jacobmllr95 Dec 7, 2020
5e559a4
Merge branch 'dev' into feat-code-enhancements
jacobmllr95 Dec 7, 2020
f8b961f
Update form-text.js
jacobmllr95 Dec 7, 2020
f7d6c67
Update form-file.js
jacobmllr95 Dec 7, 2020
40a17e9
Update form-input.js
jacobmllr95 Dec 7, 2020
c901856
Update form-text.js
jacobmllr95 Dec 7, 2020
41ff28b
Merge remote-tracking branch 'origen/dev' into feat-code-enhancements
jacobmllr95 Dec 7, 2020
a910295
Update index.js
jacobmllr95 Dec 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"files": [
{
"path": "./dist/bootstrap-vue-icons.js",
"maxSize": "115 kB"
"maxSize": "120 kB"
},
{
"path": "./dist/bootstrap-vue-icons.min.js",
"maxSize": "105 kB"
"maxSize": "110 kB"
},
{
"path": "./dist/bootstrap-vue-icons.common.js",
Expand All @@ -18,7 +18,7 @@
},
{
"path": "./dist/bootstrap-vue-icons.esm.js",
"maxSize": "115 kB"
"maxSize": "120 kB"
},
{
"path": "./dist/bootstrap-vue-icons.esm.min.js",
Expand Down
311 changes: 159 additions & 152 deletions docs/common-props.json

Large diffs are not rendered by default.

100 changes: 53 additions & 47 deletions docs/components/componentdoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ import commonProps from '../common-props.json'
import { getComponentName, getCleanComponentName, kebabCase } from '../utils'
import AnchoredHeading from './anchored-heading'

const SORT_THRESHOLD = 10

export default {
name: 'BVComponentdoc',
components: { AnchoredHeading },
Expand Down Expand Up @@ -393,34 +395,36 @@ export default {
}, {})
},
propsFields() {
const sortable = this.propsItems.length >= 10
const sortable = this.propsItems.length >= SORT_THRESHOLD
const hasDescriptions = this.propsItems.some(p => p.description)
return [
{ key: 'prop', label: 'Property', sortable },
{ key: 'type', label: 'Type' },
{ key: 'type', label: 'Type', sortable },
{ key: 'defaultValue', label: 'Default' },
...(hasDescriptions ? [{ key: 'description', label: 'Description' }] : [])
]
},
eventsFields() {
const sortable = this.events.length >= SORT_THRESHOLD
return [
{ key: 'event', label: 'Event' },
{ key: 'event', label: 'Event', sortable },
{ key: 'args', label: 'Arguments' },
{ key: 'description', label: 'Description' }
]
},
rootEventListenersFields() {
const sortable = this.rootEventListeners.length >= SORT_THRESHOLD
return [
{ key: 'event', label: 'Event' },
{ key: 'event', label: 'Event', sortable },
{ key: 'args', label: 'Arguments' },
{ key: 'description', label: 'Description' }
]
},
slotsFields() {
const sortable = this.slotsItems.length >= 10
const sortable = this.slots.length >= SORT_THRESHOLD
const hasScopedSlots = this.slots.some(s => s.scope)
return [
{ key: 'name', label: 'Slot Name', sortable },
{ key: 'name', label: 'Name', sortable },
...(hasScopedSlots ? [{ key: 'scope', label: 'Scoped' }] : []),
{ key: 'description', label: 'Description' }
]
Expand All @@ -429,50 +433,52 @@ export default {
const props = this.componentProps
const propsMetaObj = this.componentPropsMetaObj

return Object.keys(props).map(prop => {
const p = props[prop]
const meta = {
// Fallback descriptions for common props
...(commonProps[prop] || {}),
...(propsMetaObj[prop] || {})
}
return Object.keys(props)
.sort()
.map(prop => {
const p = props[prop]
const meta = {
// Fallback descriptions for common props
...(commonProps[prop] || {}),
...(propsMetaObj[prop] || {})
}

// Describe type
let type = p.type
let types = []
if (Array.isArray(type)) {
types = type.map(type => type.name)
} else {
types = type && type.name ? [type.name] : ['Any']
}
type = types
.map(type => `<code class="notranslate" translate="no">${type}</code>`)
.join(' or ')
// Describe type
let type = p.type
let types = []
if (Array.isArray(type)) {
types = type.map(type => type.name)
} else {
types = type && type.name ? [type.name] : ['Any']
}
type = types
.map(type => `<code class="notranslate" translate="no">${type}</code>`)
.join(' or ')

// Default value
let defaultValue = p.default
if (defaultValue instanceof Function && !Array.isArray(defaultValue)) {
defaultValue = defaultValue()
}
defaultValue =
typeof defaultValue === 'undefined'
? ''
: String(JSON.stringify(defaultValue, undefined, 1)).replace(/"/g, "'")
// Default value
let defaultValue = p.default
if (defaultValue instanceof Function && !Array.isArray(defaultValue)) {
defaultValue = defaultValue()
}
defaultValue =
typeof defaultValue === 'undefined'
? ''
: String(JSON.stringify(defaultValue, undefined, 1)).replace(/"/g, "'")

return {
prop: kebabCase(prop),
type,
defaultValue,
required: p.required || false,
description: meta.description || '',
version: meta.version || '',
xss: /[a-z]Html$/.test(prop),
isVModel: this.componentVModel && this.componentVModel.prop === prop,
deprecated: p.deprecated || false,
deprecation: p.deprecation || false,
_showDetails: typeof p.deprecated === 'string' || typeof p.deprecation === 'string'
}
})
return {
prop: kebabCase(prop),
type,
defaultValue,
required: p.required || false,
description: meta.description || '',
version: meta.version || '',
xss: meta.xss || false,
isVModel: this.componentVModel && this.componentVModel.prop === prop,
deprecated: p.deprecated || false,
deprecation: p.deprecation || false,
_showDetails: typeof p.deprecated === 'string' || typeof p.deprecation === 'string'
}
})
},
slotsItems() {
// We use object spread here so that `_showDetails` doesn't
Expand Down
60 changes: 30 additions & 30 deletions docs/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ export const getComponentName = component => kebabCase(component).replace(/{/g,
export const getCleanComponentName = component => getComponentName(component).replace(/({|})/g, '')

export const parseUrl = value => {
const anchor = document.createElement('a')
anchor.href = value
const $anchor = document.createElement('a')
$anchor.href = value

// We need to add the anchor to the document to make sure the
// `pathname` is correctly detected in any browser
document.body.appendChild(anchor)
document.body.appendChild($anchor)

const result = ['hash', 'host', 'hostname', 'pathname', 'port', 'protocol', 'search'].reduce(
(result, prop) => {
result[prop] = anchor[prop] || null
result[prop] = $anchor[prop] || null
return result
},
{}
)

// Make sure to remove the anchor from document as soon as possible
document.body.removeChild(anchor)
document.body.removeChild($anchor)

// Normalize port
if (!result.port && result.protocol) {
Expand Down Expand Up @@ -146,31 +146,31 @@ export const updateMetaTOC = (tocData = {}, meta = null) => {
return tocData
}

export const importAll = r => {
const obj = {}

r.keys()
.map(r)
.map(m => m.meta || m)
.map(m => ({
slug:
typeof m.slug === 'undefined' ? (m.title || '').replace(' ', '-').toLowerCase() : m.slug,
...m
}))
.sort((a, b) => {
if (a.slug < b.slug) return -1
else if (a.slug > b.slug) return 1
return 0
})
.forEach(m => {
if (m.components) {
// Normalize `meta.components` to array of objects form
m.components = m.components.map(c => (typeof c === 'string' ? { component: c } : c))
}
obj[m.slug] = m
})

return obj
export const importAll = context => {
// Get array of datas by keys from context
const datas = context.keys().map(context)

return (
datas
// Filter out private datas
.filter(data => !data.private)
// Map meta information
.map(data => data.meta || data)
// Normalize meta information
.map(meta => ({
...meta,
slug:
meta.slug === undefined ? (meta.title || '').replace(' ', '-').toLowerCase() : meta.slug
}))
// Sort by slug
.sort((a, b) => {
if (a.slug < b.slug) return -1
else if (a.slug > b.slug) return 1
return 0
})
// Build one object keyed by slug
.reduce((result, meta) => ({ ...result, [meta.slug]: meta }), {})
)
}

// Smooth Scroll handler methods
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-plugin-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const checkPluginMeta = async plugin => {
return file.replace(/\.js/, '')
})

const { meta } = await import(`${pluginDir}/package.json`)
if (!meta) {
const { private: isPrivate, meta } = await import(`${pluginDir}/package.json`)
if (isPrivate || !meta) {
return
}

Expand Down
112 changes: 0 additions & 112 deletions src/_custom-controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,115 +28,3 @@
}
}
}

// Shared BVFormBtnLabelControl styling
// Currently used by BFormTimepicker and BFormDatepicker
// Does not apply to button-only styling
.b-form-btn-label-control.form-control {
// Remove background validation images and padding from
// main wrapper as they will be present in the inner label element
background-image: none;
padding: 0;

@at-root {
// Handle input-group padding overrides
.input-group & {
padding: 0;
}
}

@at-root {
// Prevent the button/label from reversing order on in horizontal RTL mode
[dir="rtl"] &,
&[dir="rtl"] {
flex-direction: row-reverse;

> label {
text-align: right;
}
}
}

> .btn {
line-height: 1;
font-size: inherit;
box-shadow: none !important;
border: 0;

&:disabled {
pointer-events: none;
}
}

&.is-valid > .btn {
color: $form-feedback-valid-color;
}

&.is-invalid > .btn {
color: $form-feedback-invalid-color;
}

> .dropdown-menu {
padding: 0.5rem;
}

> label {
outline: 0;
padding-left: 0.25rem;
margin: 0;
border: 0;
font-size: inherit;
@if $enable-pointer-cursor-for-buttons {
cursor: pointer;
}
// Set a minimum height, as we have height set to auto
// (to allow the content to wrap if needed)
// We subtract off the border, as we have border set to 0
min-height: calc(#{$input-height} - #{$input-height-border});

&.form-control-sm {
min-height: calc(#{$input-height-sm} - #{$input-height-border});
}

&.form-control-lg {
min-height: calc(#{$input-height-lg} - #{$input-height-border});
}

@at-root {
// Handle input group sizing
.input-group.input-group-sm & {
min-height: calc(#{$input-height-sm} - #{$input-height-border});
padding-top: $input-padding-y-sm;
padding-bottom: $input-padding-y-sm;
}

.input-group.input-group-lg & {
min-height: calc(#{$input-height-lg} - #{$input-height-border});
padding-top: $input-padding-y-lg;
padding-bottom: $input-padding-y-lg;
}
}
}

// Disabled and read-only styling
&[aria-disabled="true"],
&[aria-readonly="true"] {
background-color: $input-disabled-bg;
opacity: 1;
}

&[aria-disabled="true"] {
pointer-events: none;

> label {
cursor: default;
}
}
}

// Button only mode menu padding overrides
.b-form-btn-label-control.btn-group {
> .dropdown-menu {
padding: 0.5rem;
}
}
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/bootstrap-vue/bootstrap-vue/pull/6141/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy