odaptos_design_system 2.0.349 → 2.0.350
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.
- package/dist/index.cjs +43 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -265,9 +265,15 @@ style_inject_es_default(css_248z$82);
|
|
|
265
265
|
* Supports: **bold**, *italic*, __underline__ (or <u>underline</u>), `code`, line breaks, and simple lists.
|
|
266
266
|
*/
|
|
267
267
|
const renderInlineMarkdown = (rawText) => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
const normalizeToDisplayText = (value) => {
|
|
269
|
+
if (value === null || value === void 0) return "";
|
|
270
|
+
if (typeof value === "string") return value;
|
|
271
|
+
if (value instanceof String) return value.toString();
|
|
272
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
273
|
+
return "";
|
|
274
|
+
};
|
|
275
|
+
const normalizedText = normalizeToDisplayText(rawText);
|
|
276
|
+
if (normalizedText.length === 0) return normalizedText;
|
|
271
277
|
const renderCode = (text) => {
|
|
272
278
|
return text.split(/`([^`]+)`/g).map((part, index) => {
|
|
273
279
|
if (!(index % 2 === 1)) return part;
|
|
@@ -373,40 +379,44 @@ const renderInlineMarkdown = (rawText) => {
|
|
|
373
379
|
const codeNodes = renderCode(text);
|
|
374
380
|
return renderStrongAndEm(codeNodes);
|
|
375
381
|
};
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
382
|
+
try {
|
|
383
|
+
const lines = normalizedText.split("\n");
|
|
384
|
+
const blocks = [];
|
|
385
|
+
let i = 0;
|
|
386
|
+
while (i < lines.length) {
|
|
387
|
+
const line = lines[i] ?? "";
|
|
388
|
+
const unorderedMatch = line.match(/^\s*[-*]\s+(.*)$/);
|
|
389
|
+
const orderedMatch = line.match(/^\s*(\d+)\.\s+(.*)$/);
|
|
390
|
+
if (unorderedMatch) {
|
|
391
|
+
const items = [];
|
|
392
|
+
while (i < lines.length) {
|
|
393
|
+
const match = (lines[i] ?? "").match(/^\s*[-*]\s+(.*)$/);
|
|
394
|
+
if (!match) break;
|
|
395
|
+
items.push(match[1]);
|
|
396
|
+
i += 1;
|
|
397
|
+
}
|
|
398
|
+
blocks.push(/* @__PURE__ */ React.createElement("ul", { key: `ul-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ React.createElement("li", { key: `ul-li-${index}` }, renderInline(item)))));
|
|
399
|
+
continue;
|
|
390
400
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
if (orderedMatch) {
|
|
402
|
+
const items = [];
|
|
403
|
+
while (i < lines.length) {
|
|
404
|
+
const match = (lines[i] ?? "").match(/^\s*\d+\.\s+(.*)$/);
|
|
405
|
+
if (!match) break;
|
|
406
|
+
items.push(match[1]);
|
|
407
|
+
i += 1;
|
|
408
|
+
}
|
|
409
|
+
blocks.push(/* @__PURE__ */ React.createElement("ol", { key: `ol-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ React.createElement("li", { key: `ol-li-${index}` }, renderInline(item)))));
|
|
410
|
+
continue;
|
|
401
411
|
}
|
|
402
|
-
blocks.push(/* @__PURE__ */ React.createElement(
|
|
403
|
-
|
|
412
|
+
blocks.push(/* @__PURE__ */ React.createElement(React.Fragment, { key: `p-${blocks.length}` }, renderInline(line)));
|
|
413
|
+
if (i < lines.length - 1) blocks.push(/* @__PURE__ */ React.createElement("br", { key: `br-${blocks.length}` }));
|
|
414
|
+
i += 1;
|
|
404
415
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
return blocks;
|
|
417
|
+
} catch (error) {
|
|
418
|
+
return normalizedText;
|
|
408
419
|
}
|
|
409
|
-
return blocks;
|
|
410
420
|
};
|
|
411
421
|
|
|
412
422
|
//#endregion
|