@ui5/webcomponents-base 2.21.0-rc.1 → 2.21.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/.tsbuildinfobuild +1 -1
  3. package/dist/config/ConfigurationSync.d.ts +16 -0
  4. package/dist/config/ConfigurationSync.js +42 -0
  5. package/dist/config/ConfigurationSync.js.map +1 -0
  6. package/dist/config/Language.js +13 -1
  7. package/dist/config/Language.js.map +1 -1
  8. package/dist/config/Theme.js +9 -1
  9. package/dist/config/Theme.js.map +1 -1
  10. package/dist/custom-elements-internal.json +21 -0
  11. package/dist/custom-elements.json +21 -0
  12. package/dist/generated/AssetParameters.js +1 -1
  13. package/dist/generated/AssetParameters.js.map +1 -1
  14. package/dist/generated/VersionInfo.js +3 -3
  15. package/dist/generated/VersionInfo.js.map +1 -1
  16. package/dist/prod/config/ConfigurationSync.js +2 -0
  17. package/dist/prod/config/ConfigurationSync.js.map +7 -0
  18. package/dist/prod/config/Language.js +1 -1
  19. package/dist/prod/config/Language.js.map +3 -3
  20. package/dist/prod/config/Theme.js +1 -1
  21. package/dist/prod/config/Theme.js.map +3 -3
  22. package/dist/prod/generated/AssetParameters.js +1 -1
  23. package/dist/prod/generated/AssetParameters.js.map +2 -2
  24. package/dist/prod/generated/VersionInfo.js +1 -1
  25. package/dist/prod/generated/VersionInfo.js.map +1 -1
  26. package/dist/prod/sap/base/Log.js +15 -29
  27. package/dist/prod/sap/base/assert.js +1 -1
  28. package/dist/prod/sap/base/config/MemoryConfigurationProvider.js +1 -1
  29. package/dist/prod/sap/base/security/URLListValidator.js +9 -5
  30. package/dist/prod/sap/base/security/encodeCSS.js +1 -1
  31. package/dist/prod/sap/base/security/encodeXML.js +1 -1
  32. package/dist/prod/sap/base/security/sanitizeHTML.js +1 -1
  33. package/dist/prod/sap/base/strings/toHex.js +1 -1
  34. package/dist/prod/sap/base/util/now.js +7 -13
  35. package/dist/prod/sap/base/util/uid.js +1 -1
  36. package/dist/prod/sap/ui/thirdparty/caja-html-sanitizer.js +15 -3
  37. package/dist/prod/util/generateHighlightedMarkupFirstMatch.js +2 -0
  38. package/dist/prod/util/generateHighlightedMarkupFirstMatch.js.map +7 -0
  39. package/dist/sap/base/Log.js +15 -29
  40. package/dist/sap/base/assert.js +1 -1
  41. package/dist/sap/base/config/MemoryConfigurationProvider.js +1 -1
  42. package/dist/sap/base/security/URLListValidator.js +9 -5
  43. package/dist/sap/base/security/encodeCSS.js +1 -1
  44. package/dist/sap/base/security/encodeXML.js +1 -1
  45. package/dist/sap/base/security/sanitizeHTML.js +1 -1
  46. package/dist/sap/base/strings/toHex.js +1 -1
  47. package/dist/sap/base/util/now.js +7 -13
  48. package/dist/sap/base/util/uid.js +1 -1
  49. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +15 -3
  50. package/dist/util/generateHighlightedMarkupFirstMatch.d.ts +10 -0
  51. package/dist/util/generateHighlightedMarkupFirstMatch.js +36 -0
  52. package/dist/util/generateHighlightedMarkupFirstMatch.js.map +1 -0
  53. package/package.json +4 -4
