odaptos_design_system 2.0.348 → 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 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -319,7 +319,15 @@ style_inject_es_default(css_248z$82);
|
|
|
319
319
|
* Supports: **bold**, *italic*, __underline__ (or <u>underline</u>), `code`, line breaks, and simple lists.
|
|
320
320
|
*/
|
|
321
321
|
const renderInlineMarkdown = (rawText) => {
|
|
322
|
-
|
|
322
|
+
const normalizeToDisplayText = (value) => {
|
|
323
|
+
if (value === null || value === void 0) return "";
|
|
324
|
+
if (typeof value === "string") return value;
|
|
325
|
+
if (value instanceof String) return value.toString();
|
|
326
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
327
|
+
return "";
|
|
328
|
+
};
|
|
329
|
+
const normalizedText = normalizeToDisplayText(rawText);
|
|
330
|
+
if (normalizedText.length === 0) return normalizedText;
|
|
323
331
|
const renderCode = (text) => {
|
|
324
332
|
return text.split(/`([^`]+)`/g).map((part, index) => {
|
|
325
333
|
if (!(index % 2 === 1)) return part;
|
|
@@ -425,40 +433,44 @@ const renderInlineMarkdown = (rawText) => {
|
|
|
425
433
|
const codeNodes = renderCode(text);
|
|
426
434
|
return renderStrongAndEm(codeNodes);
|
|
427
435
|
};
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
436
|
+
try {
|
|
437
|
+
const lines = normalizedText.split("\n");
|
|
438
|
+
const blocks = [];
|
|
439
|
+
let i = 0;
|
|
440
|
+
while (i < lines.length) {
|
|
441
|
+
const line = lines[i] ?? "";
|
|
442
|
+
const unorderedMatch = line.match(/^\s*[-*]\s+(.*)$/);
|
|
443
|
+
const orderedMatch = line.match(/^\s*(\d+)\.\s+(.*)$/);
|
|
444
|
+
if (unorderedMatch) {
|
|
445
|
+
const items = [];
|
|
446
|
+
while (i < lines.length) {
|
|
447
|
+
const match = (lines[i] ?? "").match(/^\s*[-*]\s+(.*)$/);
|
|
448
|
+
if (!match) break;
|
|
449
|
+
items.push(match[1]);
|
|
450
|
+
i += 1;
|
|
451
|
+
}
|
|
452
|
+
blocks.push(/* @__PURE__ */ react.default.createElement("ul", { key: `ul-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ react.default.createElement("li", { key: `ul-li-${index}` }, renderInline(item)))));
|
|
453
|
+
continue;
|
|
442
454
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
455
|
+
if (orderedMatch) {
|
|
456
|
+
const items = [];
|
|
457
|
+
while (i < lines.length) {
|
|
458
|
+
const match = (lines[i] ?? "").match(/^\s*\d+\.\s+(.*)$/);
|
|
459
|
+
if (!match) break;
|
|
460
|
+
items.push(match[1]);
|
|
461
|
+
i += 1;
|
|
462
|
+
}
|
|
463
|
+
blocks.push(/* @__PURE__ */ react.default.createElement("ol", { key: `ol-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ react.default.createElement("li", { key: `ol-li-${index}` }, renderInline(item)))));
|
|
464
|
+
continue;
|
|
453
465
|
}
|
|
454
|
-
blocks.push(/* @__PURE__ */ react.default.createElement(
|
|
455
|
-
|
|
466
|
+
blocks.push(/* @__PURE__ */ react.default.createElement(react.default.Fragment, { key: `p-${blocks.length}` }, renderInline(line)));
|
|
467
|
+
if (i < lines.length - 1) blocks.push(/* @__PURE__ */ react.default.createElement("br", { key: `br-${blocks.length}` }));
|
|
468
|
+
i += 1;
|
|
456
469
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
470
|
+
return blocks;
|
|
471
|
+
} catch (error) {
|
|
472
|
+
return normalizedText;
|
|
460
473
|
}
|
|
461
|
-
return blocks;
|
|
462
474
|
};
|
|
463
475
|
|
|
464
476
|
//#endregion
|