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.js
CHANGED
|
@@ -265,7 +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
|
-
|
|
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;
|
|
269
277
|
const renderCode = (text) => {
|
|
270
278
|
return text.split(/`([^`]+)`/g).map((part, index) => {
|
|
271
279
|
if (!(index % 2 === 1)) return part;
|
|
@@ -371,40 +379,44 @@ const renderInlineMarkdown = (rawText) => {
|
|
|
371
379
|
const codeNodes = renderCode(text);
|
|
372
380
|
return renderStrongAndEm(codeNodes);
|
|
373
381
|
};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
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;
|
|
388
400
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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;
|
|
399
411
|
}
|
|
400
|
-
blocks.push(/* @__PURE__ */ React.createElement(
|
|
401
|
-
|
|
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;
|
|
402
415
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
416
|
+
return blocks;
|
|
417
|
+
} catch (error) {
|
|
418
|
+
return normalizedText;
|
|
406
419
|
}
|
|
407
|
-
return blocks;
|
|
408
420
|
};
|
|
409
421
|
|
|
410
422
|
//#endregion
|