@ui5/webcomponents-base 2.29.0-rc.0 → 2.29.0-rc.1

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.
@@ -1,11 +1,11 @@
1
1
  const VersionInfo = {
2
- version: "2.29.0-rc.0",
2
+ version: "2.29.0-rc.1",
3
3
  major: 2,
4
4
  minor: 29,
5
5
  patch: 0,
6
- suffix: "-rc.0",
6
+ suffix: "-rc.1",
7
7
  isNext: false,
8
- buildTime: 1793349173,
8
+ buildTime: 1794298252,
9
9
  };
10
10
  export default VersionInfo;
11
11
  //# sourceMappingURL=VersionInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.29.0-rc.0\",\n\tmajor: 2,\n\tminor: 29,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1793349173,\n};\nexport default VersionInfo;"]}
1
+ {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.29.0-rc.1\",\n\tmajor: 2,\n\tminor: 29,\n\tpatch: 0,\n\tsuffix: \"-rc.1\",\n\tisNext: false,\n\tbuildTime: 1794298252,\n};\nexport default VersionInfo;"]}
@@ -1,2 +1,2 @@
1
- "use strict";const e={version:"2.29.0-rc.0",major:2,minor:29,patch:0,suffix:"-rc.0",isNext:!1,buildTime:1793349173};export default e;
1
+ "use strict";const e={version:"2.29.0-rc.1",major:2,minor:29,patch:0,suffix:"-rc.1",isNext:!1,buildTime:1794298252};export default e;
2
2
  //# sourceMappingURL=VersionInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/generated/VersionInfo.ts"],
4
- "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.29.0-rc.0\",\n\tmajor: 2,\n\tminor: 29,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1793349173,\n};\nexport default VersionInfo;"],
4
+ "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.29.0-rc.1\",\n\tmajor: 2,\n\tminor: 29,\n\tpatch: 0,\n\tsuffix: \"-rc.1\",\n\tisNext: false,\n\tbuildTime: 1794298252,\n};\nexport default VersionInfo;"],
5
5
  "mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,cACT,MAAO,EACP,MAAO,GACP,MAAO,EACP,OAAQ,QACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
