@pega/cosmos-react-core 8.29.0 → 8.31.0

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,4 +1,27 @@
1
1
  /* eslint-disable no-continue */
2
+ const groupTokensIntoPhrases = (tokens, phraseSize = 3) => {
3
+ return Array.from({ length: Math.ceil(tokens.length / phraseSize) }, (_, i) => tokens.slice(i * phraseSize, (i + 1) * phraseSize).join(''));
4
+ };
5
+ /**
6
+ * Extracts the next word (with trailing whitespace) from text starting at startIndex.
7
+ * Returns the word token and the index after the word.
8
+ */
9
+ const extractWord = (text, startIndex) => {
10
+ let currentIndex = startIndex;
11
+ // Capture non-whitespace characters
12
+ while (currentIndex < text.length && text[currentIndex] !== ' ' && text[currentIndex] !== '\n') {
13
+ currentIndex += 1;
14
+ }
15
+ // Capture trailing whitespace (spaces and newlines)
16
+ while (currentIndex < text.length &&
17
+ (text[currentIndex] === ' ' || text[currentIndex] === '\n')) {
18
+ currentIndex += 1;
19
+ }
20
+ return {
21
+ word: text.slice(startIndex, currentIndex),
22
+ endIndex: currentIndex
23
+ };
24
+ };
2
25
  const handleDelimitedMarkdown = (text, startIndex, openingDelimiter) => {
3
26
  const delimiterLength = openingDelimiter.length;
4
27
  // Check if there's content immediately after opening delimiter (no space)
@@ -55,9 +78,14 @@ const handleLineBasedMarkdown = (text, startIndex, openingChar, maxCount = 1) =>
55
78
  }
56
79
  return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };
57
80
  };
58
- const markdownTokenizer = (text) => {
81
+ const markdownTokenizer = (text, { tokenizeMarkdown = false, phraseSize = 3 } = {}) => {
59
82
  if (!text)
60
83
  return [];
84
+ if (!tokenizeMarkdown) {
85
+ const wordRegex = /\S+\s*/g;
86
+ const words = text.match(wordRegex) || [];
87
+ return groupTokensIntoPhrases(words, phraseSize);
88
+ }
61
89
  const tokens = [];
62
90
  let currentTokenIndex = 0;
63
91
  while (currentTokenIndex < text.length) {
@@ -90,9 +118,10 @@ const markdownTokenizer = (text) => {
90
118
  currentTokenIndex += 3; // Include the closing ```
91
119
  break;
92
120
  }
93
- // Add individual characters
94
- tokens.push(text[currentTokenIndex]);
95
- currentTokenIndex += 1;
121
+ // Extract word from code block
122
+ const { word, endIndex } = extractWord(text, currentTokenIndex);
123
+ tokens.push(word);
124
+ currentTokenIndex = endIndex;
96
125
  }
97
126
  continue;
98
127
  }
@@ -109,9 +138,10 @@ const markdownTokenizer = (text) => {
109
138
  currentTokenIndex = result.endIndex;
110
139
  continue;
111
140
  }
112
- // Not valid markdown, treat as regular characters
113
- tokens.push(char);
114
- currentTokenIndex += 1;
141
+ // Not valid markdown, extract as word
142
+ const { word, endIndex } = extractWord(text, currentTokenIndex);
143
+ tokens.push(word);
144
+ currentTokenIndex = endIndex;
115
145
  continue;
116
146
  }
117
147
  // Markdown characters that start on a new line and add a space between actual text and the markdown character
@@ -122,9 +152,10 @@ const markdownTokenizer = (text) => {
122
152
  currentTokenIndex = result.endIndex;
123
153
  continue;
124
154
  }
125
- // Not valid heading markdown, treat as regular character
126
- tokens.push(char);
127
- currentTokenIndex += 1;
155
+ // Not valid markdown, extract as word
156
+ const { word, endIndex } = extractWord(text, currentTokenIndex);
157
+ tokens.push(word);
158
+ currentTokenIndex = endIndex;
128
159
  continue;
129
160
  }
130
161
  // Image and link markdown elements
@@ -150,10 +181,12 @@ const markdownTokenizer = (text) => {
150
181
  tokens.push(text.slice(startIndex, currentTokenIndex));
151
182
  continue;
152
183
  }
