diff --git a/packages/base/.eslintignore b/packages/base/.eslintignore index 05c2f9938221..0f6eb1a1a3aa 100644 --- a/packages/base/.eslintignore +++ b/packages/base/.eslintignore @@ -1,6 +1,7 @@ # Note: Changes to this file also must be applied to the top level .eslintignore file. test lib +overlay dist src/thirdparty bundle.esm.js diff --git a/packages/base/.npmignore b/packages/base/.npmignore index c541e51f5345..2c5713778af1 100644 --- a/packages/base/.npmignore +++ b/packages/base/.npmignore @@ -1,2 +1,3 @@ test/ +overlay/ !core diff --git a/packages/base/hash.txt b/packages/base/hash.txt index d150cdf0d8aa..d4c2bddc6733 100644 --- a/packages/base/hash.txt +++ b/packages/base/hash.txt @@ -1 +1 @@ -Jo7xX6Xqjqd/+p/wSl0hl57d8ng= \ No newline at end of file +Jo7xX6Xqjqd/+p/wSl0hl57d8ng= diff --git a/packages/base/package-scripts.js b/packages/base/package-scripts.js index e4f5a0b7fbce..8cb593614d8b 100644 --- a/packages/base/package-scripts.js +++ b/packages/base/package-scripts.js @@ -4,12 +4,31 @@ const assetParametersScript = resolve.sync("@ui5/webcomponents-base/lib/generate const serve = resolve.sync("@ui5/webcomponents-tools/lib/serve/index.js"); const generateHash = resolve.sync("@ui5/webcomponents-tools/lib/hash/generate.js"); const hashIsUpToDate = resolve.sync("@ui5/webcomponents-tools/lib/hash/upToDate.js"); +const copyUsedModules = resolve.sync("@ui5/webcomponents-tools/lib/copy-list/index.js"); +const replaceGlobalCore = resolve.sync("@ui5/webcomponents-tools/lib/replace-global-core/index.js"); +const esmAbsToRel = resolve.sync("@ui5/webcomponents-tools/lib/esm-abs-to-rel/index.js"); const UP_TO_DATE = `node "${hashIsUpToDate}" dist/ hash.txt && echo "Up to date."`; const scripts = { clean: "rimraf dist && rimraf .port", lint: "eslint . --config config/.eslintrc.js", - prepare: "nps clean copy generateAssetParameters", + prepare: "nps clean integrate copy generateAssetParameters", + integrate: { + default: "nps integrate.copy-used-modules integrate.copy-overlay integrate.replace-amd integrate.replace-export-true integrate.replace-export-false integrate.amd-to-es6 integrate.replace-global-core-usage integrate.esm-abs-to-rel integrate.third-party", + "copy-used-modules": `node ${copyUsedModules} ./used-modules.txt dist/`, + "copy-overlay": `copy-and-watch "overlay/**/*.js" dist/`, + "replace-amd": "replace-in-file sap.ui.define define dist/**/*.js", + "replace-export-true": `replace-in-file ", /* bExport= */ true" "" dist/**/*.js`, + "replace-export-false": `replace-in-file ", /* bExport= */ false" "" dist/**/*.js`, + "amd-to-es6": "amdtoes6 --src=dist/ --replace --glob=**/*.js", + "replace-global-core-usage": `node ${replaceGlobalCore} dist/`, + "esm-abs-to-rel": `node ${esmAbsToRel} dist/ dist/`, + "third-party": { + default: "nps integrate.third-party.copy integrate.third-party.fix", + copy: "mkdirp dist/sap/ui/thirdparty/ && copy-and-watch ../../node_modules/@openui5/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js dist/sap/ui/thirdparty/", + fix: "replace-in-file 240 xA0 dist/sap/ui/thirdparty/caja-html-sanitizer.js" + }, + }, build: { default: `${UP_TO_DATE} || nps lint prepare build.bundle hash`, bundle: "rollup --config config/rollup.config.js", diff --git a/packages/base/package.json b/packages/base/package.json index 1e3d684fc39d..1d9f0ba971f2 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -36,12 +36,15 @@ }, "devDependencies": { "@ui5/webcomponents-tools": "1.0.0-rc.14", + "@buxlabs/amd-to-es6": "0.16.0", + "@openui5/sap.ui.core": "1.87.3", "array-uniq": "^2.0.0", "chromedriver": "92.0.0", "copy-and-watch": "^0.1.5", "eslint": "^7.22.0", "eslint-config-airbnb-base": "^14.2.1", "npm-run-all": "^4.1.5", - "path-exists-cli": "^1.0.0" + "path-exists-cli": "^1.0.0", + "replace-in-file": "^6.2.0" } } diff --git a/packages/base/src/util/HTMLSanitizer.js b/packages/base/src/util/HTMLSanitizer.js new file mode 100644 index 000000000000..d98642c25f41 --- /dev/null +++ b/packages/base/src/util/HTMLSanitizer.js @@ -0,0 +1,7 @@ +import sanitizeHTML from "../sap/base/security/sanitizeHTML.js"; +import URLListValidator from "../sap/base/security/URLListValidator.js"; + +export { + URLListValidator, + sanitizeHTML, +}; diff --git a/packages/base/used-modules.txt b/packages/base/used-modules.txt new file mode 100644 index 000000000000..8475f4df65af --- /dev/null +++ b/packages/base/used-modules.txt @@ -0,0 +1,7 @@ +# Needed files from OpenUI5 + +sap/base/util/now.js +sap/base/Log.js +sap/base/assert.js +sap/base/security/URLListValidator.js +sap/base/security/sanitizeHTML.js \ No newline at end of file diff --git a/packages/localization/package-scripts.js b/packages/localization/package-scripts.js index 0ab76d837ef8..77e395965d2f 100644 --- a/packages/localization/package-scripts.js +++ b/packages/localization/package-scripts.js @@ -1,6 +1,9 @@ const resolve = require("resolve"); const generateHash = resolve.sync("@ui5/webcomponents-tools/lib/hash/generate.js"); const hashIsUpToDate = resolve.sync("@ui5/webcomponents-tools/lib/hash/upToDate.js"); +const copyUsedModules = resolve.sync("@ui5/webcomponents-tools/lib/copy-list/index.js"); +const replaceGlobalCore = resolve.sync("@ui5/webcomponents-tools/lib/replace-global-core/index.js"); +const esmAbsToRel = resolve.sync("@ui5/webcomponents-tools/lib/esm-abs-to-rel/index.js"); const UP_TO_DATE = `node ${hashIsUpToDate} dist/ hash.txt && echo "Up to date."`; const scripts = { @@ -13,12 +16,12 @@ const scripts = { "replace-export-true": `replace-in-file ", /* bExport= */ true" "" dist/**/*.js`, "replace-export-false": `replace-in-file ", /* bExport= */ false" "" dist/**/*.js`, "amd-to-es6": "amdtoes6 --src=dist --replace --glob=**/*.js", - "replace-global-core-usage": "node ./lib/replace-global-core/index.js dist/", - "esm-abs-to-rel": "node ./lib/esm-abs-to-rel/index.js dist/", + "replace-global-core-usage": `node ${replaceGlobalCore} dist/`, + "esm-abs-to-rel": `node ${esmAbsToRel} dist/`, jsonImports: "node ./lib/generate-json-imports/cldr.js" }, copy: { - "used-modules": "node ./lib/copy-list/index.js ./used-modules.txt dist/", + "used-modules": `node ${copyUsedModules} ./used-modules.txt dist/`, cldr: `copy-and-watch "../../node_modules/@openui5/sap.ui.core/src/sap/ui/core/cldr/*.json" dist/generated/assets/cldr/`, overlay: `copy-and-watch "overlay/**/*.js" dist/`, src: `copy-and-watch "src/**/*.js" dist/`, diff --git a/packages/main/bundle.common.js b/packages/main/bundle.common.js index 8f0dbae5a156..3637ac716810 100644 --- a/packages/main/bundle.common.js +++ b/packages/main/bundle.common.js @@ -94,6 +94,10 @@ import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js"; import { isIE } from "@ui5/webcomponents-base/dist/Device.js"; window.isIE = isIE; // attached to the window object for testing purposes +import { sanitizeHTML, URLListValidator } from "@ui5/webcomponents-base/dist/util/HTMLSanitizer.js"; +window.sanitizeHTML = sanitizeHTML; +window.URLListValidator = URLListValidator; + import { getAnimationMode, setAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js"; import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js"; import { getLanguage, setLanguage } from "@ui5/webcomponents-base/dist/config/Language.js"; diff --git a/packages/theme-base/css-vars-usage.json b/packages/theme-base/css-vars-usage.json index c2a3eacb8013..cf9756f60c35 100644 --- a/packages/theme-base/css-vars-usage.json +++ b/packages/theme-base/css-vars-usage.json @@ -32,6 +32,7 @@ "--sapButton_Attention_BorderColor", "--sapButton_Attention_Hover_Background", "--sapButton_Attention_Hover_BorderColor", + "--sapButton_Attention_Hover_TextColor", "--sapButton_Attention_TextColor", "--sapButton_Background", "--sapButton_BorderColor", diff --git a/packages/localization/lib/copy-list/index.js b/packages/tools/lib/copy-list/index.js similarity index 100% rename from packages/localization/lib/copy-list/index.js rename to packages/tools/lib/copy-list/index.js diff --git a/packages/localization/lib/esm-abs-to-rel/index.js b/packages/tools/lib/esm-abs-to-rel/index.js similarity index 100% rename from packages/localization/lib/esm-abs-to-rel/index.js rename to packages/tools/lib/esm-abs-to-rel/index.js diff --git a/packages/localization/lib/replace-global-core/index.js b/packages/tools/lib/replace-global-core/index.js similarity index 100% rename from packages/localization/lib/replace-global-core/index.js rename to packages/tools/lib/replace-global-core/index.js diff --git a/yarn.lock b/yarn.lock index 27236986b8a8..6e7cc7c2bd11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -856,7 +856,7 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" -"@buxlabs/amd-to-es6@^0.16.0": +"@buxlabs/amd-to-es6@0.16.0", "@buxlabs/amd-to-es6@^0.16.0": version "0.16.0" resolved "https://registry.yarnpkg.com/@buxlabs/amd-to-es6/-/amd-to-es6-0.16.0.tgz#172a4fc04ffe033e96c67b5b897e83d59d8377b5" integrity sha512-6wTVkChKcbWcg4Kio61j9HnT7SWMBVbv+y7pu96RvpoMyM/qF/th7x8SqTavnEhLfFjeJPG51fthSdRurGKpsQ==