@@ -0,0 +1,36 @@
1
+ import escapeRegex from "./escapeRegex.js";
2
+ // @ts-expect-error
3
+ import encodeXML from "../sap/base/security/encodeXML.js";
4
+ /**
5
+ * Generate markup for a raw string where the first match following StartsWithPerTerm pattern is wrapped with `<b>` tag.
6
+ * StartsWithPerTerm pattern: finds the first word (at start or after whitespace) that starts with the search text.
7
+ * All inputs to this function are considered literal text, and special characters will always be escaped.
8
+ * @param {string} text The text to add highlighting to
9
+ * @param {string} textToHighlight The text which should be highlighted (case-insensitive)
10
+ * @return {string} the markup HTML which contains the first match surrounded with a `<b>` tag.
11
+ */
12
+ function generateHighlightedMarkupFirstMatch(text, textToHighlight) {
13
+ const normalizedText = text || "";
14
+ if (!normalizedText || !textToHighlight) {
15
+ return encodeXML(normalizedText);
16
+ }
17
+ const filterValue = textToHighlight.toLowerCase();
18
+ const lowerText = normalizedText.toLowerCase();
19
+ const matchLength = textToHighlight.length;
20
+ // Find the first word that starts with textToHighlight (StartsWithPerTerm pattern)
21
+ let matchIndex = lowerText.search(new RegExp(`(^|\\s)${escapeRegex(filterValue)}`));
22
+ if (matchIndex !== -1 && lowerText[matchIndex] === " ") {
23
+ matchIndex++; // Skip the space
24
+ }
25
+ // If no match found, return encoded text
26
+ if (matchIndex === -1) {
27
+ return encodeXML(normalizedText);
28
+ }
29
+ // Build highlighted markup with only the first match
30
+ const beforeMatch = encodeXML(normalizedText.substring(0, matchIndex));
31
+ const match = encodeXML(normalizedText.substring(matchIndex, matchIndex + matchLength));
32
+ const afterMatch = encodeXML(normalizedText.substring(matchIndex + matchLength));
33
+ return `${beforeMatch}<b>${match}</b>${afterMatch}`;
34
+ }
35
+ export default generateHighlightedMarkupFirstMatch;
36
+ //# sourceMappingURL=generateHighlightedMarkupFirstMatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateHighlightedMarkupFirstMatch.js","sourceRoot":"","sources":["../../src/util/generateHighlightedMarkupFirstMatch.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,mBAAmB;AACnB,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAE1D;;;;;;;GAOG;AACH,SAAS,mCAAmC,CAAC,IAAY,EAAE,eAAuB;IACjF,MAAM,cAAc,GAAG,IAAI,IAAI,EAAE,CAAC;IAElC,IAAI,CAAC,cAAc,IAAI,CAAC,eAAe,EAAE,CAAC;QACzC,OAAO,SAAS,CAAC,cAAc,CAAW,CAAC;IAC5C,CAAC;IAED,MAAM,WAAW,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IAClD,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAC/C,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC;IAE3C,mFAAmF;IACnF,IAAI,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;IACpF,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC;QACxD,UAAU,EAAE,CAAC,CAAC,iBAAiB;IAChC,CAAC;IAED,yCAAyC;IACzC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC,cAAc,CAAW,CAAC;IAC5C,CAAC;IAED,qDAAqD;IACrD,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAW,CAAC;IACjF,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC,CAAW,CAAC;IAClG,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,GAAG,WAAW,CAAC,CAAW,CAAC;IAE3F,OAAO,GAAG,WAAW,MAAM,KAAK,OAAO,UAAU,EAAE,CAAC;AACrD,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["import escapeRegex from \"./escapeRegex.js\";\n// @ts-expect-error\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\n/**\n * Generate markup for a raw string where the first match following StartsWithPerTerm pattern is wrapped with `<b>` tag.\n * StartsWithPerTerm pattern: finds the first word (at start or after whitespace) that starts with the search text.\n * All inputs to this function are considered literal text, and special characters will always be escaped.\n * @param {string} text The text to add highlighting to\n * @param {string} textToHighlight The text which should be highlighted (case-insensitive)\n * @return {string} the markup HTML which contains the first match surrounded with a `<b>` tag.\n */\nfunction generateHighlightedMarkupFirstMatch(text: string, textToHighlight: string): string {\n\tconst normalizedText = text || \"\";\n\n\tif (!normalizedText || !textToHighlight) {\n\t\treturn encodeXML(normalizedText) as string;\n\t}\n\n\tconst filterValue = textToHighlight.toLowerCase();\n\tconst lowerText = normalizedText.toLowerCase();\n\tconst matchLength = textToHighlight.length;\n\n\t// Find the first word that starts with textToHighlight (StartsWithPerTerm pattern)\n\tlet matchIndex = lowerText.search(new RegExp(`(^|\\\\s)${escapeRegex(filterValue)}`));\n\tif (matchIndex !== -1 && lowerText[matchIndex] === \" \") {\n\t\tmatchIndex++; // Skip the space\n\t}\n\n\t// If no match found, return encoded text\n\tif (matchIndex === -1) {\n\t\treturn encodeXML(normalizedText) as string;\n\t}\n\n\t// Build highlighted markup with only the first match\n\tconst beforeMatch = encodeXML(normalizedText.substring(0, matchIndex)) as string;\n\tconst match = encodeXML(normalizedText.substring(matchIndex, matchIndex + matchLength)) as string;\n\tconst afterMatch = encodeXML(normalizedText.substring(matchIndex + matchLength)) as string;\n\n\treturn `${beforeMatch}<b>${match}</b>${afterMatch}`;\n}\n\nexport default generateHighlightedMarkupFirstMatch;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-base",
3
- "version": "2.21.0-rc.1",
3
+ "version": "2.21.0-rc.3",
4
4
  "description": "UI5 Web Components: webcomponents.base",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -63,10 +63,10 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@custom-elements-manifest/analyzer": "^0.10.10",
66
- "@openui5/sap.ui.core": "1.120.17",
66
+ "@openui5/sap.ui.core": "1.146.0",
67
67
  "@sap-theming/theming-base-content": "11.34.1",
68
68
  "@ui5/cypress-internal": "0.1.0",
69
- "@ui5/webcomponents-tools": "2.21.0-rc.1",
69
+ "@ui5/webcomponents-tools": "2.21.0-rc.3",
70
70
  "clean-css": "^5.2.2",
71
71
  "cypress": "15.9.0",
72
72
  "mocha": "^11.7.2",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  },
87
87
  "customElements": "dist/custom-elements.json",
88
- "gitHead": "ca81ad3bb0594ea51472c46d517d34d7e0a719b8"
88
+ "gitHead": "a30970028a6aa6511315fc6b9f24e44ace0e66b1"
89
89
  }