diff --git a/.eslintignore b/.eslintignore
index 5a1c1d7eeb..834cb2410f 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -3,7 +3,6 @@
**/vendor/
/_gh_pages/
/js/coverage/
-/js/tests/integration/
/docs/content/_index.html
/docs/static/sw.js
/docs/layouts/
diff --git a/.eslintrc.json b/.eslintrc.json
index 5443b97bc5..7d1664693d 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -14,6 +14,35 @@
"error",
"never"
],
+ "import/extensions": [
+ "error",
+ "ignorePackages",
+ {
+ "js": "always"
+ }
+ ],
+ "import/first": "error",
+ "import/newline-after-import": "error",
+ "import/no-absolute-path": "error",
+ "import/no-amd": "error",
+ "import/no-cycle": [
+ "error",
+ {
+ "ignoreExternal": true
+ }
+ ],
+ "import/no-duplicates": "error",
+ "import/no-extraneous-dependencies": "error",
+ "import/no-mutable-exports": "error",
+ "import/no-named-as-default": "error",
+ "import/no-named-as-default-member": "error",
+ "import/no-named-default": "error",
+ "import/no-self-import": "error",
+ "import/no-unassigned-import": [
+ "error"
+ ],
+ "import/no-useless-path-segments": "error",
+ "import/order": "error",
"indent": [
"error",
2,
@@ -51,17 +80,141 @@
"error",
"never"
],
+ "strict": "error",
"unicorn/explicit-length-check": "off",
+ "unicorn/filename-case": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-array-method-this-argument": "off",
"unicorn/no-null": "off",
"unicorn/no-typeof-undefined": "off",
"unicorn/no-unused-properties": "error",
+ "unicorn/numeric-separators-style": "off",
"unicorn/prefer-array-flat": "off",
+ "unicorn/prefer-at": "off",
"unicorn/prefer-dom-node-dataset": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-spread": "off",
+ "unicorn/prefer-string-replace-all": "off",
"unicorn/prevent-abbreviations": "off"
- }
+ },
+ "overrides": [
+ {
+ "files": [
+ "build/**"
+ ],
+ "env": {
+ "browser": false,
+ "node": true
+ },
+ "parserOptions": {
+ "sourceType": "module"
+ },
+ "rules": {
+ "no-console": "off",
+ "unicorn/prefer-top-level-await": "off"
+ }
+ },
+ {
+ "files": [
+ "js/**"
+ ],
+ "parserOptions": {
+ "sourceType": "module"
+ }
+ },
+ {
+ "files": [
+ "js/tests/*.js",
+ "js/tests/integration/rollup*.js"
+ ],
+ "env": {
+ "node": true
+ },
+ "parserOptions": {
+ "sourceType": "script"
+ }
+ },
+ {
+ "files": [
+ "js/tests/unit/**"
+ ],
+ "env": {
+ "jasmine": true
+ },
+ "rules": {
+ "no-console": "off",
+ "unicorn/consistent-function-scoping": "off",
+ "unicorn/no-useless-undefined": "off",
+ "unicorn/prefer-add-event-listener": "off"
+ }
+ },
+ {
+ "files": [
+ "js/tests/visual/**"
+ ],
+ "plugins": [
+ "html"
+ ],
+ "settings": {
+ "html/html-extensions": [
+ ".html"
+ ]
+ },
+ "rules": {
+ "no-console": "off",
+ "no-new": "off",
+ "unicorn/no-array-for-each": "off"
+ }
+ },
+ {
+ "files": [
+ "scss/tests/**"
+ ],
+ "env": {
+ "node": true
+ },
+ "parserOptions": {
+ "sourceType": "script"
+ }
+ },
+ {
+ "files": [
+ "docs/**"
+ ],
+ "env": {
+ "browser": true,
+ "node": false
+ },
+ "parserOptions": {
+ "sourceType": "script",
+ "ecmaVersion": 2019
+ },
+ "rules": {
+ "no-new": "off",
+ "unicorn/no-array-for-each": "off"
+ }
+ },
+ {
+ "files": [
+ "**/*.md"
+ ],
+ "plugins": [
+ "markdown"
+ ],
+ "processor": "markdown/markdown"
+ },
+ {
+ "files": [
+ "**/*.md/*.js"
+ ],
+ "extends": "plugin:markdown/recommended",
+ "parserOptions": {
+ "sourceType": "module"
+ },
+ "rules": {
+ "unicorn/prefer-node-protocol": "off"
+ }
+ }
+ ]
}
diff --git a/.stylelintrc b/.stylelintrc
index 7a7ca3ffcb..ee52ad0f69 100644
--- a/.stylelintrc
+++ b/.stylelintrc
@@ -2,39 +2,59 @@
"extends": [
"stylelint-config-twbs-bootstrap"
],
- "rules": {
- "declaration-property-value-disallowed-list": {
- "border": "none",
- "outline": "none"
- },
- "function-disallowed-list": [
- "calc",
- "lighten",
- "darken"
- ],
- "property-disallowed-list": [
- "border-radius",
- "border-top-left-radius",
- "border-top-right-radius",
- "border-bottom-right-radius",
- "border-bottom-left-radius",
- "transition"
- ],
- "scss/dollar-variable-default": [
- true,
- {
- "ignore": "local"
- }
- ],
- "scss/selector-no-union-class-name": true
- },
+ "reportInvalidScopeDisables": true,
+ "reportNeedlessDisables": true,
"overrides": [
+ {
+ "files": "**/*.scss",
+ "rules": {
+ "declaration-property-value-disallowed-list": {
+ "border": "none",
+ "outline": "none"
+ },
+ "function-disallowed-list": [
+ "calc",
+ "lighten",
+ "darken"
+ ],
+ "property-disallowed-list": [
+ "border-radius",
+ "border-top-left-radius",
+ "border-top-right-radius",
+ "border-bottom-right-radius",
+ "border-bottom-left-radius",
+ "transition"
+ ],
+ "scss/dollar-variable-default": [
+ true,
+ {
+ "ignore": "local"
+ }
+ ],
+ "scss/selector-no-union-class-name": true
+ }
+ },
{
"files": "scss/**/*.{test,spec}.scss",
"rules": {
"scss/dollar-variable-default": null,
"declaration-no-important": null
}
+ },
+ {
+ "files": "docs/**/*.scss",
+ "rules": {
+ "scss/dollar-variable-default": null
+ }
+ },
+ {
+ "files": "docs/**/examples/**/*.css",
+ "rules": {
+ "comment-empty-line-before": null,
+ "property-no-vendor-prefix": null,
+ "selector-no-qualifying-type": null,
+ "value-no-vendor-prefix": null
+ }
}
]
-}
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 4049f3018d..0000000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,174 +0,0 @@
-# Changelog
-
-## [v4.2.6](https://github.com/coreui/coreui/compare/v4.1.5...v4.2.6)
-
-> 9 June 2022
-
-- fix(scss) Replace color-adjust to print-color-adjust in _form-check.scss
-
-## [v4.1.5](https://github.com/coreui/coreui/compare/v4.1.4...v4.1.5)
-
-> 5 May 2022
-
-- fix(forms): revert angular validation classes commit
-
-
-## [v4.1.4](https://github.com/coreui/coreui/compare/v4.1.3...v4.1.4)
-
-> 28 April 2022
-
-- fix(Modal): set the proper close button position when RTL direction is enabled
-- fix(Toast): set the proper close button position when RTL direction is enabled
-
-## [v4.1.3](https://github.com/coreui/coreui/compare/v4.1.2...v4.1.3)
-
-> 10 March 2022
-
-- refactor(Offcanvas): add CSS vars support
-- fix(Offcanvas): offcanvas is not visible when LTR and RTL are enabled
-- docs: update content
-- fix: wrong select background-position and validation icon position when RTL is enabled.
-- refactor: update `reflect` function
-
-## [v4.1.2](https://github.com/coreui/coreui/compare/v4.1.1...v4.1.2)
-
-> 7 March 2022
-
-- fix: generate rtl utilities
-
-## [v4.1.1](https://github.com/coreui/coreui/compare/v4.1.0...v4.1.1)
-
-> 4 March 2022
-
-- chore: update dependencies and devDependencies
-- chore: update workflows
-- refactor(Sidebar): add variables to set `.nav-group-items` paddings
-- docs: update theme
-- build: update build scripts
-- build: update bundle watch
-- refactor: update `isVisible` function
-- fix(Sidebar): improve backdrop behavior
-- build: update build tools
-- chore: fix eslint errors
-- chore: fix stylelint warnings
-- fix(Sidebar): click outside listener on mobile devices
-- docs: remove version number from url
-
-## [v4.1.0](https://github.com/coreui/coreui/compare/v4.0.5...v4.1.0)
-
-> 29 November 2021
-
-
-- chore: update short version
-- refactor: update utilities generator
-- docs: update content
-- chore: update comments
-- refactor: update selectors
-- refactor: change DATA_KEY
-- tests: update tests
-- fix(Offcanvas): fix RTL
-- chore: update comments
-- refactor(Tables): update borders
-
-## [v4.0.5-alpha.4](https://github.com/coreui/coreui/compare/v4.0.5-alpha.3...v4.0.5-alpha.4)
-
-> 22 March 2021
-
-### Features
-
-- feat: allow to generate CSS Variables without callbacks [`d8ccba7`](https://github.com/coreui/coreui/commit/d8ccba78684ac3cbea15a246b6408f6f218cc6ec)
-
-### Refactor
-
-- refactor: move all variables to mixin [`654005e`](https://github.com/coreui/coreui/commit/654005e76f2cf2fb5464463ffdb28a67d2efb61f)
-- refactor: change `background` to `bg` [`6c32a05`](https://github.com/coreui/coreui/commit/6c32a05d759de9570bea3cc53c75d13a42efdbce)
-- refactor(Utilities): update generator [`6839124`](https://github.com/coreui/coreui/commit/68391246b2a2e003d8d4e928386c15638ed90128)
-
-## [v4.0.5-alpha.3](https://github.com/coreui/coreui/compare/v4.0.5-alpha.2...v4.0.5-alpha.3)
-
-> 19 March 2021
-
-### Features
-
-- feat: add RTL support [`0934ada`](https://github.com/coreui/coreui/commit/0934ada4355c90607d13b3bf19dd82252339387e)
-- feat: add RTL support to text align utilities [`a176bdc`](https://github.com/coreui/coreui/commit/a176bdcc8ce8b0202fe7af1d9a9c38a8a1be2237)
-- feat: add `--cui-body-color` to `:root` [`9c37e9a`](https://github.com/coreui/coreui/commit/9c37e9a50a71e0f718471fe60ec6e8d2c27ae3e6)
-
-### Fix
-
-- fix: wrong names in colors map [`eefccbf`](https://github.com/coreui/coreui/commit/eefccbfcb6e8a3d1dbc7fa406a3f498e738aabbe)
-- fix: generate proper properties and values if only `$enable-rtl` is set to `true` [`582a6f8`](https://github.com/coreui/coreui/commit/582a6f85a3117759f50f5f97bfaf805cc1185ada)
-- fix: rename wrong CSS Variables names [`c187b59`](https://github.com/coreui/coreui/commit/c187b59bc2f8c2dcf591541891b401743101c731)
-- fix: no borders [`b6da406`](https://github.com/coreui/coreui/commit/b6da40674d17503a418a05648ffc5075d63814b4)
-- fix: add missing CSS variables [`dc06098`](https://github.com/coreui/coreui/commit/dc06098f395d328f7bd99d0660654a246542ced3)
-- fix(_root.scss): add custom properties - breakpoint-* and mobile-breakpoint [`32fcd38`](https://github.com/coreui/coreui/commit/32fcd380170c45e7adc4f26a98d255fd5c62d118)
-- fix: prevent adding `active` class to `.nav-group-toggle` [`e3f247f`](https://github.com/coreui/coreui/commit/e3f247f07a935147a196ffc4ea8e5a8938752b51)
-- fix: `.compact` shouldn't overwrite `padding-left` and `padding-right` properties [`4b47c72`](https://github.com/coreui/coreui/commit/4b47c721c2bf3ac1ec1f0db8829e01e3e858309a)
-- fix(_sidebar.scss): add $variable-prefix to --is-mobile custom property [`acab8bc`](https://github.com/coreui/coreui/commit/acab8bc26c0a04f4318b90125de2541f1582b576)
-- fix: remove unused variable [`ace0c6a`](https://github.com/coreui/coreui/commit/ace0c6a8f511c694859c6e6bbb596e655951cb0e)
-- fix: add missing CSS Variable [`8f852a6`](https://github.com/coreui/coreui/commit/8f852a6431fd82d069771e6d7ed7beb875047555)
-
-### Refactor
-
-- refactor: generate CSS variables for color variants instead of styles [`5cf8f7a`](https://github.com/coreui/coreui/commit/5cf8f7a6da6d3a2052447765a1e4369191ab5b4d)
-- refactor: improve buttons generator syntax [`22eff29`](https://github.com/coreui/coreui/commit/22eff298e17574b8bf26d0ef46eac2421d850190)
-- refactor: change `--cui-sidebar-occupy` to `--cui-sidebar-occupy-start` and add `--cui-sidebar-occupy-end` [`3d9c15b`](https://github.com/coreui/coreui/commit/3d9c15b262ba171f29434b0f67f09efc95f4b44a)
-- refactor: add SCSS files to generate RTL only version [`d8221f7`](https://github.com/coreui/coreui/commit/d8221f791567b63988b069021e9a1ce66ae41ca3)
-- refactor: change `.sidebar-right` to `.sidebar-end` [`e1cb24c`](https://github.com/coreui/coreui/commit/e1cb24c267635c0763e2bccd9aa093e87739eb75)
-- refactor: remove str-replace function from SVG icons [`845c82c`](https://github.com/coreui/coreui/commit/845c82c2a8b655ad15c119e642c870d505d9d87e)
-- refactor: update `.nav-group-toggle` icon [`f5047b3`](https://github.com/coreui/coreui/commit/f5047b39c879b7ff2d0bb242ad1ad6d9e4187425)
-- refactor(Progress): improve syntax [`1b22531`](https://github.com/coreui/coreui/commit/1b225310f7bae2480ba21fc7b89c5a1ea2fc2e1a)
-- refactor: update utilities generator [`b09346b`](https://github.com/coreui/coreui/commit/b09346b69c28865b27a5251c853ebb498c01f2c3)
-- refactor: change `.sidebar-nav-sm` to `.compact` [`818540b`](https://github.com/coreui/coreui/commit/818540b7396545b9a039b360c897940f81b8002d)
-- refactor: disable RTL by default [`58c153f`](https://github.com/coreui/coreui/commit/58c153ffa99c054c938ee680af518804b416d885)
-- refactor: change `--#{$variable-prefix}alert-bg` to `--#{$variable-prefix}alert-background` [`1b8f9e7`](https://github.com/coreui/coreui/commit/1b8f9e71dfc2da45b64008207d5b91f72f8c8ee3)
-
-## [v4.0.5-alpha.2](https://github.com/coreui/coreui/compare/v4.0.5-alpha.1...v4.0.5-alpha.2)
-
-> 19 March 2021
-
-### Features
-
-- feat(Badge): add `badge-sm` [`8afa29b`](https://github.com/coreui/coreui/commit/8afa29be9a15696fb6755b7cb9bac3f67b478838)
-- feat: add CSS Vars to border utilities [`d96aa5b`](https://github.com/coreui/coreui/commit/d96aa5bf8d89080644a0d896ed31cf8595f0db63)
-- feat: add `contrast-ratio-correction` function [`c3e2cdc`](https://github.com/coreui/coreui/commit/c3e2cdc0d084a2b8cd4a4fa1b01f4824cc4e13e6)
-
-### Fix
-
-- fix(carousel): switch prev/next directions in RTL [`b85ca04`](https://github.com/coreui/coreui/commit/b85ca045e057d6f5982cc0cc9de4bfbf8b252a3d)
-- fix: remove $ [`3c210f8`](https://github.com/coreui/coreui/commit/3c210f8373c500e017867e1d6a44a095c77c7a1d)
-- fix(navs): ensure button will grow in fill/justified nav [`bed8fc8`](https://github.com/coreui/coreui/commit/bed8fc8381be8f9aad7ac95727be4ab8975b4f94)
-- fix(forms): validated controls in input-group [`ac3a106`](https://github.com/coreui/coreui/commit/ac3a1069b139c12d95ca1b6ac2798e56cf01a83e)
-- fix: wrong name in border-color property [`554aa81`](https://github.com/coreui/coreui/commit/554aa819955d45a862511ea1f99803e67ebeba93)
-- fix: the wrong contrast ratio for default text colors [`b5d3fb6`](https://github.com/coreui/coreui/commit/b5d3fb65037a5e4c6c81fad7db1789aa54ca6579)
-- fix: wrong `nth-child` value [`e07c7ec`](https://github.com/coreui/coreui/commit/e07c7ec0a78a5f4dee7f8270888e2d03873256d0)
-- fix(list-group): properly set a color on list-group-items [`0bdf931`](https://github.com/coreui/coreui/commit/0bdf9315077d22022a1f35b60b830398825098ce)
-- fix(Sidebar Nav): nav-link has wrong bg color on hover [`55f4403`](https://github.com/coreui/coreui/commit/55f440350bb0c775d2b413d4e2a089067d12da75)
-
-### Refactor
-
-- refactor(Sidebar): change default responsive behaviour [`8f9ba8e`](https://github.com/coreui/coreui/commit/8f9ba8e2b1ebe2edf528c01364000a74856578bc)
-- refactor: update text colors [`007ec95`](https://github.com/coreui/coreui/commit/007ec958dbc4ecfd858e8ab49f65dcd51a75fdd1)
-- refactor: simplify CSS Variables [`75706ab`](https://github.com/coreui/coreui/commit/75706ab512cfaac62c80e5ba01de5b062f202a30)
-- refactor: update togglers [`238590a`](https://github.com/coreui/coreui/commit/238590ab0ec36d4dc6b98c465b8e60bc7296feca)
-- refactor(Sidebar): refactor responsive behavior [`0a02a32`](https://github.com/coreui/coreui/commit/0a02a32f8897c34c7eefe7752e31e049e848e291)
-- refactor: add contrast ratio checker [`bcc6db7`](https://github.com/coreui/coreui/commit/bcc6db7d7611ac65d7a2057172d28a4f6f48c03b)
-- refactor: add CSS Variables [`a165df0`](https://github.com/coreui/coreui/commit/a165df026d58529379a98e2a48eb08f9e0246b72)
-- refactor: add missing CSS Variables [`beee33b`](https://github.com/coreui/coreui/commit/beee33b3edc2ff5ca9ed512007bcf3cc0d1f28e8)
-- refactor: rename `_sidebarInterface` to `sidebarInterface` [`993069d`](https://github.com/coreui/coreui/commit/993069deef08f349a0e4092c36f9dfb4fa953a80)
-- refactor: add CSS Variables [`b823216`](https://github.com/coreui/coreui/commit/b823216f9e0c74fa18c2854b7eafcb3014422bf3)
-
-## [v4.0.5-alpha.1](https://github.com/coreui/coreui/compare/v4.0.5-alpha.0...v4.0.5-alpha.1)
-
-> 17 January 2021
-
-### Fix
-
-- fix: replace `border-{left|right}` utilities with `border-{start|end}` [`ba0ee67`](https://github.com/coreui/coreui/commit/ba0ee673b181f27a136982594e8fd8765b150ffc)
-- refactor: update size of navs; fix: position of close button [`bf3f6fc`](https://github.com/coreui/coreui/commit/bf3f6fc522d61327e610a48cbeabb635e1364e32)
-
-### Refactor
-
-- refactor: update size of navs; fix: position of close button [`bf3f6fc`](https://github.com/coreui/coreui/commit/bf3f6fc522d61327e610a48cbeabb635e1364e32)
-- refactor: redesign close button [`4d33268`](https://github.com/coreui/coreui/commit/4d33268d9031afa43ff932de4976fb872b011d00)
-- refactor: update subcomponents heights [`26f9252`](https://github.com/coreui/coreui/commit/26f9252cd9f0dbefb8ed405502560f30c1439397)
diff --git a/LICENSE b/LICENSE
index dda75ca9a5..7ffeae4209 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2011-2022 Twitter, Inc.
-Copyright (c) 2011-2022 The Bootstrap Authors
+Copyright (c) 2023 creativeLabs Łukasz Holeczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -10,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 15f7ce4bb7..1cfc28b92f 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@
Several quick start options are available:
-- [Download the latest release](https://github.com/coreui/coreui/archive/v4.2.6.zip)
+- [Download the latest release](https://github.com/coreui/coreui/archive/v4.3.2.zip)
- Clone the repo: `git clone https://github.com/coreui/coreui.git`
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/coreui`
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/coreui`
diff --git a/build/.eslintrc.json b/build/.eslintrc.json
deleted file mode 100644
index dec6323d0a..0000000000
--- a/build/.eslintrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "env": {
- "browser": false,
- "node": true
- },
- "parserOptions": {
- "sourceType": "script"
- },
- "extends": "../.eslintrc.json",
- "rules": {
- "no-console": "off",
- "strict": "error",
- "unicorn/prefer-top-level-await": "off"
- }
-}
diff --git a/build/banner.js b/build/banner.js
deleted file mode 100644
index a41c89b7bb..0000000000
--- a/build/banner.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-
-const pkg = require('../package.json')
-const year = new Date().getFullYear()
-
-function getBanner(pluginFilename) {
- return `/*!
- * CoreUI${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
- * Copyright ${year} ${pkg.author}
- * Licensed under MIT (${pkg.homepage})
- */`
-}
-
-module.exports = getBanner
diff --git a/build/banner.mjs b/build/banner.mjs
new file mode 100644
index 0000000000..02c53616dc
--- /dev/null
+++ b/build/banner.mjs
@@ -0,0 +1,20 @@
+import fs from 'node:fs/promises'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
+
+const pkgJson = path.join(__dirname, '../package.json')
+const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8'))
+
+const year = new Date().getFullYear()
+
+function getBanner(pluginFilename) {
+ return `/*!
+ * CoreUI${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
+ * Copyright ${year} ${pkg.author}
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
+ */`
+}
+
+export default getBanner
diff --git a/build/build-plugins.js b/build/build-plugins.mjs
similarity index 86%
rename from build/build-plugins.js
rename to build/build-plugins.mjs
index b6ce58df84..77e63070c5 100644
--- a/build/build-plugins.js
+++ b/build/build-plugins.mjs
@@ -2,18 +2,19 @@
/*!
* Script to build our plugins to use them separately.
- * Copyright 2020-2022 The Bootstrap Authors
- * Copyright 2020-2022 Twitter, Inc.
+ * Copyright 2020-2023 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
-'use strict'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { babel } from '@rollup/plugin-babel'
+import globby from 'globby'
+import { rollup } from 'rollup'
+import banner from './banner.mjs'
-const path = require('node:path')
-const rollup = require('rollup')
-const globby = require('globby')
-const { babel } = require('@rollup/plugin-babel')
-const banner = require('./banner.js')
+const __filename = fileURLToPath(import.meta.url)
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
const sourcePath = path.resolve(__dirname, '../js/src/').replace(/\\/g, '/')
const jsFiles = globby.sync(`${sourcePath}/**/*.js`)
@@ -38,7 +39,7 @@ for (const file of jsFiles) {
const build = async plugin => {
const globals = {}
- const bundle = await rollup.rollup({
+ const bundle = await rollup({
input: plugin.src,
plugins: [
babel({
diff --git a/build/change-version.js b/build/change-version.js
deleted file mode 100644
index 72893ade31..0000000000
--- a/build/change-version.js
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env node
-
-/*!
- * Script to update version number references in the project.
- * Copyright 2017-2022 The Bootstrap Authors
- * Copyright 2017-2022 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- */
-
-'use strict'
-
-const fs = require('node:fs').promises
-const path = require('node:path')
-const globby = require('globby')
-
-const VERBOSE = process.argv.includes('--verbose')
-const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run')
-
-// These are the filetypes we only care about replacing the version
-const GLOB = [
- '**/*.{css,html,js,json,md,scss,txt,yml}'
-]
-const GLOBBY_OPTIONS = {
- cwd: path.join(__dirname, '..'),
- gitignore: true
-}
-const EXCLUDED_FILES = [
- 'CHANGELOG.md'
-]
-
-// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
-function regExpQuote(string) {
- return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
-}
-
-function regExpQuoteReplacement(string) {
- return string.replace(/\$/g, '$$')
-}
-
-async function replaceRecursively(file, oldVersion, newVersion) {
- const originalString = await fs.readFile(file, 'utf8')
- const newString = originalString.replace(
- new RegExp(regExpQuote(oldVersion), 'g'), regExpQuoteReplacement(newVersion)
- )
-
- // No need to move any further if the strings are identical
- if (originalString === newString) {
- return
- }
-
- if (VERBOSE) {
- console.log(`FILE: ${file}`)
- }
-
- if (DRY_RUN) {
- return
- }
-
- await fs.writeFile(file, newString, 'utf8')
-}
-
-async function main(args) {
- let [oldVersion, newVersion] = args
-
- if (!oldVersion || !newVersion) {
- console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
- console.error('Got arguments:', args)
- process.exit(1)
- }
-
- // Strip any leading `v` from arguments because otherwise we will end up with duplicate `v`s
- [oldVersion, newVersion] = [oldVersion, newVersion].map(arg => arg.startsWith('v') ? arg.slice(1) : arg)
-
- try {
- const files = await globby(GLOB, GLOBBY_OPTIONS, EXCLUDED_FILES)
-
- await Promise.all(files.map(file => replaceRecursively(file, oldVersion, newVersion)))
- } catch (error) {
- console.error(error)
- process.exit(1)
- }
-}
-
-main(process.argv.slice(2))
diff --git a/build/change-version.mjs b/build/change-version.mjs
new file mode 100644
index 0000000000..643f968054
--- /dev/null
+++ b/build/change-version.mjs
@@ -0,0 +1,112 @@
+#!/usr/bin/env node
+
+/*!
+ * Script to update version number references in the project.
+ * Copyright 2017-2023 The Bootstrap Authors
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ */
+
+import { execFile } from 'node:child_process'
+import fs from 'node:fs/promises'
+import process from 'node:process'
+
+const VERBOSE = process.argv.includes('--verbose')
+const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run')
+
+// These are the files we only care about replacing the version
+const FILES = [
+ 'README.md',
+ 'hugo.yml',
+ 'js/src/base-component.js',
+ 'package.js',
+ 'scss/mixins/_banner.scss'
+]
+
+// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
+function regExpQuote(string) {
+ return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
+}
+
+function regExpQuoteReplacement(string) {
+ return string.replace(/\$/g, '$$')
+}
+
+async function replaceRecursively(file, oldVersion, newVersion) {
+ const originalString = await fs.readFile(file, 'utf8')
+ const newString = originalString
+ .replace(
+ new RegExp(regExpQuote(oldVersion), 'g'),
+ regExpQuoteReplacement(newVersion)
+ )
+ // Also replace the version used by the rubygem,
+ // which is using periods (`.`) instead of hyphens (`-`)
+ .replace(
+ new RegExp(regExpQuote(oldVersion.replace(/-/g, '.')), 'g'),
+ regExpQuoteReplacement(newVersion.replace(/-/g, '.'))
+ )
+
+ // No need to move any further if the strings are identical
+ if (originalString === newString) {
+ return
+ }
+
+ if (VERBOSE) {
+ console.log(`Found ${oldVersion} in ${file}`)
+ }
+
+ if (DRY_RUN) {
+ return
+ }
+
+ await fs.writeFile(file, newString, 'utf8')
+}
+
+function bumpNpmVersion(newVersion) {
+ if (DRY_RUN) {
+ return
+ }
+
+ execFile('npm', ['version', newVersion, '--no-git-tag'], { shell: true }, error => {
+ if (error) {
+ console.error(error)
+ process.exit(1)
+ }
+ })
+}
+
+function showUsage(args) {
+ console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
+ console.error('Got arguments:', args)
+ process.exit(1)
+}
+
+async function main(args) {
+ let [oldVersion, newVersion] = args
+
+ if (!oldVersion || !newVersion) {
+ showUsage(args)
+ }
+
+ // Strip any leading `v` from arguments because
+ // otherwise we will end up with duplicate `v`s
+ [oldVersion, newVersion] = [oldVersion, newVersion].map(arg => {
+ return arg.startsWith('v') ? arg.slice(1) : arg
+ })
+
+ if (oldVersion === newVersion) {
+ showUsage(args)
+ }
+
+ bumpNpmVersion(newVersion)
+
+ try {
+ await Promise.all(
+ FILES.map(file => replaceRecursively(file, oldVersion, newVersion))
+ )
+ } catch (error) {
+ console.error(error)
+ process.exit(1)
+ }
+}
+
+main(process.argv.slice(2))
diff --git a/build/changelog-template.hbs b/build/changelog-template.hbs
deleted file mode 100644
index 0f7c91fb8d..0000000000
--- a/build/changelog-template.hbs
+++ /dev/null
@@ -1,47 +0,0 @@
-# Changelog
-
-{{#each releases}}
-{{#if href}}
-## {{#unless major}}{{/unless}}[{{title}}]({{href}})
-{{else}}
-## {{title}}
-{{/if}}
-
-{{#if tag}}
-> {{niceDate}}
-{{/if}}
-{{#if summary}}
-
-{{summary}}
-{{/if}}
-{{#if commits}}
-
-{{! List commits with `feat: ` somewhere in the message }}
-{{#commit-list commits heading='### Features' message='feat:|feat(.*): '}}
- - {{subject}} [`{{shorthash}}`]({{href}})
-{{/commit-list}}
-
-{{! List commits with `fix: ` somewhere in the message }}
-{{#commit-list commits heading='### Fix' message='fix:|fix(.*): '}}
- - {{subject}} [`{{shorthash}}`]({{href}})
-{{/commit-list}}
-
-{{! List commits with `refactor: ` somewhere in the message }}
-{{#commit-list commits heading='### Refactor' message='refactor:|refactor(.*): '}}
- - {{subject}} [`{{shorthash}}`]({{href}})
-{{/commit-list}}
-
-{{!-- {{#each commits}}
-- {{#if breaking}}**Breaking change:** {{/if}}{{subject}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}}
-{{/each}} --}}
-
-{{/if}}
-{{!-- {{#if fixes}}
-
-### Fixed
-
-{{#each fixes}}
-- {{commit.subject}}{{#each fixes}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}{{/each}}
-{{/each}}
-{{/if}} --}}
-{{/each}}
diff --git a/build/generate-sri.js b/build/generate-sri.mjs
similarity index 53%
rename from build/generate-sri.js
rename to build/generate-sri.mjs
index 4f5cfd50df..6a9e064738 100644
--- a/build/generate-sri.js
+++ b/build/generate-sri.mjs
@@ -5,25 +5,25 @@
* Remember to use the same vendor files as the CDN ones,
* otherwise the hashes won't match!
*
- * Copyright 2017-2022 The Bootstrap Authors
- * Copyright 2017-2022 Twitter, Inc.
+ * Copyright 2017-2023 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
-'use strict'
+import crypto from 'node:crypto'
+import fs from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import sh from 'shelljs'
-const crypto = require('node:crypto')
-const fs = require('node:fs')
-const path = require('node:path')
-const sh = require('shelljs')
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
sh.config.fatal = true
-const configFile = path.join(__dirname, '../config.yml')
+const configFile = path.join(__dirname, '../hugo.yml')
// Array of objects which holds the files to generate SRI hashes for.
// `file` is the path from the root folder
-// `configPropertyName` is the config.yml variable's name of the file
+// `configPropertyName` is the hugo.yml variable's name of the file
const files = [
{
file: 'dist/css/coreui.min.css',
@@ -47,18 +47,18 @@ const files = [
}
]
-for (const file of files) {
- fs.readFile(file.file, 'utf8', (error, data) => {
+for (const { file, configPropertyName } of files) {
+ fs.readFile(file, 'utf8', (error, data) => {
if (error) {
throw error
}
- const algo = 'sha384'
- const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64')
- const integrity = `${algo}-${hash}`
+ const algorithm = 'sha384'
+ const hash = crypto.createHash(algorithm).update(data, 'utf8').digest('base64')
+ const integrity = `${algorithm}-${hash}`
- console.log(`${file.configPropertyName}: ${integrity}`)
+ console.log(`${configPropertyName}: ${integrity}`)
- sh.sed('-i', new RegExp(`^(\\s+${file.configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile)
+ sh.sed('-i', new RegExp(`^(\\s+${configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile)
})
}
diff --git a/build/postcss.config.js b/build/postcss.config.mjs
similarity index 87%
rename from build/postcss.config.js
rename to build/postcss.config.mjs
index 5519e7e69d..b154cae6e5 100644
--- a/build/postcss.config.js
+++ b/build/postcss.config.mjs
@@ -1,12 +1,10 @@
-'use strict'
-
const mapConfig = {
inline: false,
annotation: true,
sourcesContent: true
}
-module.exports = context => {
+export default context => {
return {
map: context.file.dirname.includes('examples') ? false : mapConfig,
plugins: {
diff --git a/build/rollup.config.js b/build/rollup.config.mjs
similarity index 62%
rename from build/rollup.config.js
rename to build/rollup.config.mjs
index 4693ce5fce..3ee32ee2fe 100644
--- a/build/rollup.config.js
+++ b/build/rollup.config.mjs
@@ -1,15 +1,17 @@
-'use strict'
+import path from 'node:path'
+import process from 'node:process'
+import { fileURLToPath } from 'node:url'
+import { babel } from '@rollup/plugin-babel'
+import { nodeResolve } from '@rollup/plugin-node-resolve'
+import replace from '@rollup/plugin-replace'
+import banner from './banner.mjs'
-const path = require('node:path')
-const { babel } = require('@rollup/plugin-babel')
-const { nodeResolve } = require('@rollup/plugin-node-resolve')
-const replace = require('@rollup/plugin-replace')
-const banner = require('./banner.js')
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'
-let fileDestination = `coreui${ESM ? '.esm' : ''}`
+let destinationFile = `coreui${ESM ? '.esm' : ''}`
const external = ['@popperjs/core']
const plugins = [
babel({
@@ -24,7 +26,7 @@ const globals = {
}
if (BUNDLE) {
- fileDestination += '.bundle'
+ destinationFile += '.bundle'
// Remove last entry in external array to bundle Popper
external.pop()
delete globals['@popperjs/core']
@@ -40,8 +42,8 @@ if (BUNDLE) {
const rollupConfig = {
input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
output: {
- banner,
- file: path.resolve(__dirname, `../dist/js/${fileDestination}.js`),
+ banner: banner(),
+ file: path.resolve(__dirname, `../dist/js/${destinationFile}.js`),
format: ESM ? 'esm' : 'umd',
globals,
generatedCode: 'es2015'
@@ -54,4 +56,4 @@ if (!ESM) {
rollupConfig.output.name = 'coreui'
}
-module.exports = rollupConfig
+export default rollupConfig
diff --git a/build/ship.sh b/build/ship.sh
deleted file mode 100644
index da5a03bcd1..0000000000
--- a/build/ship.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-#
-# Usage
-# ---------------
-# 1. Clone second version of Bootstrap in sibling directory named `bs-docs`.
-# 2. Within `bs-docs` copy, switch to `gh-pages` branch.
-# 3. Pull latest, re-bundle, re-npm.
-# 4. Run script.
-
-red=$'\e[1;31m'
-green=$'\e[1;32m'
-#blue=$'\e[1;34m'
-magenta=$'\e[1;35m'
-#cyan=$'\e[1;36m'
-end=$'\e[0m'
-
-# Get current version from package.json
-current_version=$(node -p "require('./package.json').version")
-
-if [[ $# -lt 1 ]]; then
- printf "\n%s⚠️ Shipping aborted. You must specify a version.\n%s" "$red" "$end"
- exit 1
-fi
-
-# Pulling latest changes, just to be sure
-printf "\n%s=======================================================%s" "$magenta" "$end"
-printf "\n%sPulling latest changes...%s" "$magenta" "$end"
-printf "\n%s=======================================================\n\n%s" "$magenta" "$end"
-git pull origin main
-
-# Update version number
-printf "\n%s=======================================================%s" "$magenta" "$end"
-printf "\n%sUpdating version number...%s" "$magenta" "$end"
-printf "\n%s=======================================================\n%s" "$magenta" "$end"
-npm run release-version "$current_version" "$1"
-
-# Build release
-printf "\n%s=======================================================%s" "$magenta" "$end"
-printf "\n%sBuilding release...%s" "$magenta" "$end"
-printf "\n%s=======================================================\n%s" "$magenta" "$end"
-npm run release
-
-# Copy the contents of the built docs site over to `bs-docs` repo
-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/
-printf "\nDone!\n"
-
-printf "\n%s=======================================================%s" "$green" "$end"
-printf "\n%sSuccess, $1 is ready to review and publish.%s" "$green" "$end"
-printf "\n%s=======================================================\n\n%s" "$green" "$end"
diff --git a/build/vnu-jar.js b/build/vnu-jar.mjs
similarity index 82%
rename from build/vnu-jar.js
rename to build/vnu-jar.mjs
index 13ef286990..f1644d1ed3 100644
--- a/build/vnu-jar.js
+++ b/build/vnu-jar.mjs
@@ -2,22 +2,22 @@
/*!
* Script to run vnu-jar if Java is available.
- * Copyright 2017-2022 The Bootstrap Authors
- * Copyright 2017-2022 Twitter, Inc.
+ * Copyright 2017-2023 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
-'use strict'
-
-const { execFile, spawn } = require('node:child_process')
-const vnu = require('vnu-jar')
+import { execFile, spawn } from 'node:child_process'
+import vnu from 'vnu-jar'
execFile('java', ['-version'], (error, stdout, stderr) => {
if (error) {
- console.error('Skipping vnu-jar test; Java is missing.')
+ console.error('Skipping vnu-jar test; Java is probably missing.')
+ console.error(error)
return
}
+ console.log('Running vnu-jar validation...')
+
const is32bitJava = !/64-Bit/.test(stderr)
// vnu-jar accepts multiple ignores joined with a `|`.
@@ -40,7 +40,7 @@ execFile('java', ['-version'], (error, stdout, stderr) => {
'--skip-non-html',
'--Werror',
`--filterpattern "${ignores}"`,
- '_gh_pages/',
+ '_site/',
'js/tests/'
]
@@ -49,9 +49,11 @@ execFile('java', ['-version'], (error, stdout, stderr) => {
args.splice(0, 0, '-Xss512k')
}
+ console.log(`command used: java ${args.join(' ')}`)
+
return spawn('java', args, {
shell: true,
stdio: 'inherit'
})
.on('exit', process.exit)
-})
+})
\ No newline at end of file
diff --git a/build/zip-examples.js b/build/zip-examples.js
deleted file mode 100644
index 72e76e1443..0000000000
--- a/build/zip-examples.js
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env node
-
-/*!
- * Script to create the built examples zip archive;
- * requires the `zip` command to be present!
- * Copyright 2020-2022 The Bootstrap Authors
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- */
-
-'use strict'
-
-const path = require('node:path')
-const sh = require('shelljs')
-
-const pkg = require('../package.json')
-
-const versionShort = pkg.config.version_short
-const distFolder = `bootstrap-${pkg.version}-examples`
-const rootDocsDir = '_site'
-const docsDir = `${rootDocsDir}/docs/${versionShort}/`
-
-// these are the files we need in the examples
-const cssFiles = [
- 'coreui.min.css',
- 'coreui.min.css.map',
- 'coreui.rtl.min.css',
- 'coreui.rtl.min.css.map'
-]
-const jsFiles = [
- 'coreui.bundle.min.js',
- 'coreui.bundle.min.js.map'
-]
-const imgFiles = [
- 'bootstrap-logo.svg',
- 'bootstrap-logo-white.svg'
-]
-
-sh.config.fatal = true
-
-if (!sh.test('-d', rootDocsDir)) {
- throw new Error(`The "${rootDocsDir}" folder does not exist, did you forget building the docs?`)
-}
-
-// switch to the root dir
-sh.cd(path.join(__dirname, '..'))
-
-// remove any previously created folder/zip with the same name
-sh.rm('-rf', [distFolder, `${distFolder}.zip`])
-
-// create any folders so that `cp` works
-sh.mkdir('-p', [
- distFolder,
- `${distFolder}/assets/brand/`,
- `${distFolder}/assets/dist/css/`,
- `${distFolder}/assets/dist/js/`
-])
-
-sh.cp('-Rf', `${docsDir}/examples/*`, distFolder)
-
-for (const file of cssFiles) {
- sh.cp('-f', `${docsDir}/dist/css/${file}`, `${distFolder}/assets/dist/css/`)
-}
-
-for (const file of jsFiles) {
- sh.cp('-f', `${docsDir}/dist/js/${file}`, `${distFolder}/assets/dist/js/`)
-}
-
-for (const file of imgFiles) {
- sh.cp('-f', `${docsDir}/assets/brand/${file}`, `${distFolder}/assets/brand/`)
-}
-
-sh.rm(`${distFolder}/index.html`)
-
-// get all examples' HTML files
-for (const file of sh.find(`${distFolder}/**/*.html`)) {
- const fileContents = sh.cat(file)
- .toString()
- .replace(new RegExp(`"/docs/${versionShort}/`, 'g'), '"../')
- .replace(/"..\/dist\//g, '"../assets/dist/')
- .replace(/(/g, '$1>')
- .replace(/(')
- .replace(/( +)