6
6
  "names": ["VersionInfo"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/util/generateHighlightedMarkup.ts"],
4
- "sourcesContent": ["import escapeRegex from \"./escapeRegex.js\";\n// @ts-ignore\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\n// utility to replace all occurances of a string\nfunction replaceAll(text: string, find: string, replace: string | ((substring: string, ...args: any[]) => string), caseInsensitive: boolean) {\n\treturn text.replaceAll(new RegExp(escapeRegex(find), `${caseInsensitive ? \"i\" : \"\"}g`), replace as string);\n}\n\n/**\n * Generate markup for a raw string where a particular text is wrapped with some tag, by default `<b>` (bold) tag.\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\n * @return {string} the markup HTML which contains all occurrances of the input text surrounded with a `<b>` tag.\n */\nfunction generateHighlightedMarkup(text: string, textToHighlight: string) {\n\tif (!text || !textToHighlight) {\n\t\treturn text;\n\t}\n\t// a token is some string that does not appear in either of the input strings\n\t// repeat the token until it does not appear in the string\n\tconst makeToken = (t: string) => {\n\t\tconst [s, e] = t.split(\"\");\n\t\twhile (text.indexOf(t) >= 0 || textToHighlight.indexOf(t) >= 0) {\n\t\t\tt = `${s}${t}${e}`;\n\t\t}\n\t\treturn t;\n\t};\n\t// It doesn't matter what characters are used as long as all 4 of them are unique\n\t// And also that encodeXML will not change these characters\n\tconst openToken = makeToken(\"12\");\n\tconst closeToken = makeToken(\"34\");\n\t// wrap every occurance of the textToHighlight using the open/close tokens (instead of markup at this point)\n\tlet result = encodeXML(replaceAll(text, textToHighlight, (match: string) => `${openToken}${match}${closeToken}`, true)) as string;\n\t// now replace the open and close tokens with the markup that we expect\n\t[[openToken, \"<b>\"], [closeToken, \"</b>\"]].forEach(([find, replace]) => {\n\t\tresult = replaceAll(result, find, replace, false);\n\t});\n\treturn result;\n}\n\nexport default generateHighlightedMarkup;\n"],
5
- "mappings": "aAAA,OAAOA,MAAiB,mBAExB,OAAOC,MAAe,oCAGtB,SAASC,EAAWC,EAAcC,EAAcC,EAAmEC,EAA0B,CAC5I,OAAOH,EAAK,WAAW,IAAI,OAAOH,EAAYI,CAAI,EAAG,GAAGE,EAAkB,IAAM,EAAE,GAAG,EAAGD,CAAiB,CAC1G,CASA,SAASE,EAA0BJ,EAAcK,EAAyB,CACzE,GAAI,CAACL,GAAQ,CAACK,EACb,OAAOL,EAIR,MAAMM,EAAaC,GAAc,CAChC,KAAM,CAACC,EAAGC,CAAC,EAAIF,EAAE,MAAM,EAAE,EACzB,KAAOP,EAAK,QAAQO,CAAC,GAAK,GAAKF,EAAgB,QAAQE,CAAC,GAAK,GAC5DA,EAAI,GAAGC,CAAC,GAAGD,CAAC,GAAGE,CAAC,GAEjB,OAAOF,CACR,EAGMG,EAAYJ,EAAU,IAAI,EAC1BK,EAAaL,EAAU,IAAI,EAEjC,IAAIM,EAASd,EAAUC,EAAWC,EAAMK,EAAkBQ,GAAkB,GAAGH,CAAS,GAAGG,CAAK,GAAGF,CAAU,GAAI,EAAI,CAAC,EAEtH,OAAC,CAACD,EAAW,KAAK,EAAG,CAACC,EAAY,MAAM,CAAC,EAAE,QAAQ,CAAC,CAACV,EAAMC,CAAO,IAAM,CACvEU,EAASb,EAAWa,EAAQX,EAAMC,EAAS,EAAK,CACjD,CAAC,EACMU,CACR,CAEA,eAAeR",
4
+ "sourcesContent": ["import escapeRegex from \"./escapeRegex.js\";\n// @ts-ignore\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\n// utility to replace all occurances of a string\nfunction replaceAll(text: string, find: string, replace: string | ((substring: string, ...args: any[]) => string), caseInsensitive: boolean) {\n\treturn text.replaceAll(new RegExp(escapeRegex(find), `${caseInsensitive ? \"i\" : \"\"}g`), replace as string);\n}\n\n/**\n * Generate markup for a raw string where a particular text is wrapped with a `<b>` (bold) tag.\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\n * @return {string} the markup HTML which contains all occurrances of the input text surrounded with a `<b>` tag.\n * @deprecated Use `highlightText` from `@ui5/webcomponents-base/dist/util/highlightText.js` instead.\n */\nfunction generateHighlightedMarkup(text: string, textToHighlight: string) {\n\tif (!text || !textToHighlight) {\n\t\treturn text;\n\t}\n\t// a token is some string that does not appear in either of the input strings\n\t// repeat the token until it does not appear in the string\n\tconst makeToken = (t: string) => {\n\t\tconst [s, e] = t.split(\"\");\n\t\twhile (text.indexOf(t) >= 0 || textToHighlight.indexOf(t) >= 0) {\n\t\t\tt = `${s}${t}${e}`;\n\t\t}\n\t\treturn t;\n\t};\n\t// It doesn't matter what characters are used as long as all 4 of them are unique\n\t// And also that encodeXML will not change these characters\n\tconst openToken = makeToken(\"12\");\n\tconst closeToken = makeToken(\"34\");\n\t// wrap every occurance of the textToHighlight using the open/close tokens (instead of markup at this point)\n\tlet result = encodeXML(replaceAll(text, textToHighlight, (match: string) => `${openToken}${match}${closeToken}`, true)) as string;\n\t// now replace the open and close tokens with the markup that we expect\n\t[[openToken, \"<b>\"], [closeToken, \"</b>\"]].forEach(([find, replace]) => {\n\t\tresult = replaceAll(result, find, replace, false);\n\t});\n\treturn result;\n}\n\nexport default generateHighlightedMarkup;\n"],
5
+ "mappings": "aAAA,OAAOA,MAAiB,mBAExB,OAAOC,MAAe,oCAGtB,SAASC,EAAWC,EAAcC,EAAcC,EAAmEC,EAA0B,CAC5I,OAAOH,EAAK,WAAW,IAAI,OAAOH,EAAYI,CAAI,EAAG,GAAGE,EAAkB,IAAM,EAAE,GAAG,EAAGD,CAAiB,CAC1G,CAUA,SAASE,EAA0BJ,EAAcK,EAAyB,CACzE,GAAI,CAACL,GAAQ,CAACK,EACb,OAAOL,EAIR,MAAMM,EAAaC,GAAc,CAChC,KAAM,CAACC,EAAGC,CAAC,EAAIF,EAAE,MAAM,EAAE,EACzB,KAAOP,EAAK,QAAQO,CAAC,GAAK,GAAKF,EAAgB,QAAQE,CAAC,GAAK,GAC5DA,EAAI,GAAGC,CAAC,GAAGD,CAAC,GAAGE,CAAC,GAEjB,OAAOF,CACR,EAGMG,EAAYJ,EAAU,IAAI,EAC1BK,EAAaL,EAAU,IAAI,EAEjC,IAAIM,EAASd,EAAUC,EAAWC,EAAMK,EAAkBQ,GAAkB,GAAGH,CAAS,GAAGG,CAAK,GAAGF,CAAU,GAAI,EAAI,CAAC,EAEtH,OAAC,CAACD,EAAW,KAAK,EAAG,CAACC,EAAY,MAAM,CAAC,EAAE,QAAQ,CAAC,CAACV,EAAMC,CAAO,IAAM,CACvEU,EAASb,EAAWa,EAAQX,EAAMC,EAAS,EAAK,CACjD,CAAC,EACMU,CACR,CAEA,eAAeR",
6
6
  "names": ["escapeRegex", "encodeXML", "replaceAll", "text", "find", "replace", "caseInsensitive", "generateHighlightedMarkup", "textToHighlight", "makeToken", "t", "s", "e", "openToken", "closeToken", "result", "match"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import l from"../sap/base/security/encodeXML.js";function f(n){const e=[],i=[];let o=0;return Array.from(n).forEach(s=>{const t=s.toLowerCase(),r=o+s.length;Array.from({length:t.length}).forEach(()=>{e.push(o),i.push(r)}),o=r}),{originalStart:e,originalEnd:i}}const h=(n,e,i)=>{n=n||"",e=e||"";const o=n.toLowerCase(),s=e.toLowerCase(),t=s.length;let r=o.indexOf(s);if(!t||r===-1)return l(n);const g=f(n);let a="",c=0;for(;r>-1;){const d=g.originalStart[r],u=g.originalEnd[r+t-1];a+=`${l(n.slice(c,d))}<span class="${i}">${l(n.slice(d,u))}</span>`,c=u,r=o.indexOf(s,r+t)}return a+=l(n.slice(c)),a};export default h;
1
+ "use strict";import l from"../sap/base/security/encodeXML.js";function p(n){const r=[],o=[];let t=0;return Array.from(n).forEach(i=>{const s=i.toLowerCase(),e=t+i.length;Array.from({length:s.length}).forEach(()=>{r.push(t),o.push(e)}),t=e}),{originalStart:r,originalEnd:o}}const w=(n,r,o)=>{n=n||"",r=r||"";const t=n.toLowerCase(),i=r.toLowerCase(),s=i.length;let e=t.indexOf(i);if(!s||e===-1)return l(n);const g=p(n);let a="",c=0;for(;e>-1;){const d=g.originalStart[e],u=g.originalEnd[e+s-1],f=o?`<span class="${o}">`:"<b>",h=o?"</span>":"</b>";a+=`${l(n.slice(c,d))}${f}${l(n.slice(d,u))}${h}`,c=u,e=t.indexOf(i,e+s)}return a+=l(n.slice(c)),a};export default w;
2
2
  //# sourceMappingURL=highlightText.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/util/highlightText.ts"],
4
- "sourcesContent": ["// @ts-expect-error\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\nfunction createLowerCaseIndexMap(text: string) {\n\tconst originalStart: number[] = [];\n\tconst originalEnd: number[] = [];\n\tlet originalIndex = 0;\n\n\tArray.from(text).forEach(character => {\n\t\tconst lowerCharacter = character.toLowerCase();\n\t\tconst end = originalIndex + character.length;\n\n\t\tArray.from({ length: lowerCharacter.length }).forEach(() => {\n\t\t\toriginalStart.push(originalIndex);\n\t\t\toriginalEnd.push(end);\n\t\t});\n\n\t\toriginalIndex = end;\n\t});\n\n\treturn {\n\t\toriginalStart,\n\t\toriginalEnd,\n\t};\n}\n\n/**\n * Highlights the occurrences of the highlightedText in the text by wrapping them in a span with the provided class.\n * @param text The original text in which to highlight occurrences.\n * @param highlightedText The text to highlight within the original text.\n * @param sClass The CSS class to apply to the highlighted spans.\n * @returns The text with the highlighted occurrences wrapped in a span with the specified class.\n * @since 2.28.0\n */\nconst highlightText = (text: string | null | undefined, highlightedText: string | null | undefined, sClass: string) => {\n\ttext = text || \"\";\n\thighlightedText = highlightedText || \"\";\n\n\tconst lowerText = text.toLowerCase();\n\tconst lowerHighlight = highlightedText.toLowerCase();\n\tconst highlightLength = lowerHighlight.length;\n\tlet index = lowerText.indexOf(lowerHighlight);\n\n\tif (!highlightLength || index === -1) {\n\t\treturn encodeXML(text) as string;\n\t}\n\n\t// Lowercasing can expand a single character (for example Turkish dotted \u0130).\n\t// The index map keeps the lowercase search positions aligned with the original text slices.\n\tconst indexMap = createLowerCaseIndexMap(text);\n\n\tlet result = \"\";\n\tlet lastEnd = 0;\n\n\twhile (index > -1) {\n\t\tconst start = indexMap.originalStart[index];\n\t\tconst end = indexMap.originalEnd[index + highlightLength - 1];\n\n\t\tresult += `${encodeXML(text.slice(lastEnd, start))}<span class=\"${sClass}\">${encodeXML(text.slice(start, end))}</span>`;\n\t\tlastEnd = end;\n\t\tindex = lowerText.indexOf(lowerHighlight, index + highlightLength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CAAO,CAAC,EAEhCD,CACR,EAEA,eAAeR",
6
- "names": ["encodeXML", "createLowerCaseIndexMap", "text", "originalStart", "originalEnd", "originalIndex", "character", "lowerCharacter", "end", "highlightText", "highlightedText", "sClass", "lowerText", "lowerHighlight", "highlightLength", "index", "indexMap", "result", "lastEnd", "start"]
4
+ "sourcesContent": ["// @ts-expect-error\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\nfunction createLowerCaseIndexMap(text: string) {\n\tconst originalStart: number[] = [];\n\tconst originalEnd: number[] = [];\n\tlet originalIndex = 0;\n\n\tArray.from(text).forEach(character => {\n\t\tconst lowerCharacter = character.toLowerCase();\n\t\tconst end = originalIndex + character.length;\n\n\t\tArray.from({ length: lowerCharacter.length }).forEach(() => {\n\t\t\toriginalStart.push(originalIndex);\n\t\t\toriginalEnd.push(end);\n\t\t});\n\n\t\toriginalIndex = end;\n\t});\n\n\treturn {\n\t\toriginalStart,\n\t\toriginalEnd,\n\t};\n}\n\n/**\n * Highlights the occurrences of the highlightedText in the text.\n * When a CSS class is provided, matches are wrapped in `<span class=\"...\">`.\n * When no class is provided, matches are wrapped in `<b>`.\n * @param text The original text in which to highlight occurrences.\n * @param highlightedText The text to highlight within the original text.\n * @param sClass The CSS class to apply to the highlighted spans. When omitted, a `<b>` tag is used instead.\n * @returns The text with the highlighted occurrences wrapped in the appropriate tag.\n * @since 2.28.0\n */\nconst highlightText = (text: string | null | undefined, highlightedText: string | null | undefined, sClass?: string) => {\n\ttext = text || \"\";\n\thighlightedText = highlightedText || \"\";\n\n\tconst lowerText = text.toLowerCase();\n\tconst lowerHighlight = highlightedText.toLowerCase();\n\tconst highlightLength = lowerHighlight.length;\n\tlet index = lowerText.indexOf(lowerHighlight);\n\n\tif (!highlightLength || index === -1) {\n\t\treturn encodeXML(text) as string;\n\t}\n\n\t// Lowercasing can expand a single character (for example Turkish dotted \u0130).\n\t// The index map keeps the lowercase search positions aligned with the original text slices.\n\tconst indexMap = createLowerCaseIndexMap(text);\n\n\tlet result = \"\";\n\tlet lastEnd = 0;\n\n\twhile (index > -1) {\n\t\tconst start = indexMap.originalStart[index];\n\t\tconst end = indexMap.originalEnd[index + highlightLength - 1];\n\n\t\tconst open = sClass ? `<span class=\"${sClass}\">` : \"<b>\";\n\t\tconst close = sClass ? \"</span>\" : \"</b>\";\n\t\tresult += `${encodeXML(text.slice(lastEnd, start))}${open}${encodeXML(text.slice(start, end))}${close}`;\n\t\tlastEnd = end;\n\t\tindex = lowerText.indexOf(lowerHighlight, index + highlightLength);\n\t}\n\n\tresult += encodeXML(text.slice(lastEnd));\n\n\treturn result;\n};\n\nexport default highlightText;\n"],
5
+ "mappings": "aACA,OAAOA,MAAe,oCAEtB,SAASC,EAAwBC,EAAc,CAC9C,MAAMC,EAA0B,CAAC,EAC3BC,EAAwB,CAAC,EAC/B,IAAIC,EAAgB,EAEpB,aAAM,KAAKH,CAAI,EAAE,QAAQI,GAAa,CACrC,MAAMC,EAAiBD,EAAU,YAAY,EACvCE,EAAMH,EAAgBC,EAAU,OAEtC,MAAM,KAAK,CAAE,OAAQC,EAAe,MAAO,CAAC,EAAE,QAAQ,IAAM,CAC3DJ,EAAc,KAAKE,CAAa,EAChCD,EAAY,KAAKI,CAAG,CACrB,CAAC,EAEDH,EAAgBG,CACjB,CAAC,EAEM,CACN,cAAAL,EACA,YAAAC,CACD,CACD,CAYA,MAAMK,EAAgB,CAACP,EAAiCQ,EAA4CC,IAAoB,CACvHT,EAAOA,GAAQ,GACfQ,EAAkBA,GAAmB,GAErC,MAAME,EAAYV,EAAK,YAAY,EAC7BW,EAAiBH,EAAgB,YAAY,EAC7CI,EAAkBD,EAAe,OACvC,IAAIE,EAAQH,EAAU,QAAQC,CAAc,EAE5C,GAAI,CAACC,GAAmBC,IAAU,GACjC,OAAOf,EAAUE,CAAI,EAKtB,MAAMc,EAAWf,EAAwBC,CAAI,EAE7C,IAAIe,EAAS,GACTC,EAAU,EAEd,KAAOH,EAAQ,IAAI,CAClB,MAAMI,EAAQH,EAAS,cAAcD,CAAK,EACpCP,EAAMQ,EAAS,YAAYD,EAAQD,EAAkB,CAAC,EAEtDM,EAAOT,EAAS,gBAAgBA,CAAM,KAAO,MAC7CU,EAAQV,EAAS,UAAY,OACnCM,GAAU,GAAGjB,EAAUE,EAAK,MAAMgB,EAASC,CAAK,CAAC,CAAC,GAAGC,CAAI,GAAGpB,EAAUE,EAAK,MAAMiB,EAAOX,CAAG,CAAC,CAAC,GAAGa,CAAK,GACrGH,EAAUV,EACVO,EAAQH,EAAU,QAAQC,EAAgBE,EAAQD,CAAe,CAClE,CAEA,OAAAG,GAAUjB,EAAUE,EAAK,MAAMgB,CAAO,CAAC,EAEhCD,CACR,EAEA,eAAeR",
6
+ "names": ["encodeXML", "createLowerCaseIndexMap", "text", "originalStart", "originalEnd", "originalIndex", "character", "lowerCharacter", "end", "highlightText", "highlightedText", "sClass", "lowerText", "lowerHighlight", "highlightLength", "index", "indexMap", "result", "lastEnd", "start", "open", "close"]
7
7
  }
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Generate markup for a raw string where a particular text is wrapped with some tag, by default `<b>` (bold) tag.
2
+ * Generate markup for a raw string where a particular text is wrapped with a `<b>` (bold) tag.
3
3
  * All inputs to this function are considered literal text, and special characters will always be escaped.
4
4
  * @param {string} text The text to add highlighting to
5
5
  * @param {string} textToHighlight The text which should be highlighted
6
6
  * @return {string} the markup HTML which contains all occurrances of the input text surrounded with a `<b>` tag.
7
+ * @deprecated Use `highlightText` from `@ui5/webcomponents-base/dist/util/highlightText.js` instead.
7
8
  */
8
9
  declare function generateHighlightedMarkup(text: string, textToHighlight: string): string;
9
10
  export default generateHighlightedMarkup;
@@ -6,11 +6,12 @@ function replaceAll(text, find, replace, caseInsensitive) {
6
6
  return text.replaceAll(new RegExp(escapeRegex(find), `${caseInsensitive ? "i" : ""}g`), replace);
7
7
  }
8
8
  /**
9
- * Generate markup for a raw string where a particular text is wrapped with some tag, by default `<b>` (bold) tag.
9
+ * Generate markup for a raw string where a particular text is wrapped with a `<b>` (bold) tag.
10
10
  * All inputs to this function are considered literal text, and special characters will always be escaped.
11
11
  * @param {string} text The text to add highlighting to
12
12
  * @param {string} textToHighlight The text which should be highlighted
13
13
  * @return {string} the markup HTML which contains all occurrances of the input text surrounded with a `<b>` tag.
14
+ * @deprecated Use `highlightText` from `@ui5/webcomponents-base/dist/util/highlightText.js` instead.
14
15
  */
15
16
  function generateHighlightedMarkup(text, textToHighlight) {
16
17
  if (!text || !textToHighlight) {
@@ -1 +1 @@
1
- {"version":3,"file":"generateHighlightedMarkup.js","sourceRoot":"","sources":["../../src/util/generateHighlightedMarkup.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,aAAa;AACb,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAE1D,gDAAgD;AAChD,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY,EAAE,OAAiE,EAAE,eAAwB;IAC1I,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,OAAiB,CAAC,CAAC;AAC5G,CAAC;AAED;;;;;;GAMG;AACH,SAAS,yBAAyB,CAAC,IAAY,EAAE,eAAuB;IACvE,IAAI,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,6EAA6E;IAC7E,0DAA0D;IAC1D,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE;QAC/B,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC,CAAC;IACF,iFAAiF;IACjF,2DAA2D;IAC3D,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACnC,4GAA4G;IAC5G,IAAI,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,KAAK,GAAG,UAAU,EAAE,EAAE,IAAI,CAAC,CAAW,CAAC;IAClI,uEAAuE;IACvE,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;QACtE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAED,eAAe,yBAAyB,CAAC","sourcesContent":["import escapeRegex from \"./escapeRegex.js\";\n// @ts-ignore\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\n// utility to replace all occurances of a string\nfunction replaceAll(text: string, find: string, replace: string | ((substring: string, ...args: any[]) => string), caseInsensitive: boolean) {\n\treturn text.replaceAll(new RegExp(escapeRegex(find), `${caseInsensitive ? \"i\" : \"\"}g`), replace as string);\n}\n\n/**\n * Generate markup for a raw string where a particular text is wrapped with some tag, by default `<b>` (bold) tag.\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\n * @return {string} the markup HTML which contains all occurrances of the input text surrounded with a `<b>` tag.\n */\nfunction generateHighlightedMarkup(text: string, textToHighlight: string) {\n\tif (!text || !textToHighlight) {\n\t\treturn text;\n\t}\n\t// a token is some string that does not appear in either of the input strings\n\t// repeat the token until it does not appear in the string\n\tconst makeToken = (t: string) => {\n\t\tconst [s, e] = t.split(\"\");\n\t\twhile (text.indexOf(t) >= 0 || textToHighlight.indexOf(t) >= 0) {\n\t\t\tt = `${s}${t}${e}`;\n\t\t}\n\t\treturn t;\n\t};\n\t// It doesn't matter what characters are used as long as all 4 of them are unique\n\t// And also that encodeXML will not change these characters\n\tconst openToken = makeToken(\"12\");\n\tconst closeToken = makeToken(\"34\");\n\t// wrap every occurance of the textToHighlight using the open/close tokens (instead of markup at this point)\n\tlet result = encodeXML(replaceAll(text, textToHighlight, (match: string) => `${openToken}${match}${closeToken}`, true)) as string;\n\t// now replace the open and close tokens with the markup that we expect\n\t[[openToken, \"<b>\"], [closeToken, \"</b>\"]].forEach(([find, replace]) => {\n\t\tresult = replaceAll(result, find, replace, false);\n\t});\n\treturn result;\n}\n\nexport default generateHighlightedMarkup;\n"]}
1
+ {"version":3,"file":"generateHighlightedMarkup.js","sourceRoot":"","sources":["../../src/util/generateHighlightedMarkup.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,aAAa;AACb,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAE1D,gDAAgD;AAChD,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY,EAAE,OAAiE,EAAE,eAAwB;IAC1I,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,OAAiB,CAAC,CAAC;AAC5G,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,yBAAyB,CAAC,IAAY,EAAE,eAAuB;IACvE,IAAI,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,6EAA6E;IAC7E,0DAA0D;IAC1D,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE;QAC/B,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC,CAAC;IACF,iFAAiF;IACjF,2DAA2D;IAC3D,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACnC,4GAA4G;IAC5G,IAAI,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,KAAK,GAAG,UAAU,EAAE,EAAE,IAAI,CAAC,CAAW,CAAC;IAClI,uEAAuE;IACvE,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;QACtE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAED,eAAe,yBAAyB,CAAC","sourcesContent":["import escapeRegex from \"./escapeRegex.js\";\n// @ts-ignore\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\n// utility to replace all occurances of a string\nfunction replaceAll(text: string, find: string, replace: string | ((substring: string, ...args: any[]) => string), caseInsensitive: boolean) {\n\treturn text.replaceAll(new RegExp(escapeRegex(find), `${caseInsensitive ? \"i\" : \"\"}g`), replace as string);\n}\n\n/**\n * Generate markup for a raw string where a particular text is wrapped with a `<b>` (bold) tag.\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\n * @return {string} the markup HTML which contains all occurrances of the input text surrounded with a `<b>` tag.\n * @deprecated Use `highlightText` from `@ui5/webcomponents-base/dist/util/highlightText.js` instead.\n */\nfunction generateHighlightedMarkup(text: string, textToHighlight: string) {\n\tif (!text || !textToHighlight) {\n\t\treturn text;\n\t}\n\t// a token is some string that does not appear in either of the input strings\n\t// repeat the token until it does not appear in the string\n\tconst makeToken = (t: string) => {\n\t\tconst [s, e] = t.split(\"\");\n\t\twhile (text.indexOf(t) >= 0 || textToHighlight.indexOf(t) >= 0) {\n\t\t\tt = `${s}${t}${e}`;\n\t\t}\n\t\treturn t;\n\t};\n\t// It doesn't matter what characters are used as long as all 4 of them are unique\n\t// And also that encodeXML will not change these characters\n\tconst openToken = makeToken(\"12\");\n\tconst closeToken = makeToken(\"34\");\n\t// wrap every occurance of the textToHighlight using the open/close tokens (instead of markup at this point)\n\tlet result = encodeXML(replaceAll(text, textToHighlight, (match: string) => `${openToken}${match}${closeToken}`, true)) as string;\n\t// now replace the open and close tokens with the markup that we expect\n\t[[openToken, \"<b>\"], [closeToken, \"</b>\"]].forEach(([find, replace]) => {\n\t\tresult = replaceAll(result, find, replace, false);\n\t});\n\treturn result;\n}\n\nexport default generateHighlightedMarkup;\n"]}
@@ -1,10 +1,12 @@
1
1
  /**
2
- * Highlights the occurrences of the highlightedText in the text by wrapping them in a span with the provided class.
2
+ * Highlights the occurrences of the highlightedText in the text.
3
+ * When a CSS class is provided, matches are wrapped in `<span class="...">`.
4
+ * When no class is provided, matches are wrapped in `<b>`.
3
5
  * @param text The original text in which to highlight occurrences.
4
6
  * @param highlightedText The text to highlight within the original text.
5
- * @param sClass The CSS class to apply to the highlighted spans.
6
- * @returns The text with the highlighted occurrences wrapped in a span with the specified class.
7
+ * @param sClass The CSS class to apply to the highlighted spans. When omitted, a `<b>` tag is used instead.
8
+ * @returns The text with the highlighted occurrences wrapped in the appropriate tag.
7
9
  * @since 2.28.0
8
10
  */
9
- declare const highlightText: (text: string | null | undefined, highlightedText: string | null | undefined, sClass: string) => string;
11
+ declare const highlightText: (text: string | null | undefined, highlightedText: string | null | undefined, sClass?: string) => string;
10
12
  export default highlightText;
@@ -19,11 +19,13 @@ function createLowerCaseIndexMap(text) {
19
19
  };
20
20
  }
21
21
  /**
22
- * Highlights the occurrences of the highlightedText in the text by wrapping them in a span with the provided class.
22
+ * Highlights the occurrences of the highlightedText in the text.
23
+ * When a CSS class is provided, matches are wrapped in `<span class="...">`.
24
+ * When no class is provided, matches are wrapped in `<b>`.
23
25
  * @param text The original text in which to highlight occurrences.
24
26
  * @param highlightedText The text to highlight within the original text.
25
- * @param sClass The CSS class to apply to the highlighted spans.
26
- * @returns The text with the highlighted occurrences wrapped in a span with the specified class.
27
+ * @param sClass The CSS class to apply to the highlighted spans. When omitted, a `<b>` tag is used instead.
28
+ * @returns The text with the highlighted occurrences wrapped in the appropriate tag.
27
29
  * @since 2.28.0
28
30
  */
29
31
  const highlightText = (text, highlightedText, sClass) => {
@@ -44,7 +46,9 @@ const highlightText = (text, highlightedText, sClass) => {
44
46
  while (index > -1) {
45
47
  const start = indexMap.originalStart[index];
46
48
  const end = indexMap.originalEnd[index + highlightLength - 1];
47
- result += `${encodeXML(text.slice(lastEnd, start))}<span class="${sClass}">${encodeXML(text.slice(start, end))}</span>`;
49
+ const open = sClass ? `<span class="${sClass}">` : "<b>";
50
+ const close = sClass ? "</span>" : "</b>";
51
+ result += `${encodeXML(text.slice(lastEnd, start))}${open}${encodeXML(text.slice(start, end))}${close}`;
48
52
  lastEnd = end;
49
53
  index = lowerText.indexOf(lowerHighlight, index + highlight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E9C,IAAI,CAAC,eAAe,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC,IAAI,CAAW,CAAC;IAClC,CAAC;IAED,4EAA4E;IAC5E,4FAA4F;IAC5F,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAE/C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,OAAO,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC;QAE9D,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,gBAAgB,MAAM,KAAK,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC;QACxH,OAAO,GAAG,GAAG,CAAC;QACd,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,GAAG,eAAe,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// @ts-expect-error\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\nfunction createLowerCaseIndexMap(text: string) {\n\tconst originalStart: number[] = [];\n\tconst originalEnd: number[] = [];\n\tlet originalIndex = 0;\n\n\tArray.from(text).forEach(character => {\n\t\tconst lowerCharacter = character.toLowerCase();\n\t\tconst end = originalIndex + character.length;\n\n\t\tArray.from({ length: lowerCharacter.length }).forEach(() => {\n\t\t\toriginalStart.push(originalIndex);\n\t\t\toriginalEnd.push(end);\n\t\t});\n\n\t\toriginalIndex = end;\n\t});\n\n\treturn {\n\t\toriginalStart,\n\t\toriginalEnd,\n\t};\n}\n\n/**\n * Highlights the occurrences of the highlightedText in the text by wrapping them in a span with the provided class.\n * @param text The original text in which to highlight occurrences.\n * @param highlightedText The text to highlight within the original text.\n * @param sClass The CSS class to apply to the highlighted spans.\n * @returns The text with the highlighted occurrences wrapped in a span with the specified class.\n * @since 2.28.0\n */\nconst highlightText = (text: string | null | undefined, highlightedText: string | null | undefined, sClass: string) => {\n\ttext = text || \"\";\n\thighlightedText = highlightedText || \"\";\n\n\tconst lowerText = text.toLowerCase();\n\tconst lowerHighlight = highlightedText.toLowerCase();\n\tconst highlightLength = lowerHighlight.length;\n\tlet index = lowerText.indexOf(lowerHighlight);\n\n\tif (!highlightLength || index === -1) {\n\t\treturn encodeXML(text) as string;\n\t}\n\n\t// Lowercasing can expand a single character (for example Turkish dotted İ).\n\t// The index map keeps the lowercase search positions aligned with the original text slices.\n\tconst indexMap = createLowerCaseIndexMap(text);\n\n\tlet result = \"\";\n\tlet lastEnd = 0;\n\n\twhile (index > -1) {\n\t\tconst start = indexMap.originalStart[index];\n\t\tconst end = indexMap.originalEnd[index + highlightLength - 1];\n\n\t\tresult += `${encodeXML(text.slice(lastEnd, start))}<span class=\"${sClass}\">${encodeXML(text.slice(start, end))}</span>`;\n\t\tlastEnd = end;\n\t\tindex = lowerText.indexOf(lowerHighlight, index + highlightLength);\n\t}\n\n\tresult += encodeXML(text.slice(lastEnd));\n\n\treturn result;\n};\n\nexport default highlightText;\n"]}
1
+ {"version":3,"file":"highlightText.js","sourceRoot":"","sources":["../../src/util/highlightText.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAE1D,SAAS,uBAAuB,CAAC,IAAY;IAC5C,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,WAAW,GAAa,EAAE,CAAC;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AAO,GAAG,CAAC,CAAC;IAEhB,OAAO,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC;QAE9D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,gBAAgB,MAAM,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QAC1C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;QACxG,OAAO,GAAG,GAAG,CAAC;QACd,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,GAAG,eAAe,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// @ts-expect-error\nimport encodeXML from \"../sap/base/security/encodeXML.js\";\n\nfunction createLowerCaseIndexMap(text: string) {\n\tconst originalStart: number[] = [];\n\tconst originalEnd: number[] = [];\n\tlet originalIndex = 0;\n\n\tArray.from(text).forEach(character => {\n\t\tconst lowerCharacter = character.toLowerCase();\n\t\tconst end = originalIndex + character.length;\n\n\t\tArray.from({ length: lowerCharacter.length }).forEach(() => {\n\t\t\toriginalStart.push(originalIndex);\n\t\t\toriginalEnd.push(end);\n\t\t});\n\n\t\toriginalIndex = end;\n\t});\n\n\treturn {\n\t\toriginalStart,\n\t\toriginalEnd,\n\t};\n}\n\n/**\n * Highlights the occurrences of the highlightedText in the text.\n * When a CSS class is provided, matches are wrapped in `<span class=\"...\">`.\n * When no class is provided, matches are wrapped in `<b>`.\n * @param text The original text in which to highlight occurrences.\n * @param highlightedText The text to highlight within the original text.\n * @param sClass The CSS class to apply to the highlighted spans. When omitted, a `<b>` tag is used instead.\n * @returns The text with the highlighted occurrences wrapped in the appropriate tag.\n * @since 2.28.0\n */\nconst highlightText = (text: string | null | undefined, highlightedText: string | null | undefined, sClass?: string) => {\n\ttext = text || \"\";\n\thighlightedText = highlightedText || \"\";\n\n\tconst lowerText = text.toLowerCase();\n\tconst lowerHighlight = highlightedText.toLowerCase();\n\tconst highlightLength = lowerHighlight.length;\n\tlet index = lowerText.indexOf(lowerHighlight);\n\n\tif (!highlightLength || index === -1) {\n\t\treturn encodeXML(text) as string;\n\t}\n\n\t// Lowercasing can expand a single character (for example Turkish dotted İ).\n\t// The index map keeps the lowercase search positions aligned with the original text slices.\n\tconst indexMap = createLowerCaseIndexMap(text);\n\n\tlet result = \"\";\n\tlet lastEnd = 0;\n\n\twhile (index > -1) {\n\t\tconst start = indexMap.originalStart[index];\n\t\tconst end = indexMap.originalEnd[index + highlightLength - 1];\n\n\t\tconst open = sClass ? `<span class=\"${sClass}\">` : \"<b>\";\n\t\tconst close = sClass ? \"</span>\" : \"</b>\";\n\t\tresult += `${encodeXML(text.slice(lastEnd, start))}${open}${encodeXML(text.slice(start, end))}${close}`;\n\t\tlastEnd = end;\n\t\tindex = lowerText.indexOf(lowerHighlight, index + highlightLength);\n\t}\n\n\tresult += encodeXML(text.slice(lastEnd));\n\n\treturn result;\n};\n\nexport default highlightText;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-base",
3
- "version": "2.29.0-rc.0",
3
+ "version": "2.29.0-rc.1",
4
4
  "description": "UI5 Web Components: webcomponents.base",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@openui5/sap.ui.core": "1.151.0",
67
67
  "@sap-theming/theming-base-content": "11.36.4",
68
68
  "@ui5/cypress-internal": "0.1.0",
69
- "@ui5/webcomponents-tools": "2.29.0-rc.0",
69
+ "@ui5/webcomponents-tools": "2.29.0-rc.1",
70
70
  "clean-css": "^5.2.2",
71
71
  "cypress": "15.18.1",
72
72
  "mocha": "^11.7.2",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  },
87
87
  "customElements": "dist/custom-elements.json",
88
- "gitHead": "ace8be9008be626e7be5bca0e23ace75c045a188"
88
+ "gitHead": "87edd7e1a7e71ff6b967b6102d5b31ae9c2b8287"
89
89
  }