Skip to content

Commit

Permalink
Merge branch 'main' into XhmikosR-patch-9
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Mar 5, 2021
2 parents 11f3d8b + 548be2e commit ef6ccb0
Show file tree
Hide file tree
Showing 79 changed files with 2,434 additions and 750 deletions.
16 changes: 8 additions & 8 deletions .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,35 @@
},
{
"path": "./dist/css/bootstrap.css",
"maxSize": "24 kB"
"maxSize": "24.25 kB"
},
{
"path": "./dist/css/bootstrap.min.css",
"maxSize": "22 kB"
"maxSize": "22.25 kB"
},
{
"path": "./dist/js/bootstrap.bundle.js",
"maxSize": "42 kB"
"maxSize": "43 kB"
},
{
"path": "./dist/js/bootstrap.bundle.min.js",
"maxSize": "21.75 kB"
"maxSize": "22.5 kB"
},
{
"path": "./dist/js/bootstrap.esm.js",
"maxSize": "27 kB"
"maxSize": "28.5 kB"
},
{
"path": "./dist/js/bootstrap.esm.min.js",
"maxSize": "18 kB"
"maxSize": "19 kB"
},
{
"path": "./dist/js/bootstrap.js",
"maxSize": "28 kB"
"maxSize": "29 kB"
},
{
"path": "./dist/js/bootstrap.min.js",
"maxSize": "15.75 kB"
"maxSize": "16.25 kB"
}
],
"ci": {
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/*.min.js
**/dist/
**/vendor/
/_gh_pages/
/_site/
/js/coverage/
/site/static/sw.js
2 changes: 0 additions & 2 deletions .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Bundlewatch

on:
push:
branches-ignore:
- "dependabot/**"
pull_request:

env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
branches:
- main
- v4-dev
- "!dependabot/**"
schedule:
- cron: "0 2 * * 5"

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Ignore docs files
/_gh_pages/
/_site/
# Hugo resources folder
/resources/

Expand Down
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
**/*.min.css
**/dist/
**/vendor/
/_gh_pages/
/_site/
/js/coverage/
3 changes: 2 additions & 1 deletion build/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const bsPlugins = {
Collapse: path.resolve(__dirname, '../js/src/collapse.js'),
Dropdown: path.resolve(__dirname, '../js/src/dropdown.js'),
Modal: path.resolve(__dirname, '../js/src/modal.js'),
OffCanvas: path.resolve(__dirname, '../js/src/offcanvas.js'),
Popover: path.resolve(__dirname, '../js/src/popover.js'),
ScrollSpy: path.resolve(__dirname, '../js/src/scrollspy.js'),
Tab: path.resolve(__dirname, '../js/src/tab.js'),
Expand Down Expand Up @@ -71,7 +72,7 @@ const getConfigByPluginKey = pluginKey => {
}
}

if (pluginKey === 'Alert' || pluginKey === 'Tab') {
if (pluginKey === 'Alert' || pluginKey === 'Tab' || pluginKey === 'OffCanvas') {
return defaultPluginConfig
}

Expand Down
2 changes: 1 addition & 1 deletion build/change-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function main(args) {
const newVersion = args[1]
const EXCLUDED_DIRS = new Set([
'.git',
'_gh_pages',
'_site',
'node_modules',
'resources'
])
Expand Down
2 changes: 1 addition & 1 deletion build/ship.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ npm run release
printf "\n%s=======================================================%s" "$magenta" "$end"
printf "\n%sCopy it over...%s" "$magenta" "$end"
printf "\n%s=======================================================\n%s" "$magenta" "$end"
cp -rf _gh_pages/. ../bs-docs/
cp -rf _site/. ../bs-docs/
printf "\nDone!\n"

printf "\n%s=======================================================%s" "$green" "$end"
Expand Down
2 changes: 1 addition & 1 deletion build/vnu-jar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
'--no-langdetect',
'--Werror',
`--filterpattern "${ignores}"`,
'_gh_pages/',
'_site/',
'js/tests/'
]

Expand Down
2 changes: 1 addition & 1 deletion build/zip-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const pkg = require('../package.json')

const versionShort = pkg.config.version_short
const distFolder = `bootstrap-${pkg.version}-examples`
const rootDocsDir = '_gh_pages'
const rootDocsDir = '_site'
const docsDir = `${rootDocsDir}/docs/${versionShort}/`

// these are the files we need in the examples
Expand Down
6 changes: 3 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enableRobotsTXT: true
metaDataFormat: "yaml"
disableKinds: ["404", "taxonomy", "taxonomyTerm", "RSS"]

publishDir: "_gh_pages"
publishDir: "_site"

module:
mounts:
Expand Down Expand Up @@ -75,5 +75,5 @@ params:
js_hash: "sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG"
js_bundle: "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js"
js_bundle_hash: "sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0"
popper: "https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js"
popper_hash: "sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi"
popper: "https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.0/dist/umd/popper.min.js"
popper_hash: "sha384-EOlc5FUOsy7obkrpNXqD9DtrephzQpK7DXijDIKexeJT0qfn4dZ7GDid8suWuQHq"
2 changes: 2 additions & 0 deletions js/index.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Carousel from './src/carousel'
import Collapse from './src/collapse'
import Dropdown from './src/dropdown'
import Modal from './src/modal'
import OffCanvas from './src/offcanvas'
import Popover from './src/popover'
import ScrollSpy from './src/scrollspy'
import Tab from './src/tab'
Expand All @@ -24,6 +25,7 @@ export {
Collapse,
Dropdown,
Modal,
OffCanvas,
Popover,
ScrollSpy,
Tab,
Expand Down
2 changes: 2 additions & 0 deletions js/index.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Carousel from './src/carousel'
import Collapse from './src/collapse'
import Dropdown from './src/dropdown'
import Modal from './src/modal'
import OffCanvas from './src/offcanvas'
import Popover from './src/popover'
import ScrollSpy from './src/scrollspy'
import Tab from './src/tab'
Expand All @@ -24,6 +25,7 @@ export default {
Collapse,
Dropdown,
Modal,
OffCanvas,
Popover,
ScrollSpy,
Tab,
Expand Down
3 changes: 2 additions & 1 deletion js/src/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Alert extends BaseComponent {

static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
let data = Data.get(this, DATA_KEY)

if (!data) {
data = new Alert(this)
Expand Down Expand Up @@ -126,6 +126,7 @@ class Alert extends BaseComponent {
* Data Api implementation
* ------------------------------------------------------------------------
*/

EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()))

/**
Expand Down
8 changes: 5 additions & 3 deletions js/src/base-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,25 @@ const VERSION = '5.0.0-beta2'

class BaseComponent {
constructor(element) {
element = typeof element === 'string' ? document.querySelector(element) : element

if (!element) {
return
}

this._element = element
Data.setData(element, this.constructor.DATA_KEY, this)
Data.set(this._element, this.constructor.DATA_KEY, this)
}

dispose() {
Data.removeData(this._element, this.constructor.DATA_KEY)
Data.remove(this._element, this.constructor.DATA_KEY)
this._element = null
}

/** Static */

static getInstance(element) {
return Data.getData(element, this.DATA_KEY)
return Data.get(element, this.DATA_KEY)
}

static get VERSION() {
Expand Down
4 changes: 2 additions & 2 deletions js/src/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Button extends BaseComponent {

static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
let data = Data.get(this, DATA_KEY)

if (!data) {
data = new Button(this)
Expand All @@ -75,7 +75,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {

const button = event.target.closest(SELECTOR_DATA_TOGGLE)

let data = Data.getData(button, DATA_KEY)
let data = Data.get(button, DATA_KEY)
if (!data) {
data = new Button(button)
}
Expand Down
6 changes: 3 additions & 3 deletions js/src/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ class Carousel extends BaseComponent {
// Static

static carouselInterface(element, config) {
let data = Data.getData(element, DATA_KEY)
let data = Data.get(element, DATA_KEY)
let _config = {
...Default,
...Manipulator.getDataAttributes(element)
Expand Down Expand Up @@ -586,7 +586,7 @@ class Carousel extends BaseComponent {
Carousel.carouselInterface(target, config)

if (slideIndex) {
Data.getData(target, DATA_KEY).to(slideIndex)
Data.get(target, DATA_KEY).to(slideIndex)
}

event.preventDefault()
Expand All @@ -605,7 +605,7 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)

for (let i = 0, len = carousels.length; i < len; i++) {
Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY))
Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY))
}
})

Expand Down
14 changes: 7 additions & 7 deletions js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class Collapse extends BaseComponent {
this._isTransitioning = false
this._config = this._getConfig(config)
this._triggerArray = SelectorEngine.find(
`${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` +
`${SELECTOR_DATA_TOGGLE}[data-bs-target="#${element.id}"]`
`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` +
`${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`
)

const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)
Expand All @@ -82,7 +82,7 @@ class Collapse extends BaseComponent {
const elem = toggleList[i]
const selector = getSelectorFromElement(elem)
const filterElement = SelectorEngine.find(selector)
.filter(foundElem => foundElem === element)
.filter(foundElem => foundElem === this._element)

if (selector !== null && filterElement.length) {
this._selector = selector
Expand Down Expand Up @@ -147,7 +147,7 @@ class Collapse extends BaseComponent {
const container = SelectorEngine.findOne(this._selector)
if (actives) {
const tempActiveData = actives.find(elem => container !== elem)
activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null
activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY) : null

if (activesData && activesData._isTransitioning) {
return
Expand All @@ -166,7 +166,7 @@ class Collapse extends BaseComponent {
}

if (!activesData) {
Data.setData(elemActive, DATA_KEY, null)
Data.set(elemActive, DATA_KEY, null)
}
})
}
Expand Down Expand Up @@ -332,7 +332,7 @@ class Collapse extends BaseComponent {
// Static

static collapseInterface(element, config) {
let data = Data.getData(element, DATA_KEY)
let data = Data.get(element, DATA_KEY)
const _config = {
...Default,
...Manipulator.getDataAttributes(element),
Expand Down Expand Up @@ -380,7 +380,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
const selectorElements = SelectorEngine.find(selector)

selectorElements.forEach(element => {
const data = Data.getData(element, DATA_KEY)
const data = Data.get(element, DATA_KEY)
let config
if (data) {
// update parent attribute
Expand Down

0 comments on commit ef6ccb0

Please sign in to comment.