153
- tokens.push(char);
154
- currentTokenIndex += 1;
184
+ // Default: extract word
185
+ const { word, endIndex } = extractWord(text, currentTokenIndex);
186
+ tokens.push(word);
187
+ currentTokenIndex = endIndex;
155
188
  }
156
- return tokens;
189
+ return groupTokensIntoPhrases(tokens, phraseSize);
157
190
  };
158
191
  export default markdownTokenizer;
159
192
  //# sourceMappingURL=markdownTokenizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTokenizer.js","sourceRoot":"","sources":["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CAAC,MAAM,EAAE,CAAC;wBACvC,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,GAAG,EAAE,CAAC;4BACpC,iBAAiB,IAAI,CAAC,CAAC,CAAC,wBAAwB;4BAChD,MAAM;wBACR,CAAC;wBACD,iBAAiB,IAAI,CAAC,CAAC;oBACzB,CAAC;oBACD,MAAM;gBACR,CAAC;gBACD,iBAAiB,IAAI,CAAC,CAAC;YACzB,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;YACvD,SAAS;QACX,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,iBAAiB,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["/* eslint-disable no-continue */\n\nconst handleDelimitedMarkdown = (\n text: string,\n startIndex: number,\n openingDelimiter: string\n): { isValidMarkdown: boolean; endIndex: number; token: string } => {\n const delimiterLength = openingDelimiter.length;\n\n // Check if there's content immediately after opening delimiter (no space)\n if (startIndex + delimiterLength >= text.length || text[startIndex + delimiterLength] === ' ') {\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n }\n\n let currentIndex = startIndex + delimiterLength; // Skip past the opening delimiter\n\n // Find the closing delimiter\n while (currentIndex <= text.length - openingDelimiter.length) {\n if (text.slice(currentIndex, currentIndex + openingDelimiter.length) === openingDelimiter) {\n // Check that there's no space before the closing delimiter\n if (text[currentIndex - 1] !== ' ') {\n currentIndex += openingDelimiter.length; // Include the closing delimiter\n return {\n isValidMarkdown: true,\n endIndex: currentIndex,\n token: text.slice(startIndex, currentIndex)\n };\n }\n break;\n }\n currentIndex += 1;\n }\n\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n};\n\nconst handleLineBasedMarkdown = (\n text: string,\n startIndex: number,\n openingChar: string,\n maxCount: number = 1\n): { isValidMarkdown: boolean; endIndex: number; token: string } => {\n // Check if this character is at the beginning of a line\n const isAtLineStart = startIndex === 0 || text[startIndex - 1] === '\\n';\n\n if (!isAtLineStart) {\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n }\n\n let currentIndex = startIndex;\n let charCount = 0;\n\n // Count consecutive opening characters\n while (currentIndex < text.length && text[currentIndex] === openingChar && charCount < maxCount) {\n charCount += 1;\n currentIndex += 1;\n }\n\n // Check if there's a space after the opening characters\n if (currentIndex < text.length && text[currentIndex] === ' ') {\n // Find the end of the line (or end of text)\n while (currentIndex < text.length && text[currentIndex] !== '\\n') {\n currentIndex += 1;\n }\n\n // Include the newline character if present\n if (currentIndex < text.length && text[currentIndex] === '\\n') {\n currentIndex += 1;\n }\n\n return {\n isValidMarkdown: true,\n endIndex: currentIndex,\n token: text.slice(startIndex, currentIndex)\n };\n }\n\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n};\n\nconst markdownTokenizer = (text: string): string[] => {\n if (!text) return [];\n\n const tokens: string[] = [];\n let currentTokenIndex = 0;\n\n while (currentTokenIndex < text.length) {\n const char = text[currentTokenIndex];\n\n // Handle code blocks (```text```)\n if (\n char === '`' &&\n text[currentTokenIndex + 1] === '`' &&\n text[currentTokenIndex + 2] === '`'\n ) {\n // Add the opening ``` as one token\n tokens.push('```');\n currentTokenIndex += 3; // Skip past the opening ```\n\n // Check if there's a language identifier on the same line\n let languageEndIndex = currentTokenIndex;\n while (languageEndIndex < text.length && text[languageEndIndex] !== '\\n') {\n languageEndIndex += 1;\n }\n\n // If there's a language identifier, add it as one token including the newline\n if (languageEndIndex > currentTokenIndex) {\n const languageLine = text.slice(\n currentTokenIndex,\n languageEndIndex + (text[languageEndIndex] === '\\n' ? 1 : 0)\n );\n tokens.push(languageLine);\n currentTokenIndex = languageEndIndex + (text[languageEndIndex] === '\\n' ? 1 : 0);\n }\n\n // Now stream the content character by character until we find closing ```\n while (currentTokenIndex < text.length - 2) {\n if (\n text[currentTokenIndex] === '`' &&\n text[currentTokenIndex + 1] === '`' &&\n text[currentTokenIndex + 2] === '`'\n ) {\n // Add the closing ``` as one token\n tokens.push('```');\n currentTokenIndex += 3; // Include the closing ```\n break;\n }\n // Add individual characters\n tokens.push(text[currentTokenIndex]);\n currentTokenIndex += 1;\n }\n\n continue;\n }\n\n // Markdown characters that surround the text\n if (['*', '`', '~'].includes(char)) {\n let openingDelimiter = char;\n\n // Bold case\n if (text[currentTokenIndex + 1] === char) {\n openingDelimiter = `${char}${char}`;\n }\n\n const result = handleDelimitedMarkdown(text, currentTokenIndex, openingDelimiter);\n\n if (result.isValidMarkdown) {\n tokens.push(result.token);\n currentTokenIndex = result.endIndex;\n continue;\n }\n\n // Not valid markdown, treat as regular characters\n tokens.push(char);\n currentTokenIndex += 1;\n continue;\n }\n\n // Markdown characters that start on a new line and add a space between actual text and the markdown character\n if (['#', '>'].includes(char)) {\n const result = handleLineBasedMarkdown(text, currentTokenIndex, char, char === '#' ? 6 : 1);\n if (result.isValidMarkdown) {\n tokens.push(result.token);\n currentTokenIndex = result.endIndex;\n continue;\n }\n\n // Not valid heading markdown, treat as regular character\n tokens.push(char);\n currentTokenIndex += 1;\n continue;\n }\n\n // Image and link markdown elements\n if (char === '[' || (char === '!' && text[currentTokenIndex + 1] === '[')) {\n const startIndex = currentTokenIndex;\n currentTokenIndex += char === '[' ? 1 : 2; // Skip past the opening\n\n // Find the closing ] and then check for (\n while (currentTokenIndex < text.length) {\n if (text[currentTokenIndex] === ']' && text[currentTokenIndex + 1] === '(') {\n currentTokenIndex += 2; // Skip past ](\n\n // Find the closing )\n while (currentTokenIndex < text.length) {\n if (text[currentTokenIndex] === ')') {\n currentTokenIndex += 1; // Include the closing )\n break;\n }\n currentTokenIndex += 1;\n }\n break;\n }\n currentTokenIndex += 1;\n }\n\n tokens.push(text.slice(startIndex, currentTokenIndex));\n continue;\n }\n\n tokens.push(char);\n currentTokenIndex += 1;\n }\n\n return tokens;\n};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C,EAAE,CAAC;YAC1E,MAAM,UAAU,GAAG,iBAAiB,CAAC;YACrC,iBAAiB,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB;YAEnE,0CAA0C;YAC1C,OAAO,iBAAiB,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;gBACvC,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC3E,iBAAiB,IAAI,CAAC,CAAC,CAAC,eAAe;oBAEvC,qBAAqB;oBACrB,OAAO,iBAAiB,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;wBACvC,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,GAAG,EAAE,CAAC;4BACpC,iBAAiB,IAAI,CAAC,CAAC,CAAC,wBAAwB;4BAChD,MAAM;wBACR,CAAC;wBACD,iBAAiB,IAAI,CAAC,CAAC;oBACzB,CAAC;oBACD,MAAM;gBACR,CAAC;gBACD,iBAAiB,IAAI,CAAC,CAAC;YACzB,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;YACvD,SAAS;QACX,CAAC;QAED,wBAAwB;QACxB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAChE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,iBAAiB,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,OAAO,sBAAsB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["/* eslint-disable no-continue */\n\nconst groupTokensIntoPhrases = (tokens: string[], phraseSize = 3): string[] => {\n return Array.from({ length: Math.ceil(tokens.length / phraseSize) }, (_, i) =>\n tokens.slice(i * phraseSize, (i + 1) * phraseSize).join('')\n );\n};\n\n/**\n * Extracts the next word (with trailing whitespace) from text starting at startIndex.\n * Returns the word token and the index after the word.\n */\nconst extractWord = (text: string, startIndex: number): { word: string; endIndex: number } => {\n let currentIndex = startIndex;\n\n // Capture non-whitespace characters\n while (currentIndex < text.length && text[currentIndex] !== ' ' && text[currentIndex] !== '\\n') {\n currentIndex += 1;\n }\n\n // Capture trailing whitespace (spaces and newlines)\n while (\n currentIndex < text.length &&\n (text[currentIndex] === ' ' || text[currentIndex] === '\\n')\n ) {\n currentIndex += 1;\n }\n\n return {\n word: text.slice(startIndex, currentIndex),\n endIndex: currentIndex\n };\n};\n\nconst handleDelimitedMarkdown = (\n text: string,\n startIndex: number,\n openingDelimiter: string\n): { isValidMarkdown: boolean; endIndex: number; token: string } => {\n const delimiterLength = openingDelimiter.length;\n\n // Check if there's content immediately after opening delimiter (no space)\n if (startIndex + delimiterLength >= text.length || text[startIndex + delimiterLength] === ' ') {\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n }\n\n let currentIndex = startIndex + delimiterLength; // Skip past the opening delimiter\n\n // Find the closing delimiter\n while (currentIndex <= text.length - openingDelimiter.length) {\n if (text.slice(currentIndex, currentIndex + openingDelimiter.length) === openingDelimiter) {\n // Check that there's no space before the closing delimiter\n if (text[currentIndex - 1] !== ' ') {\n currentIndex += openingDelimiter.length; // Include the closing delimiter\n return {\n isValidMarkdown: true,\n endIndex: currentIndex,\n token: text.slice(startIndex, currentIndex)\n };\n }\n break;\n }\n currentIndex += 1;\n }\n\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n};\n\nconst handleLineBasedMarkdown = (\n text: string,\n startIndex: number,\n openingChar: string,\n maxCount: number = 1\n): { isValidMarkdown: boolean; endIndex: number; token: string } => {\n // Check if this character is at the beginning of a line\n const isAtLineStart = startIndex === 0 || text[startIndex - 1] === '\\n';\n\n if (!isAtLineStart) {\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n }\n\n let currentIndex = startIndex;\n let charCount = 0;\n\n // Count consecutive opening characters\n while (currentIndex < text.length && text[currentIndex] === openingChar && charCount < maxCount) {\n charCount += 1;\n currentIndex += 1;\n }\n\n // Check if there's a space after the opening characters\n if (currentIndex < text.length && text[currentIndex] === ' ') {\n // Find the end of the line (or end of text)\n while (currentIndex < text.length && text[currentIndex] !== '\\n') {\n currentIndex += 1;\n }\n\n // Include the newline character if present\n if (currentIndex < text.length && text[currentIndex] === '\\n') {\n currentIndex += 1;\n }\n\n return {\n isValidMarkdown: true,\n endIndex: currentIndex,\n token: text.slice(startIndex, currentIndex)\n };\n }\n\n return { isValidMarkdown: false, endIndex: startIndex + 1, token: '' };\n};\n\nconst markdownTokenizer = (\n text: string,\n {\n tokenizeMarkdown = false,\n phraseSize = 3\n }: { tokenizeMarkdown?: boolean; phraseSize?: number } = {}\n): string[] => {\n if (!text) return [];\n\n if (!tokenizeMarkdown) {\n const wordRegex = /\\S+\\s*/g;\n const words = text.match(wordRegex) || [];\n return groupTokensIntoPhrases(words, phraseSize);\n }\n\n const tokens: string[] = [];\n let currentTokenIndex = 0;\n\n while (currentTokenIndex < text.length) {\n const char = text[currentTokenIndex];\n\n // Handle code blocks (```text```)\n if (\n char === '`' &&\n text[currentTokenIndex + 1] === '`' &&\n text[currentTokenIndex + 2] === '`'\n ) {\n // Add the opening ``` as one token\n tokens.push('```');\n currentTokenIndex += 3; // Skip past the opening ```\n\n // Check if there's a language identifier on the same line\n let languageEndIndex = currentTokenIndex;\n while (languageEndIndex < text.length && text[languageEndIndex] !== '\\n') {\n languageEndIndex += 1;\n }\n\n // If there's a language identifier, add it as one token including the newline\n if (languageEndIndex > currentTokenIndex) {\n const languageLine = text.slice(\n currentTokenIndex,\n languageEndIndex + (text[languageEndIndex] === '\\n' ? 1 : 0)\n );\n tokens.push(languageLine);\n currentTokenIndex = languageEndIndex + (text[languageEndIndex] === '\\n' ? 1 : 0);\n }\n\n // Now stream the content character by character until we find closing ```\n while (currentTokenIndex < text.length - 2) {\n if (\n text[currentTokenIndex] === '`' &&\n text[currentTokenIndex + 1] === '`' &&\n text[currentTokenIndex + 2] === '`'\n ) {\n // Add the closing ``` as one token\n tokens.push('```');\n currentTokenIndex += 3; // Include the closing ```\n break;\n }\n\n // Extract word from code block\n const { word, endIndex } = extractWord(text, currentTokenIndex);\n tokens.push(word);\n currentTokenIndex = endIndex;\n }\n\n continue;\n }\n\n // Markdown characters that surround the text\n if (['*', '`', '~'].includes(char)) {\n let openingDelimiter = char;\n\n // Bold case\n if (text[currentTokenIndex + 1] === char) {\n openingDelimiter = `${char}${char}`;\n }\n\n const result = handleDelimitedMarkdown(text, currentTokenIndex, openingDelimiter);\n\n if (result.isValidMarkdown) {\n tokens.push(result.token);\n currentTokenIndex = result.endIndex;\n continue;\n }\n\n // Not valid markdown, extract as word\n const { word, endIndex } = extractWord(text, currentTokenIndex);\n tokens.push(word);\n currentTokenIndex = endIndex;\n\n continue;\n }\n\n // Markdown characters that start on a new line and add a space between actual text and the markdown character\n if (['#', '>'].includes(char)) {\n const result = handleLineBasedMarkdown(text, currentTokenIndex, char, char === '#' ? 6 : 1);\n if (result.isValidMarkdown) {\n tokens.push(result.token);\n currentTokenIndex = result.endIndex;\n continue;\n }\n\n // Not valid markdown, extract as word\n const { word, endIndex } = extractWord(text, currentTokenIndex);\n tokens.push(word);\n currentTokenIndex = endIndex;\n\n continue;\n }\n\n // Image and link markdown elements\n if (char === '[' || (char === '!' && text[currentTokenIndex + 1] === '[')) {\n const startIndex = currentTokenIndex;\n currentTokenIndex += char === '[' ? 1 : 2; // Skip past the opening\n\n // Find the closing ] and then check for (\n while (currentTokenIndex < text.length) {\n if (text[currentTokenIndex] === ']' && text[currentTokenIndex + 1] === '(') {\n currentTokenIndex += 2; // Skip past ](\n\n // Find the closing )\n while (currentTokenIndex < text.length) {\n if (text[currentTokenIndex] === ')') {\n currentTokenIndex += 1; // Include the closing )\n break;\n }\n currentTokenIndex += 1;\n }\n break;\n }\n currentTokenIndex += 1;\n }\n\n tokens.push(text.slice(startIndex, currentTokenIndex));\n continue;\n }\n\n // Default: extract word\n const { word, endIndex } = extractWord(text, currentTokenIndex);\n tokens.push(word);\n currentTokenIndex = endIndex;\n }\n\n return groupTokensIntoPhrases(tokens, phraseSize);\n};\n\nexport default markdownTokenizer;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-core",
3
- "version": "8.29.0",
3
+ "version": "8.31.0",
4
4
  "description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Pegasystems",