From 2fbf95e9cc37df20cbadb2285744ba5560682415 Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Thu, 26 Dec 2024 23:07:43 +0100 Subject: [PATCH 1/8] accessibility(Buttons) implemented focus state #81 --- sass/components/_buttons.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sass/components/_buttons.scss b/sass/components/_buttons.scss index 8c3cecc7ae..dbf1767a30 100644 --- a/sass/components/_buttons.scss +++ b/sass/components/_buttons.scss @@ -126,6 +126,10 @@ //------------------ Focus +.btn:focus { + background-color: var(--md-sys-color-primary-container); +} + .btn:focus.elevated { @extend .z-depth-1; color: var(--md-sys-color-primary); From 7c8fbac9cc2b4f0b84e2af4c2efca25e399470f8 Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Thu, 26 Dec 2024 23:08:11 +0100 Subject: [PATCH 2/8] accessibility(Tabs) implemented focus state #81 --- sass/components/_tabs.scss | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/sass/components/_tabs.scss b/sass/components/_tabs.scss index a62890e595..aee2f454d1 100644 --- a/sass/components/_tabs.scss +++ b/sass/components/_tabs.scss @@ -37,6 +37,7 @@ &.tabs-fixed-width { display: flex; + .tab { flex-grow: 1; } @@ -44,7 +45,7 @@ position: relative; overflow-x: auto; - overflow-y: hidden; + overflow-y: hidden; width: 100%; background-color: var(--md-sys-color-surface); margin: 0 auto; @@ -55,14 +56,14 @@ list-style-type: none; display: inline-block; text-align: center; - line-height: 48px; + line-height: 48px; padding: 0; margin: 0; i.material-icons { position: relative; - top: 8px; - vertical-align: middle; + top: 8px; + vertical-align: middle; } span { @@ -85,15 +86,22 @@ background-color: rgba(var(--md-sys-color-primary-numeric), 0.06); } - &:focus, + &:focus { + background-color: var(--md-sys-color-primary-container); + } + &.active { background-color: rgba(var(--md-sys-color-primary-numeric), 0.18); + } + + &:focus, + &.active { outline: none; } color: var(--md-sys-color-on-surface-variant); display: flex; - flex-direction: column; + flex-direction: column; width: 100%; height: 100%; min-height: 48px; //needed for only-icons tabs @@ -109,6 +117,7 @@ &:not(:focus) { background-color: transparent; } + color: var(--md-sys-color-on-surface); cursor: default; background-color: transparent; @@ -123,19 +132,19 @@ will-change: left, right; border-radius: 3px 3px 0 0; } - - &.tabs-horizontal .tab { + + &.tabs-horizontal .tab { height: 48px; a { display: block; } - + i.material-icons { padding: 0 4px; - position: relative; - top: -2px; - vertical-align: middle; + position: relative; + top: -2px; + vertical-align: middle; } } } @@ -145,8 +154,10 @@ @media #{$medium-and-down} { .tabs { display: flex; + .tab { flex-grow: 1; + a { padding: 0 12px; } From 1dbde8463dbdcd227d9ae4051df73fed1225cdd5 Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Fri, 27 Dec 2024 04:20:49 +0100 Subject: [PATCH 3/8] config(Rollup) include autoprefixer and postcss; updated rollupconfig #568 --- package-lock.json | 266 +++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 + rollup.config.ts | 27 ++++- 3 files changed, 273 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 48c0df456b..1ad3e07aca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,10 +23,12 @@ "@rollup/plugin-typescript": "^11.1.6", "@types/node": "^20.5.2", "archiver": "^7.0.1", + "autoprefixer": "^9.8.6", "eslint": "^9.10.0", "jasmine": "^5.1.0", "jasmine-browser-runner": "^2.5.0", "jasmine-core": "^5.2.0", + "postcss": "^8.4.49", "rollup": "^4.20.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-dts": "^6.1.1", @@ -1401,6 +1403,54 @@ "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", "dev": true }, + "node_modules/autoprefixer": { + "version": "9.8.8", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.8.tgz", + "integrity": "sha512-eM9d/swFopRt5gdJ7jrpCwgvEMIayITpojhkkSMRsFHYuH5bkSQ4p/9qTEHtmNudUZh22Tehu7I6CxAW0IXTKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.12.0", + "caniuse-lite": "^1.0.30001109", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "picocolors": "^0.2.1", + "postcss": "^7.0.32", + "postcss-value-parser": "^4.1.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + } + }, + "node_modules/autoprefixer/node_modules/picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true, + "license": "ISC" + }, + "node_modules/autoprefixer/node_modules/postcss": { + "version": "7.0.39", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz", + "integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^0.2.1", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + } + }, "node_modules/b4a": { "version": "1.6.6", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", @@ -1503,6 +1553,39 @@ "node": ">=8" } }, + "node_modules/browserslist": { + "version": "4.24.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz", + "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -1573,6 +1656,27 @@ "node": ">=6" } }, + "node_modules/caniuse-lite": { + "version": "1.0.30001690", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", + "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1902,6 +2006,13 @@ "node": ">=0.10.0" } }, + "node_modules/electron-to-chromium": { + "version": "1.5.76", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.76.tgz", + "integrity": "sha512-CjVQyG7n7Sr+eBXE86HIulnL5N8xZY1sgmOPGuq/F0Rr0FJq63lg0kEtOIDfZBk44FnDLf6FUJ+dsJcuiUDdDQ==", + "dev": true, + "license": "ISC" + }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -1935,6 +2046,16 @@ "node": ">= 0.4" } }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -3360,6 +3481,25 @@ "dev": true, "license": "MIT" }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3375,6 +3515,13 @@ "node": ">= 0.6" } }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true, + "license": "MIT" + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3384,6 +3531,23 @@ "node": ">=0.10.0" } }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha512-Y1wZESM7VUThYY+4W+X4ySH2maqcA+p7UR+w8VWNWVAd6lwuXXWz/w/Cz43J/dI2I+PS6wD5N+bJUF+gjWvIqg==", + "dev": true, + "license": "MIT" + }, "node_modules/object-inspect": { "version": "1.13.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", @@ -3578,12 +3742,11 @@ } }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, - "license": "ISC", - "optional": true + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", @@ -3597,6 +3760,42 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -4213,11 +4412,22 @@ "dev": true, "license": "MIT" }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -4232,15 +4442,6 @@ "source-map": "^0.6.0" } }, - "node_modules/source-map-support/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -4581,6 +4782,37 @@ "node": ">= 0.8" } }, + "node_modules/update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index c53ca87e32..0c6724c035 100644 --- a/package.json +++ b/package.json @@ -57,10 +57,12 @@ "@rollup/plugin-typescript": "^11.1.6", "@types/node": "^20.5.2", "archiver": "^7.0.1", + "autoprefixer": "^9.8.6", "eslint": "^9.10.0", "jasmine": "^5.1.0", "jasmine-browser-runner": "^2.5.0", "jasmine-core": "^5.2.0", + "postcss": "^8.4.49", "rollup": "^4.20.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-dts": "^6.1.1", diff --git a/rollup.config.ts b/rollup.config.ts index 5a13433de5..d5e3664f61 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -7,6 +7,8 @@ import scss from 'rollup-plugin-scss'; import copy from 'rollup-plugin-copy'; import { readFileSync } from 'fs'; +import autoprefixer from 'autoprefixer'; +import postcss from 'postcss'; const packageJson = JSON.parse(readFileSync('./package.json').toString()); const outputPath = 'dist/js/materialize'; @@ -102,12 +104,25 @@ const config: RollupOptions[] = [ //--- CSS { input: 'sass/materialize.scss', + output: [{ file: 'dist/css/materialize.css' }], // overwritten + plugins: [ + scss({ + fileName: 'materialize.css', + processor: css => postcss([autoprefixer]).process(css).then(result => result.css), + }) + ], + onwarn: (warning, defaultHandler) => { + if (!(warning.code === 'FILE_NAME_CONFLICT' || warning.code === 'EMPTY_BUNDLE')) + defaultHandler(warning); + } + }, + { + input: 'dist/css/materialize.css', output: [{ file: 'dist/css/materialize.min.css' }], // overwritten plugins: [ scss({ fileName: 'materialize.min.css', - outputStyle: 'compressed', - sourceMap: true + sourceMap: true, }) ], onwarn: (warning, defaultHandler) => { @@ -116,11 +131,13 @@ const config: RollupOptions[] = [ } }, { - input: 'sass/materialize.scss', - output: [{ file: 'dist/css/materialize.css' }], // overwritten + input: 'dist/css/materialize.css', + output: [{ file: 'dist/css/materialize.min.css' }], // overwritten plugins: [ scss({ - fileName: 'materialize.css' + fileName: 'materialize.min.css', + outputStyle: 'compressed', + processor: (css, map) => postcss([autoprefixer]).process(css, { from: 'materialize.min.css' }).then(result => result.css), }) ], onwarn: (warning, defaultHandler) => { From b5c797baa0ff9eba92547b1d32240023a400a35e Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Fri, 27 Dec 2024 04:24:12 +0100 Subject: [PATCH 4/8] include environment build in npm release scripts and rollup configuration --- package.json | 4 ++-- rollup.config.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0c6724c035..cefc336d0a 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,9 @@ "lint": "eslint .", "test": "npm run build && jasmine-browser-runner runSpecs", "build": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript", - "release": "npm run lint && npm run build && node ci/compress.js", + "release": "npm run lint && npm run build -- --environment BUILD:release && node ci/compress.js", "preversion": "npm run lint && npm test", - "version": "npm run build && node ci/compress.js && git add ." + "version": "npm run build -- --environment BUILD:release && node ci/compress.js && git add ." }, "lint-staged": { "js/*.js": [ diff --git a/rollup.config.ts b/rollup.config.ts index d5e3664f61..5dd63e36e3 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -122,7 +122,7 @@ const config: RollupOptions[] = [ plugins: [ scss({ fileName: 'materialize.min.css', - sourceMap: true, + sourceMap: !(process.env.BUILD === 'release'), }) ], onwarn: (warning, defaultHandler) => { From 79b8121a68c4deb6c87fbe1737b1a9b216aac765 Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Fri, 27 Dec 2024 04:29:11 +0100 Subject: [PATCH 5/8] remove unused var --- rollup.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.ts b/rollup.config.ts index 5dd63e36e3..919f22f6fc 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -137,7 +137,7 @@ const config: RollupOptions[] = [ scss({ fileName: 'materialize.min.css', outputStyle: 'compressed', - processor: (css, map) => postcss([autoprefixer]).process(css, { from: 'materialize.min.css' }).then(result => result.css), + processor: (css) => postcss([autoprefixer]).process(css, { from: 'materialize.min.css' }).then(result => result.css), }) ], onwarn: (warning, defaultHandler) => { From 5bd16fcefb47de277c9d925e203ed51eca3f4acc Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Fri, 27 Dec 2024 04:59:02 +0100 Subject: [PATCH 6/8] config(Rollup) revert Rollupconfig to previous state and combine autoprefixing and sourcemapping into one function --- rollup.config.ts | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index 919f22f6fc..f011f11f7f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -21,6 +21,7 @@ const bannerText = `/*! * MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE) */`; +// @ts-ignore const config: RollupOptions[] = [ //--- Replace version in index.ts { @@ -104,25 +105,16 @@ const config: RollupOptions[] = [ //--- CSS { input: 'sass/materialize.scss', - output: [{ file: 'dist/css/materialize.css' }], // overwritten - plugins: [ - scss({ - fileName: 'materialize.css', - processor: css => postcss([autoprefixer]).process(css).then(result => result.css), - }) - ], - onwarn: (warning, defaultHandler) => { - if (!(warning.code === 'FILE_NAME_CONFLICT' || warning.code === 'EMPTY_BUNDLE')) - defaultHandler(warning); - } - }, - { - input: 'dist/css/materialize.css', output: [{ file: 'dist/css/materialize.min.css' }], // overwritten plugins: [ scss({ fileName: 'materialize.min.css', + outputStyle: 'compressed', sourceMap: !(process.env.BUILD === 'release'), + processor: (css, map) => ({ + css: postcss([autoprefixer]).process(css, { from: 'materialize.min.css' }).toString(), + map + }) }) ], onwarn: (warning, defaultHandler) => { @@ -131,12 +123,11 @@ const config: RollupOptions[] = [ } }, { - input: 'dist/css/materialize.css', - output: [{ file: 'dist/css/materialize.min.css' }], // overwritten + input: 'sass/materialize.scss', + output: [{ file: 'dist/css/materialize.css' }], // overwritten plugins: [ scss({ - fileName: 'materialize.min.css', - outputStyle: 'compressed', + fileName: 'materialize.css', processor: (css) => postcss([autoprefixer]).process(css, { from: 'materialize.min.css' }).then(result => result.css), }) ], From 801336563e101a2b936c7214514b8c1ac517a1d7 Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Fri, 27 Dec 2024 05:01:05 +0100 Subject: [PATCH 7/8] remove debug (ignore statement) --- rollup.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rollup.config.ts b/rollup.config.ts index f011f11f7f..e728c625fd 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -21,7 +21,6 @@ const bannerText = `/*! * MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE) */`; -// @ts-ignore const config: RollupOptions[] = [ //--- Replace version in index.ts { From 6102ebbd8c900d05c794814d97d231c16df2e76f Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Mon, 30 Dec 2024 19:51:04 +0100 Subject: [PATCH 8/8] enhancement(Utils) implemented confirmation container util methods poc #570 --- src/utils.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index a5ebf428aa..a3cff2d9c7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -283,4 +283,46 @@ export class Utils { return result; }; } + + /** + * Renders confirm/close buttons with callback function + */ + static createConfirmationContainer( + container: HTMLElement, + confirmText: string, + cancelText: string, + onConfirm: (Function: object) => void, + onCancel: (Function: object) => void + ): void { + const confirmationButtonsContainer = document.createElement('div'); + confirmationButtonsContainer.classList.add('confirmation-btns'); + container.append(confirmationButtonsContainer); + + this.createButton(confirmationButtonsContainer, cancelText, ['btn-cancel'], true, onCancel); + this.createButton(confirmationButtonsContainer, confirmText, ['btn-confirm'], true, onConfirm); + } + + /** + * Renders a button with optional callback function + */ + static createButton( + container: HTMLElement, + text: string, + className: string[] = [], + visibility: boolean = true, + callback: (Function: object) => void = null + ): void { + className = className.concat(['btn', 'waves-effect', 'text']); + const button = document.createElement('button'); + button.className = className.join(' '); + button.style.visibility = visibility ? 'visible' : 'hidden'; + button.type = 'button'; + button.tabIndex = !!visibility ? 0 : -1; + button.innerText = text; + button.addEventListener('click', callback); + button.addEventListener('keypress', (e) => { + if (Utils.keys.ENTER.includes(e.key)) callback(e); + }); + container.append(button); + } }