@pagopa/io-app-design-system 6.0.7 → 6.1.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.
- package/lib/commonjs/components/badge/Badge.js +2 -2
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -2
- package/lib/commonjs/components/index.js +30 -19
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/markdown/CodeBlock.js +36 -0
- package/lib/commonjs/components/markdown/CodeBlock.js.map +1 -0
- package/lib/commonjs/components/markdown/IOMarkdown.js +71 -0
- package/lib/commonjs/components/markdown/IOMarkdown.js.map +1 -0
- package/lib/commonjs/components/markdown/IOMarkdownLite.js +22 -0
- package/lib/commonjs/components/markdown/IOMarkdownLite.js.map +1 -0
- package/lib/commonjs/components/markdown/ImageRenderer.js +53 -0
- package/lib/commonjs/components/markdown/ImageRenderer.js.map +1 -0
- package/lib/commonjs/components/markdown/index.js +20 -0
- package/lib/commonjs/components/markdown/index.js.map +1 -0
- package/lib/commonjs/components/markdown/parser.js +253 -0
- package/lib/commonjs/components/markdown/parser.js.map +1 -0
- package/lib/commonjs/components/markdown/rules.js +324 -0
- package/lib/commonjs/components/markdown/rules.js.map +1 -0
- package/lib/commonjs/components/markdown/types.js +6 -0
- package/lib/commonjs/components/markdown/types.js.map +1 -0
- package/lib/commonjs/components/markdown/utils.js +113 -0
- package/lib/commonjs/components/markdown/utils.js.map +1 -0
- package/lib/commonjs/components/modules/__test__/__snapshots__/ModuleNavigationAlt.test.tsx.snap +2 -2
- package/lib/commonjs/components/tag/Tag.js +2 -1
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/components/typography/BodySmall.js +6 -3
- package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
- package/lib/commonjs/utils/pipe.js +29 -0
- package/lib/commonjs/utils/pipe.js.map +1 -0
- package/lib/module/components/badge/Badge.js +2 -2
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -2
- package/lib/module/components/index.js +3 -2
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/markdown/CodeBlock.js +31 -0
- package/lib/module/components/markdown/CodeBlock.js.map +1 -0
- package/lib/module/components/markdown/IOMarkdown.js +66 -0
- package/lib/module/components/markdown/IOMarkdown.js.map +1 -0
- package/lib/module/components/markdown/IOMarkdownLite.js +17 -0
- package/lib/module/components/markdown/IOMarkdownLite.js.map +1 -0
- package/lib/module/components/markdown/ImageRenderer.js +48 -0
- package/lib/module/components/markdown/ImageRenderer.js.map +1 -0
- package/lib/module/components/markdown/index.js +5 -0
- package/lib/module/components/markdown/index.js.map +1 -0
- package/lib/module/components/markdown/parser.js +246 -0
- package/lib/module/components/markdown/parser.js.map +1 -0
- package/lib/module/components/markdown/rules.js +319 -0
- package/lib/module/components/markdown/rules.js.map +1 -0
- package/lib/module/components/markdown/types.js +4 -0
- package/lib/module/components/markdown/types.js.map +1 -0
- package/lib/module/components/markdown/utils.js +103 -0
- package/lib/module/components/markdown/utils.js.map +1 -0
- package/lib/module/components/modules/__test__/__snapshots__/ModuleNavigationAlt.test.tsx.snap +2 -2
- package/lib/module/components/tag/Tag.js +2 -1
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/components/typography/BodySmall.js +5 -2
- package/lib/module/components/typography/BodySmall.js.map +1 -1
- package/lib/module/utils/pipe.js +25 -0
- package/lib/module/utils/pipe.js.map +1 -0
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -2
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/markdown/CodeBlock.d.ts +10 -0
- package/lib/typescript/components/markdown/CodeBlock.d.ts.map +1 -0
- package/lib/typescript/components/markdown/IOMarkdown.d.ts +34 -0
- package/lib/typescript/components/markdown/IOMarkdown.d.ts.map +1 -0
- package/lib/typescript/components/markdown/IOMarkdownLite.d.ts +22 -0
- package/lib/typescript/components/markdown/IOMarkdownLite.d.ts.map +1 -0
- package/lib/typescript/components/markdown/ImageRenderer.d.ts +12 -0
- package/lib/typescript/components/markdown/ImageRenderer.d.ts.map +1 -0
- package/lib/typescript/components/markdown/index.d.ts +6 -0
- package/lib/typescript/components/markdown/index.d.ts.map +1 -0
- package/lib/typescript/components/markdown/parser.d.ts +17 -0
- package/lib/typescript/components/markdown/parser.d.ts.map +1 -0
- package/lib/typescript/components/markdown/rules.d.ts +6 -0
- package/lib/typescript/components/markdown/rules.d.ts.map +1 -0
- package/lib/typescript/components/markdown/types.d.ts +41 -0
- package/lib/typescript/components/markdown/types.d.ts.map +1 -0
- package/lib/typescript/components/markdown/utils.d.ts +27 -0
- package/lib/typescript/components/markdown/utils.d.ts.map +1 -0
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodySmall.d.ts +2 -0
- package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
- package/lib/typescript/utils/pipe.d.ts +25 -0
- package/lib/typescript/utils/pipe.d.ts.map +1 -0
- package/package.json +3 -1
- package/src/components/badge/Badge.tsx +2 -2
- package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -2
- package/src/components/index.tsx +3 -2
- package/src/components/markdown/CodeBlock.tsx +32 -0
- package/src/components/markdown/IOMarkdown.tsx +110 -0
- package/src/components/markdown/IOMarkdownLite.tsx +27 -0
- package/src/components/markdown/ImageRenderer.tsx +52 -0
- package/src/components/markdown/index.ts +7 -0
- package/src/components/markdown/parser.ts +334 -0
- package/src/components/markdown/rules.tsx +366 -0
- package/src/components/markdown/types.ts +81 -0
- package/src/components/markdown/utils.ts +127 -0
- package/src/components/modules/__test__/__snapshots__/ModuleNavigationAlt.test.tsx.snap +2 -2
- package/src/components/tag/Tag.tsx +2 -1
- package/src/components/typography/BodySmall.tsx +5 -2
- package/src/utils/pipe.ts +55 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import MarkdownIt from "markdown-it";
|
|
4
|
+
import { pipe } from "../../utils/pipe";
|
|
5
|
+
/* Two markdown-it instances: lite (no HTML) and full (HTML enabled) */
|
|
6
|
+
const mdLite = MarkdownIt({
|
|
7
|
+
html: false,
|
|
8
|
+
typographer: false,
|
|
9
|
+
linkify: false
|
|
10
|
+
});
|
|
11
|
+
const mdFull = MarkdownIt({
|
|
12
|
+
html: true,
|
|
13
|
+
typographer: false,
|
|
14
|
+
linkify: false
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a zero-dependency key generator for the markdown AST.
|
|
19
|
+
*
|
|
20
|
+
* These keys are only used as local React render keys, so they do not need
|
|
21
|
+
* cryptographic randomness or an external package: a per-parse incrementing
|
|
22
|
+
* counter is sufficient for our needs.
|
|
23
|
+
*/
|
|
24
|
+
const createKeyFactory = () => {
|
|
25
|
+
// eslint-disable-next-line functional/no-let
|
|
26
|
+
let keyCounter = 0;
|
|
27
|
+
return prefix => `md_${prefix}_${keyCounter++}`;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Complete set of all supported node types.
|
|
32
|
+
*/
|
|
33
|
+
const ALL_TYPES = new Set([/* lite types */
|
|
34
|
+
"heading1", "heading2", "heading3", "heading4", "heading5", "heading6", "paragraph", "text", "strong", "em", "link", "softbreak", "hardbreak", /* full types */
|
|
35
|
+
"bullet_list", "ordered_list", "list_item", "blockquote", "image", "code_inline", "fence", "hr", "html_block", "html_inline"]);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The types disabled when using IOMarkdownLite.
|
|
39
|
+
*/
|
|
40
|
+
export const LITE_DISABLED_TYPES = ["heading1", "heading2", "heading3", "heading4", "heading5", "heading6", "bullet_list", "ordered_list", "list_item", "blockquote", "image", "code_inline", "fence", "hr", "html_block", "html_inline"];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Maps a markdown-it token type to a MarkdownNodeType.
|
|
44
|
+
* Normalizes `*_open` / `*_close` suffixes and heading tags.
|
|
45
|
+
* Returns undefined for unsupported or disabled types.
|
|
46
|
+
*/
|
|
47
|
+
const getNodeType = (token, enabledTypes) => {
|
|
48
|
+
const cleanedType = token.type.replace(/_open|_close/g, "");
|
|
49
|
+
const type = cleanedType === "heading" ? `${cleanedType}${token.tag.slice(1)}` : cleanedType;
|
|
50
|
+
return enabledTypes.has(type) ? type : undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Flattens nested inline tokens into the parent token stream.
|
|
55
|
+
* markdown-it wraps inline content in `inline` tokens with children.
|
|
56
|
+
*/
|
|
57
|
+
const flattenInline = tokens => tokens.reduce((acc, token) => {
|
|
58
|
+
if (token.type === "inline" && token.children && token.children.length > 0) {
|
|
59
|
+
return [...acc, ...flattenInline(token.children)];
|
|
60
|
+
}
|
|
61
|
+
return [...acc, token];
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Converts a flat array of tokens into a hierarchical AST,
|
|
66
|
+
* skipping disabled/unsupported token types entirely.
|
|
67
|
+
*/
|
|
68
|
+
const tokensToAST = (tokens, enabledTypes, getKey) => {
|
|
69
|
+
if (!tokens || tokens.length === 0) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
const parseFrom = index => {
|
|
73
|
+
if (index >= tokens.length) {
|
|
74
|
+
return [[], index];
|
|
75
|
+
}
|
|
76
|
+
const token = tokens[index];
|
|
77
|
+
const nodeType = getNodeType(token, enabledTypes);
|
|
78
|
+
|
|
79
|
+
// Closing token — stop and return to caller
|
|
80
|
+
if (token.nesting === -1) {
|
|
81
|
+
return [[], index + 1];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Unsupported / disabled type — skip it
|
|
85
|
+
if (nodeType === undefined) {
|
|
86
|
+
if (token.nesting === 1) {
|
|
87
|
+
// Opening token: skip ahead to matching close
|
|
88
|
+
const findMatchingClose = (pos, depth) => pos >= tokens.length || depth === 0 ? pos : findMatchingClose(pos + 1, depth + tokens[pos].nesting);
|
|
89
|
+
return parseFrom(findMatchingClose(index + 1, 1));
|
|
90
|
+
}
|
|
91
|
+
// Self-closing / inline token: skip single token
|
|
92
|
+
return parseFrom(index + 1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Skip empty text nodes
|
|
96
|
+
if (nodeType === "text" && token.content === "") {
|
|
97
|
+
return parseFrom(index + 1);
|
|
98
|
+
}
|
|
99
|
+
const attributes = token.attrs?.reduce((prev, [name, value]) => ({
|
|
100
|
+
...prev,
|
|
101
|
+
[name]: value
|
|
102
|
+
}), {});
|
|
103
|
+
const node = {
|
|
104
|
+
type: nodeType,
|
|
105
|
+
key: getKey(nodeType),
|
|
106
|
+
content: token.content || undefined,
|
|
107
|
+
attributes: attributes || undefined,
|
|
108
|
+
children: [],
|
|
109
|
+
// Preserve ordered flag for lists
|
|
110
|
+
...(nodeType === "ordered_list" ? {
|
|
111
|
+
ordered: true
|
|
112
|
+
} : {}),
|
|
113
|
+
...(nodeType === "bullet_list" ? {
|
|
114
|
+
ordered: false
|
|
115
|
+
} : {}),
|
|
116
|
+
// Preserve image src and alt via attributes
|
|
117
|
+
...(nodeType === "image" ? {
|
|
118
|
+
attributes: {
|
|
119
|
+
...attributes,
|
|
120
|
+
src: token.attrGet?.("src") ?? attributes?.src ?? "",
|
|
121
|
+
alt: token.content ?? ""
|
|
122
|
+
}
|
|
123
|
+
} : {})
|
|
124
|
+
};
|
|
125
|
+
if (token.nesting === 1) {
|
|
126
|
+
// Opening token — parse children
|
|
127
|
+
const [childNodes, nextIndex] = parseFrom(index + 1);
|
|
128
|
+
const nodeWithChildren = {
|
|
129
|
+
...node,
|
|
130
|
+
children: childNodes
|
|
131
|
+
};
|
|
132
|
+
const [restNodes, finalIndex] = parseFrom(nextIndex);
|
|
133
|
+
return [[nodeWithChildren, ...restNodes], finalIndex];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Self-closing / inline token (nesting === 0)
|
|
137
|
+
const [restNodes, finalIndex] = parseFrom(index + 1);
|
|
138
|
+
return [[node, ...restNodes], finalIndex];
|
|
139
|
+
};
|
|
140
|
+
const [nodes] = parseFrom(0);
|
|
141
|
+
return nodes;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Lifts image nodes out of paragraph containers so they become
|
|
146
|
+
* top-level siblings. markdown-it always wraps images inside
|
|
147
|
+
* paragraphs; this post-processing step ensures the existing
|
|
148
|
+
* `imageRule` is actually invoked during rendering.
|
|
149
|
+
*
|
|
150
|
+
* - Paragraph with **only** image children → replaced by the images.
|
|
151
|
+
* - Paragraph with a **mix** of text and images → split into
|
|
152
|
+
* alternating paragraph (text run) and standalone image nodes.
|
|
153
|
+
* - Paragraphs without images → unchanged.
|
|
154
|
+
*/
|
|
155
|
+
const liftImages = (nodes, getKey) => nodes.flatMap(node => {
|
|
156
|
+
if (node.type !== "paragraph") {
|
|
157
|
+
return [node];
|
|
158
|
+
}
|
|
159
|
+
const hasImage = node.children.some(c => c.type === "image");
|
|
160
|
+
if (!hasImage) {
|
|
161
|
+
return [node];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Every child is an image → lift them all out
|
|
165
|
+
const allImages = node.children.every(c => c.type === "image");
|
|
166
|
+
if (allImages) {
|
|
167
|
+
// Return images as top-level nodes (they keep their own keys)
|
|
168
|
+
return [...node.children];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Mixed content: split children into text runs and standalone images.
|
|
172
|
+
// A single reduce accumulates finished nodes and the current text run;
|
|
173
|
+
// a trailing text run is flushed after the fold.
|
|
174
|
+
|
|
175
|
+
const wrapTextRun = run => ({
|
|
176
|
+
...node,
|
|
177
|
+
key: getKey("paragraph"),
|
|
178
|
+
children: run
|
|
179
|
+
});
|
|
180
|
+
const {
|
|
181
|
+
result,
|
|
182
|
+
textRun
|
|
183
|
+
} = node.children.reduce((acc, child) => child.type === "image" ? {
|
|
184
|
+
result: [...acc.result, ...(acc.textRun.length > 0 ? [wrapTextRun(acc.textRun)] : []), child],
|
|
185
|
+
textRun: []
|
|
186
|
+
} : {
|
|
187
|
+
...acc,
|
|
188
|
+
textRun: [...acc.textRun, child]
|
|
189
|
+
}, {
|
|
190
|
+
result: [],
|
|
191
|
+
textRun: []
|
|
192
|
+
});
|
|
193
|
+
return textRun.length > 0 ? [...result, wrapTextRun(textRun)] : [...result];
|
|
194
|
+
});
|
|
195
|
+
const annotateListDepth = (nodes, parentListDepth = 0) => nodes.map(node => {
|
|
196
|
+
const listDepth = parentListDepth;
|
|
197
|
+
const childListDepth = node.type === "bullet_list" || node.type === "ordered_list" ? parentListDepth + 1 : parentListDepth;
|
|
198
|
+
return {
|
|
199
|
+
...node,
|
|
200
|
+
listDepth,
|
|
201
|
+
children: annotateListDepth(node.children, childListDepth)
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Computes the enabled types set from the full set minus disabled types.
|
|
207
|
+
*/
|
|
208
|
+
const getEnabledTypes = disabledTypes => {
|
|
209
|
+
if (!disabledTypes || disabledTypes.length === 0) {
|
|
210
|
+
return ALL_TYPES;
|
|
211
|
+
}
|
|
212
|
+
const disabled = new Set(disabledTypes);
|
|
213
|
+
return new Set([...ALL_TYPES].filter(t => !disabled.has(t)));
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Parses a markdown source string into an AST.
|
|
218
|
+
* @param source The markdown string.
|
|
219
|
+
* @param disabledTypes Node types to exclude from parsing.
|
|
220
|
+
* @returns Array of MarkdownNode.
|
|
221
|
+
*/
|
|
222
|
+
export const parse = (source, disabledTypes) => {
|
|
223
|
+
const enabledTypes = getEnabledTypes(disabledTypes);
|
|
224
|
+
const needsHtml = enabledTypes.has("html_block") || enabledTypes.has("html_inline");
|
|
225
|
+
const md = needsHtml ? mdFull : mdLite;
|
|
226
|
+
const getKey = createKeyFactory();
|
|
227
|
+
return pipe(
|
|
228
|
+
// 1. Tokenize the markdown source using markdown-it
|
|
229
|
+
md.parse(source, {}),
|
|
230
|
+
// 2. Unwrap nested inline tokens into a flat token stream
|
|
231
|
+
flattenInline,
|
|
232
|
+
// 3. Convert the flat token stream into a hierarchical AST
|
|
233
|
+
tokens => tokensToAST(tokens, enabledTypes, getKey),
|
|
234
|
+
// 4. Hoist image nodes out of paragraph wrappers so imageRule is invoked
|
|
235
|
+
nodes => liftImages(nodes, getKey),
|
|
236
|
+
// 5. Drop empty paragraphs left behind by disabled/lifted node types
|
|
237
|
+
nodes => nodes.filter(n => n.type !== "paragraph" || n.children.length > 0),
|
|
238
|
+
// 6. Annotate nodes with their list nesting depth for rendering
|
|
239
|
+
annotateListDepth);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Parses markdown with the lite subset of rules only.
|
|
244
|
+
*/
|
|
245
|
+
export const parseLite = source => parse(source, LITE_DISABLED_TYPES);
|
|
246
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MarkdownIt","pipe","mdLite","html","typographer","linkify","mdFull","createKeyFactory","keyCounter","prefix","ALL_TYPES","Set","LITE_DISABLED_TYPES","getNodeType","token","enabledTypes","cleanedType","type","replace","tag","slice","has","undefined","flattenInline","tokens","reduce","acc","children","length","tokensToAST","getKey","parseFrom","index","nodeType","nesting","findMatchingClose","pos","depth","content","attributes","attrs","prev","name","value","node","key","ordered","src","attrGet","alt","childNodes","nextIndex","nodeWithChildren","restNodes","finalIndex","nodes","liftImages","flatMap","hasImage","some","c","allImages","every","wrapTextRun","run","result","textRun","child","annotateListDepth","parentListDepth","map","listDepth","childListDepth","getEnabledTypes","disabledTypes","disabled","filter","t","parse","source","needsHtml","md","n","parseLite"],"sourceRoot":"../../../../src","sources":["components/markdown/parser.ts"],"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ON,IAAI;EACT;EACAgF,EAAE,CAACH,KAAK,CAACC,MAAM,EAAE,CAAC,CAAC,CAAC;EACpB;EACAxD,aAAa;EACb;EACAC,MAAM,IAAIK,WAAW,CAACL,MAAM,EAAET,YAAY,EAAEe,MAAM,CAAC;EACnD;EACAyB,KAAK,IAAIC,UAAU,CAACD,KAAK,EAAEzB,MAAM,CAAC;EAClC;EACAyB,KAAK,IAAIA,KAAK,CAACqB,MAAM,CAACM,CAAC,IAAIA,CAAC,CAACjE,IAAI,KAAK,WAAW,IAAIiE,CAAC,CAACvD,QAAQ,CAACC,MAAM,GAAG,CAAC,CAAC;EAC3E;EACAwC,iBACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMe,SAAS,GAAIJ,MAAc,IACtCD,KAAK,CAACC,MAAM,EAAEnE,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { Fragment } from "react";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { Banner } from "../banner";
|
|
6
|
+
import { Divider, HSpacer, VSpacer } from "../layout";
|
|
7
|
+
import { Body } from "../typography/Body";
|
|
8
|
+
import { BodyMonospace } from "../typography/BodyMonospace";
|
|
9
|
+
import { H1 } from "../typography/H1";
|
|
10
|
+
import { H2 } from "../typography/H2";
|
|
11
|
+
import { H3 } from "../typography/H3";
|
|
12
|
+
import { H4 } from "../typography/H4";
|
|
13
|
+
import { H5 } from "../typography/H5";
|
|
14
|
+
import { H6 } from "../typography/H6";
|
|
15
|
+
import { IOText } from "../typography/IOText";
|
|
16
|
+
import { CodeBlock } from "./CodeBlock";
|
|
17
|
+
import { ImageRenderer } from "./ImageRenderer";
|
|
18
|
+
import { collectRawText, extractPictogramName, getOrderedListMarker, getUnorderedListBullet, isBrTag, stripPictogramPrefix } from "./utils";
|
|
19
|
+
|
|
20
|
+
/* ─── Inline flattening (shared between heading and paragraph rendering) ─── */
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
/**
|
|
23
|
+
* Recursively walks inline AST nodes and produces flat styled segments
|
|
24
|
+
* with accumulated bold/italic/link state.
|
|
25
|
+
*/
|
|
26
|
+
const flattenInlineNodes = (nodes, inherited) => nodes.reduce((acc, node) => {
|
|
27
|
+
switch (node.type) {
|
|
28
|
+
case "text":
|
|
29
|
+
case "code_inline":
|
|
30
|
+
return [...acc, {
|
|
31
|
+
key: node.key,
|
|
32
|
+
text: node.content ?? "",
|
|
33
|
+
style: inherited
|
|
34
|
+
}];
|
|
35
|
+
case "softbreak":
|
|
36
|
+
case "hardbreak":
|
|
37
|
+
return [...acc, {
|
|
38
|
+
key: node.key,
|
|
39
|
+
text: "\n",
|
|
40
|
+
style: inherited
|
|
41
|
+
}];
|
|
42
|
+
case "strong":
|
|
43
|
+
return [...acc, ...flattenInlineNodes(node.children, {
|
|
44
|
+
...inherited,
|
|
45
|
+
bold: true
|
|
46
|
+
})];
|
|
47
|
+
case "em":
|
|
48
|
+
return [...acc, ...flattenInlineNodes(node.children, {
|
|
49
|
+
...inherited,
|
|
50
|
+
italic: true
|
|
51
|
+
})];
|
|
52
|
+
case "link":
|
|
53
|
+
{
|
|
54
|
+
const href = node.attributes?.href;
|
|
55
|
+
return [...acc, ...flattenInlineNodes(node.children, {
|
|
56
|
+
...inherited,
|
|
57
|
+
link: href
|
|
58
|
+
})];
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
return acc;
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Renders a single styled segment as either a raw string
|
|
67
|
+
* or an IOText element with the appropriate props.
|
|
68
|
+
*/
|
|
69
|
+
const renderSegment = (segment, context, isCode) => {
|
|
70
|
+
if (isCode) {
|
|
71
|
+
return /*#__PURE__*/_jsx(BodyMonospace, {
|
|
72
|
+
children: segment.text
|
|
73
|
+
}, segment.key);
|
|
74
|
+
}
|
|
75
|
+
const {
|
|
76
|
+
bold,
|
|
77
|
+
italic,
|
|
78
|
+
link
|
|
79
|
+
} = segment.style;
|
|
80
|
+
return /*#__PURE__*/_jsx(IOText, {
|
|
81
|
+
...(bold ? {
|
|
82
|
+
weight: "Semibold"
|
|
83
|
+
} : {}),
|
|
84
|
+
...(italic ? {
|
|
85
|
+
fontStyle: "italic"
|
|
86
|
+
} : {}),
|
|
87
|
+
...(link ? {
|
|
88
|
+
color: context.linkColor,
|
|
89
|
+
onPress: () => context.onLinkPress?.(link),
|
|
90
|
+
accessibilityRole: "link",
|
|
91
|
+
textStyle: {
|
|
92
|
+
textDecorationLine: "underline"
|
|
93
|
+
}
|
|
94
|
+
} : {}),
|
|
95
|
+
size: context.fontSize,
|
|
96
|
+
lineHeight: context.lineHeight,
|
|
97
|
+
children: segment.text
|
|
98
|
+
}, segment.key);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/* ─── Heading component map ─── */
|
|
102
|
+
|
|
103
|
+
const headingComponentMap = {
|
|
104
|
+
heading1: H1,
|
|
105
|
+
heading2: H2,
|
|
106
|
+
heading3: H3,
|
|
107
|
+
heading4: H4,
|
|
108
|
+
heading5: H5,
|
|
109
|
+
heading6: H6
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/* ─── Block rendering helpers ─── */
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Renders a paragraph block by flattening inline children
|
|
116
|
+
* into styled segments.
|
|
117
|
+
*/
|
|
118
|
+
const renderParagraph = (node, context) => {
|
|
119
|
+
const segments = flattenInlineNodes(node.children, {
|
|
120
|
+
bold: false,
|
|
121
|
+
italic: false
|
|
122
|
+
});
|
|
123
|
+
return /*#__PURE__*/_jsx(Body, {
|
|
124
|
+
style: {
|
|
125
|
+
textAlign: context.textAlign
|
|
126
|
+
},
|
|
127
|
+
children: segments.map(seg => {
|
|
128
|
+
const matchingNode = node.children.find(c => c.key === seg.key);
|
|
129
|
+
const isCode = matchingNode?.type === "code_inline";
|
|
130
|
+
return renderSegment(seg, context, isCode);
|
|
131
|
+
})
|
|
132
|
+
}, node.key);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Creates a render rule for a heading level using the corresponding
|
|
137
|
+
* DS heading component (H1-H6). This ensures headings inherit
|
|
138
|
+
* dynamicTypeRamp, uppercase/letterSpacing (H5), legacy typeface (H6),
|
|
139
|
+
* and theme colors automatically.
|
|
140
|
+
*/
|
|
141
|
+
const makeHeadingRule = Heading => (node, _renderChildren, context) => {
|
|
142
|
+
const segments = flattenInlineNodes(node.children, {
|
|
143
|
+
bold: false,
|
|
144
|
+
italic: false
|
|
145
|
+
});
|
|
146
|
+
return /*#__PURE__*/_jsx(View, {
|
|
147
|
+
accessibilityRole: "header",
|
|
148
|
+
children: /*#__PURE__*/_jsx(Heading, {
|
|
149
|
+
style: {
|
|
150
|
+
textAlign: context.textAlign
|
|
151
|
+
},
|
|
152
|
+
children: segments.map(seg => seg.text)
|
|
153
|
+
})
|
|
154
|
+
}, node.key);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/* ─── Default render rules ─── */
|
|
158
|
+
|
|
159
|
+
const paragraphRule = (node, _renderChildren, context) => renderParagraph(node, context);
|
|
160
|
+
const textRule = node => /*#__PURE__*/_jsx(Fragment, {
|
|
161
|
+
children: node.content ?? ""
|
|
162
|
+
}, node.key);
|
|
163
|
+
const strongRule = (node, renderChildren) => /*#__PURE__*/_jsx(IOText, {
|
|
164
|
+
weight: "Semibold",
|
|
165
|
+
children: renderChildren(node.children)
|
|
166
|
+
}, node.key);
|
|
167
|
+
const emRule = (node, renderChildren) => /*#__PURE__*/_jsx(IOText, {
|
|
168
|
+
fontStyle: "italic",
|
|
169
|
+
children: renderChildren(node.children)
|
|
170
|
+
}, node.key);
|
|
171
|
+
const linkRule = (node, renderChildren, context) => {
|
|
172
|
+
const href = node.attributes?.href;
|
|
173
|
+
return /*#__PURE__*/_jsx(IOText, {
|
|
174
|
+
color: context.linkColor,
|
|
175
|
+
onPress: href ? () => context.onLinkPress?.(href) : undefined,
|
|
176
|
+
accessibilityRole: "link",
|
|
177
|
+
textStyle: {
|
|
178
|
+
textDecorationLine: "underline"
|
|
179
|
+
},
|
|
180
|
+
children: renderChildren(node.children)
|
|
181
|
+
}, node.key);
|
|
182
|
+
};
|
|
183
|
+
const softbreakRule = node => /*#__PURE__*/_jsx(Fragment, {
|
|
184
|
+
children: "\n"
|
|
185
|
+
}, node.key);
|
|
186
|
+
const hardbreakRule = node => /*#__PURE__*/_jsx(Fragment, {
|
|
187
|
+
children: "\n"
|
|
188
|
+
}, node.key);
|
|
189
|
+
const bulletListRule = (node, renderChildren) => /*#__PURE__*/_jsxs(View, {
|
|
190
|
+
accessible: true,
|
|
191
|
+
accessibilityRole: "list",
|
|
192
|
+
style: {
|
|
193
|
+
paddingLeft: 12
|
|
194
|
+
},
|
|
195
|
+
children: [/*#__PURE__*/_jsx(VSpacer, {
|
|
196
|
+
size: 8
|
|
197
|
+
}), node.children.map(child => /*#__PURE__*/_jsxs(View, {
|
|
198
|
+
style: {
|
|
199
|
+
flexDirection: "row"
|
|
200
|
+
},
|
|
201
|
+
children: [/*#__PURE__*/_jsx(Body, {
|
|
202
|
+
children: getUnorderedListBullet(node.listDepth ?? 0)
|
|
203
|
+
}), /*#__PURE__*/_jsx(HSpacer, {
|
|
204
|
+
size: 8
|
|
205
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
206
|
+
style: {
|
|
207
|
+
flex: 1,
|
|
208
|
+
flexShrink: 1
|
|
209
|
+
},
|
|
210
|
+
children: renderChildren(child.children)
|
|
211
|
+
})]
|
|
212
|
+
}, child.key)), /*#__PURE__*/_jsx(VSpacer, {
|
|
213
|
+
size: 8
|
|
214
|
+
})]
|
|
215
|
+
}, node.key);
|
|
216
|
+
const orderedListRule = (node, renderChildren) => /*#__PURE__*/_jsxs(View, {
|
|
217
|
+
accessible: true,
|
|
218
|
+
accessibilityRole: "list",
|
|
219
|
+
style: {
|
|
220
|
+
paddingLeft: 12
|
|
221
|
+
},
|
|
222
|
+
children: [/*#__PURE__*/_jsx(VSpacer, {
|
|
223
|
+
size: 8
|
|
224
|
+
}), node.children.map((child, i) => /*#__PURE__*/_jsxs(View, {
|
|
225
|
+
style: {
|
|
226
|
+
flexDirection: "row"
|
|
227
|
+
},
|
|
228
|
+
children: [/*#__PURE__*/_jsx(Body, {
|
|
229
|
+
children: getOrderedListMarker(i + 1, node.listDepth ?? 0)
|
|
230
|
+
}), /*#__PURE__*/_jsx(HSpacer, {
|
|
231
|
+
size: 8
|
|
232
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
233
|
+
style: {
|
|
234
|
+
flex: 1,
|
|
235
|
+
flexShrink: 1
|
|
236
|
+
},
|
|
237
|
+
children: renderChildren(child.children)
|
|
238
|
+
})]
|
|
239
|
+
}, child.key)), /*#__PURE__*/_jsx(VSpacer, {
|
|
240
|
+
size: 8
|
|
241
|
+
})]
|
|
242
|
+
}, node.key);
|
|
243
|
+
const listItemRule = (node, renderChildren) => /*#__PURE__*/_jsx(View, {
|
|
244
|
+
style: {
|
|
245
|
+
flex: 1,
|
|
246
|
+
flexShrink: 1
|
|
247
|
+
},
|
|
248
|
+
children: renderChildren(node.children)
|
|
249
|
+
}, node.key);
|
|
250
|
+
const blockquoteRule = node => {
|
|
251
|
+
const allText = collectRawText(node);
|
|
252
|
+
const pictogramName = extractPictogramName(allText);
|
|
253
|
+
|
|
254
|
+
// Find the first heading child for the banner title
|
|
255
|
+
const headingNode = node.children.find(c => c.type.startsWith("heading"));
|
|
256
|
+
const title = headingNode ? collectRawText(headingNode).trim() : undefined;
|
|
257
|
+
|
|
258
|
+
// Collect content from paragraph children, stripping the pictogram pattern
|
|
259
|
+
const content = node.children.filter(c => c.type === "paragraph").map(c => stripPictogramPrefix(collectRawText(c)).trim()).filter(Boolean).join("\n");
|
|
260
|
+
return /*#__PURE__*/_jsx(Banner, {
|
|
261
|
+
pictogramName: pictogramName,
|
|
262
|
+
color: "neutral",
|
|
263
|
+
title: title,
|
|
264
|
+
content: content || undefined
|
|
265
|
+
}, node.key);
|
|
266
|
+
};
|
|
267
|
+
const imageRule = node => /*#__PURE__*/_jsx(View, {
|
|
268
|
+
style: {
|
|
269
|
+
marginVertical: 16
|
|
270
|
+
},
|
|
271
|
+
children: /*#__PURE__*/_jsx(ImageRenderer, {
|
|
272
|
+
node: node
|
|
273
|
+
})
|
|
274
|
+
}, node.key);
|
|
275
|
+
const codeInlineRule = node => /*#__PURE__*/_jsx(BodyMonospace, {
|
|
276
|
+
children: node.content ?? ""
|
|
277
|
+
}, node.key);
|
|
278
|
+
const fenceRule = node => /*#__PURE__*/_jsx(CodeBlock, {
|
|
279
|
+
content: (node.content ?? "").trimEnd()
|
|
280
|
+
}, node.key);
|
|
281
|
+
const hrRule = node => /*#__PURE__*/_jsx(Divider, {}, node.key);
|
|
282
|
+
const htmlRule = node => {
|
|
283
|
+
if (node.content && isBrTag(node.content)) {
|
|
284
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
285
|
+
children: "\n"
|
|
286
|
+
}, node.key);
|
|
287
|
+
}
|
|
288
|
+
return null;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* The complete set of default render rules for all supported node types.
|
|
293
|
+
*/
|
|
294
|
+
export const DEFAULT_RULES = {
|
|
295
|
+
heading1: makeHeadingRule(headingComponentMap.heading1),
|
|
296
|
+
heading2: makeHeadingRule(headingComponentMap.heading2),
|
|
297
|
+
heading3: makeHeadingRule(headingComponentMap.heading3),
|
|
298
|
+
heading4: makeHeadingRule(headingComponentMap.heading4),
|
|
299
|
+
heading5: makeHeadingRule(headingComponentMap.heading5),
|
|
300
|
+
heading6: makeHeadingRule(headingComponentMap.heading6),
|
|
301
|
+
paragraph: paragraphRule,
|
|
302
|
+
text: textRule,
|
|
303
|
+
strong: strongRule,
|
|
304
|
+
em: emRule,
|
|
305
|
+
link: linkRule,
|
|
306
|
+
softbreak: softbreakRule,
|
|
307
|
+
hardbreak: hardbreakRule,
|
|
308
|
+
bullet_list: bulletListRule,
|
|
309
|
+
ordered_list: orderedListRule,
|
|
310
|
+
list_item: listItemRule,
|
|
311
|
+
blockquote: blockquoteRule,
|
|
312
|
+
image: imageRule,
|
|
313
|
+
code_inline: codeInlineRule,
|
|
314
|
+
fence: fenceRule,
|
|
315
|
+
hr: hrRule,
|
|
316
|
+
html_block: htmlRule,
|
|
317
|
+
html_inline: htmlRule
|
|
318
|
+
};
|
|
319
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Fragment","View","Banner","Divider","HSpacer","VSpacer","Body","BodyMonospace","H1","H2","H3","H4","H5","H6","IOText","CodeBlock","ImageRenderer","collectRawText","extractPictogramName","getOrderedListMarker","getUnorderedListBullet","isBrTag","stripPictogramPrefix","jsx","_jsx","jsxs","_jsxs","flattenInlineNodes","nodes","inherited","reduce","acc","node","type","key","text","content","style","children","bold","italic","href","attributes","link","renderSegment","segment","context","isCode","weight","fontStyle","color","linkColor","onPress","onLinkPress","accessibilityRole","textStyle","textDecorationLine","size","fontSize","lineHeight","headingComponentMap","heading1","heading2","heading3","heading4","heading5","heading6","renderParagraph","segments","textAlign","map","seg","matchingNode","find","c","makeHeadingRule","Heading","_renderChildren","paragraphRule","textRule","strongRule","renderChildren","emRule","linkRule","undefined","softbreakRule","hardbreakRule","bulletListRule","accessible","paddingLeft","child","flexDirection","listDepth","flex","flexShrink","orderedListRule","i","listItemRule","blockquoteRule","allText","pictogramName","headingNode","startsWith","title","trim","filter","Boolean","join","imageRule","marginVertical","codeInlineRule","fenceRule","trimEnd","hrRule","htmlRule","DEFAULT_RULES","paragraph","strong","em","softbreak","hardbreak","bullet_list","ordered_list","list_item","blockquote","image","code_inline","fence","hr","html_block","html_inline"],"sourceRoot":"../../../../src","sources":["components/markdown/rules.tsx"],"mappings":";;AAAA,OAAO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vDC,QAAQ,EAAEW,eAAe,CAACf,mBAAmB,CAACI,QAAQ,CAAC;EACvDC,QAAQ,EAAEU,eAAe,CAACf,mBAAmB,CAACK,QAAQ,CAAC;EACvDC,QAAQ,EAAES,eAAe,CAACf,mBAAmB,CAACM,QAAQ,CAAC;EACvDkD,SAAS,EAAEtC,aAAa;EACxB3C,IAAI,EAAE4C,QAAQ;EACdsC,MAAM,EAAErC,UAAU;EAClBsC,EAAE,EAAEpC,MAAM;EACVvC,IAAI,EAAEwC,QAAQ;EACdoC,SAAS,EAAElC,aAAa;EACxBmC,SAAS,EAAElC,aAAa;EACxBmC,WAAW,EAAElC,cAAc;EAC3BmC,YAAY,EAAE3B,eAAe;EAC7B4B,SAAS,EAAE1B,YAAY;EACvB2B,UAAU,EAAE1B,cAAc;EAC1B2B,KAAK,EAAEjB,SAAS;EAChBkB,WAAW,EAAEhB,cAAc;EAC3BiB,KAAK,EAAEhB,SAAS;EAChBiB,EAAE,EAAEf,MAAM;EACVgB,UAAU,EAAEf,QAAQ;EACpBgB,WAAW,EAAEhB;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/markdown/types.ts"],"mappings":"","ignoreList":[]}
|