lowcoder-comps 0.0.7 → 0.0.8
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/icons/icon-chart.svg +15 -0
- package/icons/icon-comp-calendar.svg +22 -0
- package/index.html +26 -0
- package/index.tsx +19 -0
- package/jest.config.js +5 -0
- package/package/012a06bb.js +34 -0
- package/package/06481cb7.js +1060 -0
- package/package/0c8b29d5.js +6 -0
- package/package/114884df.js +805 -0
- package/package/1264ddb2.js +194 -0
- package/package/1cee31ec.js +1095 -0
- package/package/269c3ba3.js +46662 -0
- package/package/2a2c2e55.js +799 -0
- package/package/2b3ab1e4.js +98763 -0
- package/package/37590a81.js +967 -0
- package/package/3cd7980e.js +184 -0
- package/package/40112498.js +424 -0
- package/package/4b6e1d6f.js +24 -0
- package/package/4bc1082b.js +86 -0
- package/package/53e49f9b.js +1600 -0
- package/package/55bd5c26.js +266 -0
- package/package/591684c8.js +2071 -0
- package/package/6c000872.js +16 -0
- package/package/756addec.js +775 -0
- package/package/7668124e.js +8 -0
- package/package/79e8eeeb.js +949 -0
- package/package/926fbfec.js +91 -0
- package/package/945eefb3.js +2665 -0
- package/package/a35f148e.js +1228 -0
- package/package/a4d12a43.js +175 -0
- package/package/a60de5d1.js +804 -0
- package/package/a8dde1ea.js +589 -0
- package/package/b4148642.js +7 -0
- package/package/b7dd22a2.js +847 -0
- package/package/d4f3a2c4.js +18046 -0
- package/package/e0f479f3.js +91 -0
- package/package/eaa160c9.js +341 -0
- package/package/f1bfd8b5.js +311 -0
- package/package/f1f9ba79.js +900 -0
- package/package/fba61f63.js +2868 -0
- package/package/icons/icon-chart.svg +15 -0
- package/package/icons/icon-comp-calendar.svg +22 -0
- package/package/index.js +5 -0
- package/package/package.json +73 -0
- package/package.json +1 -4
- package/src/__test__/allComp.test.tsx +61 -0
- package/src/app-env.d.ts +3 -0
- package/src/comps/calendarComp/calendarComp.tsx +442 -0
- package/src/comps/calendarComp/calendarConstants.tsx +897 -0
- package/src/comps/chartComp/chartComp.tsx +249 -0
- package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
- package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
- package/src/comps/chartComp/chartConfigs/chartUrls.tsx +6 -0
- package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
- package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
- package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
- package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
- package/src/comps/chartComp/chartConstants.tsx +243 -0
- package/src/comps/chartComp/chartPropertyView.tsx +161 -0
- package/src/comps/chartComp/chartUtils.ts +240 -0
- package/src/comps/chartComp/reactEcharts/core.tsx +187 -0
- package/src/comps/chartComp/reactEcharts/index.ts +20 -0
- package/src/comps/chartComp/reactEcharts/types.ts +70 -0
- package/src/comps/chartComp/seriesComp.tsx +119 -0
- package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
- package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
- package/src/comps/imageEditorComp/index.tsx +184 -0
- package/src/comps/mermaidComp/index.tsx +44 -0
- package/src/comps/mermaidComp/mermaid.tsx +29 -0
- package/src/global.ts +1 -0
- package/src/i18n/comps/index.tsx +29 -0
- package/src/i18n/comps/locales/en.ts +142 -0
- package/src/i18n/comps/locales/enObj.tsx +120 -0
- package/src/i18n/comps/locales/index.ts +7 -0
- package/src/i18n/comps/locales/types.tsx +9 -0
- package/src/i18n/comps/locales/zh.ts +4 -0
- package/src/i18n/comps/locales/zhObj.tsx +4 -0
- package/src/index.ts +11 -0
- package/vite.config.js +10 -0
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
import { l as lt, _ as ut } from "./2b3ab1e4.js";
|
|
2
|
+
var it = /\r\n?/g, ot = /\t/g, ct = /\f/g, J = function(t) {
|
|
3
|
+
return t.replace(it, `
|
|
4
|
+
`).replace(ct, "").replace(ot, " ");
|
|
5
|
+
}, Q = function(t, e) {
|
|
6
|
+
var r = t || {};
|
|
7
|
+
if (e != null)
|
|
8
|
+
for (var a in e)
|
|
9
|
+
Object.prototype.hasOwnProperty.call(e, a) && (r[a] = e[a]);
|
|
10
|
+
return r;
|
|
11
|
+
}, V = function(t, e) {
|
|
12
|
+
var r = Object.keys(t).filter(function(i) {
|
|
13
|
+
var u = t[i];
|
|
14
|
+
if (u == null || u.match == null)
|
|
15
|
+
return !1;
|
|
16
|
+
var c = u.order;
|
|
17
|
+
return (typeof c != "number" || !isFinite(c)) && typeof console != "undefined" && console.warn("simple-markdown: Invalid order for rule `" + i + "`: " + String(c)), !0;
|
|
18
|
+
});
|
|
19
|
+
r.sort(function(i, u) {
|
|
20
|
+
var c = t[i], f = t[u], s = c.order, p = f.order;
|
|
21
|
+
if (s !== p)
|
|
22
|
+
return s - p;
|
|
23
|
+
var h = c.quality ? 0 : 1, g = f.quality ? 0 : 1;
|
|
24
|
+
return h !== g ? h - g : i < u ? -1 : i > u ? 1 : 0;
|
|
25
|
+
});
|
|
26
|
+
var a, l = function i(u, c) {
|
|
27
|
+
var f = [];
|
|
28
|
+
for (c = c || a, a = c; u; ) {
|
|
29
|
+
var s = null, p = null, h = null, g = NaN, S = 0, x = r[0], y = t[x];
|
|
30
|
+
do {
|
|
31
|
+
var E = y.order, b = c.prevCapture == null ? "" : c.prevCapture[0], k = y.match(u, c, b);
|
|
32
|
+
if (k) {
|
|
33
|
+
var A = y.quality ? y.quality(k, c, b) : 0;
|
|
34
|
+
A <= g || (s = x, p = y, h = k, g = A);
|
|
35
|
+
}
|
|
36
|
+
S++, x = r[S], y = t[x];
|
|
37
|
+
} while (y && (!h || y.order === E && y.quality));
|
|
38
|
+
if (p == null || h == null)
|
|
39
|
+
throw new Error("Could not find a matching rule for the below content. The rule with highest `order` should always match content provided to it. Check the definition of `match` for '" + r[r.length - 1] + `'. It seems to not match the following source:
|
|
40
|
+
` + u);
|
|
41
|
+
if (h.index)
|
|
42
|
+
throw new Error("`match` must return a capture starting at index 0 (the current parse index). Did you forget a ^ at the start of the RegExp?");
|
|
43
|
+
var w = p.parse(h, i, c);
|
|
44
|
+
if (Array.isArray(w))
|
|
45
|
+
Array.prototype.push.apply(f, w);
|
|
46
|
+
else {
|
|
47
|
+
if (w == null || typeof w != "object")
|
|
48
|
+
throw new Error("parse() function returned invalid parse result: '".concat(w, "'"));
|
|
49
|
+
w.type == null && (w.type = s), f.push(w);
|
|
50
|
+
}
|
|
51
|
+
c.prevCapture = h, u = u.substring(c.prevCapture[0].length);
|
|
52
|
+
}
|
|
53
|
+
return f;
|
|
54
|
+
}, o = function(u, c) {
|
|
55
|
+
return a = Q(c, e), !a.inline && !a.disableAutoBlockNewlines && (u = u + `
|
|
56
|
+
|
|
57
|
+
`), a.prevCapture = null, l(J(u), a);
|
|
58
|
+
};
|
|
59
|
+
return o;
|
|
60
|
+
}, _ = function(t) {
|
|
61
|
+
var e = function(a, l, o) {
|
|
62
|
+
return l.inline ? t.exec(a) : null;
|
|
63
|
+
};
|
|
64
|
+
return e.regex = t, e;
|
|
65
|
+
}, T = function(t) {
|
|
66
|
+
var e = function(a, l) {
|
|
67
|
+
return l.inline ? null : t.exec(a);
|
|
68
|
+
};
|
|
69
|
+
return e.regex = t, e;
|
|
70
|
+
}, j = function(t) {
|
|
71
|
+
var e = function(a, l) {
|
|
72
|
+
return t.exec(a);
|
|
73
|
+
};
|
|
74
|
+
return e.regex = t, e;
|
|
75
|
+
}, ft = typeof Symbol == "function" && Symbol.for && Symbol.for("react.element") || 60103, v = function(t, e, r) {
|
|
76
|
+
var a = {
|
|
77
|
+
$$typeof: ft,
|
|
78
|
+
type: t,
|
|
79
|
+
key: e == null ? void 0 : e,
|
|
80
|
+
ref: null,
|
|
81
|
+
props: r,
|
|
82
|
+
_owner: null
|
|
83
|
+
};
|
|
84
|
+
return a;
|
|
85
|
+
}, d = function(t, e, r, a) {
|
|
86
|
+
r = r || {}, a = typeof a != "undefined" ? a : !0;
|
|
87
|
+
var l = "";
|
|
88
|
+
for (var o in r) {
|
|
89
|
+
var i = r[o];
|
|
90
|
+
Object.prototype.hasOwnProperty.call(r, o) && i && (l += " " + R(o) + '="' + R(i) + '"');
|
|
91
|
+
}
|
|
92
|
+
var u = "<" + t + l + ">";
|
|
93
|
+
return a ? u + e + "</" + t + ">" : u;
|
|
94
|
+
}, U = {}, I = function(t) {
|
|
95
|
+
if (t == null)
|
|
96
|
+
return null;
|
|
97
|
+
try {
|
|
98
|
+
var e = new URL(t, "https://localhost").protocol;
|
|
99
|
+
if (e.indexOf("javascript:") === 0 || e.indexOf("vbscript:") === 0 || e.indexOf("data:") === 0)
|
|
100
|
+
return null;
|
|
101
|
+
} catch (r) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return t;
|
|
105
|
+
}, st = /[<>&"']/g, pt = {
|
|
106
|
+
"<": "<",
|
|
107
|
+
">": ">",
|
|
108
|
+
"&": "&",
|
|
109
|
+
'"': """,
|
|
110
|
+
"'": "'",
|
|
111
|
+
"/": "/",
|
|
112
|
+
"`": "`"
|
|
113
|
+
}, R = function(t) {
|
|
114
|
+
return String(t).replace(st, function(e) {
|
|
115
|
+
return pt[e];
|
|
116
|
+
});
|
|
117
|
+
}, ht = /\\([^0-9A-Za-z\s])/g, M = function(t) {
|
|
118
|
+
return t.replace(ht, "$1");
|
|
119
|
+
}, B = function(t, e, r) {
|
|
120
|
+
var a = r.inline || !1;
|
|
121
|
+
r.inline = !0;
|
|
122
|
+
var l = t(e, r);
|
|
123
|
+
return r.inline = a, l;
|
|
124
|
+
}, mt = function(t, e, r) {
|
|
125
|
+
var a = r.inline || !1;
|
|
126
|
+
r.inline = !1;
|
|
127
|
+
var l = t(e + `
|
|
128
|
+
|
|
129
|
+
`, r);
|
|
130
|
+
return r.inline = a, l;
|
|
131
|
+
}, O = function(t, e, r) {
|
|
132
|
+
return {
|
|
133
|
+
content: B(e, t[1], r)
|
|
134
|
+
};
|
|
135
|
+
}, F = function() {
|
|
136
|
+
return {};
|
|
137
|
+
}, N = "(?:[*+-]|\\d+\\.)", tt = "( *)(" + N + ") +", K = new RegExp("^" + tt), gt = new RegExp(tt + "[^\\n]*(?:\\n(?!\\1" + N + ` )[^\\n]*)*(
|
|
138
|
+
|$)`, "gm"), et = /\n{2,}$/, vt = /^ (?= *`)|(` *) $/g, dt = et, z = / *\n+$/, yt = new RegExp("^( *)(" + N + `) [\\s\\S]+?(?:
|
|
139
|
+
{2,}(?! )(?!\\1` + N + ` )\\n*|\\s*
|
|
140
|
+
*$)`), xt = /(?:^|\n)( *)$/, P = function() {
|
|
141
|
+
var n = /^ *\| *| *\| *$/g, t = / *$/, e = /^ *-+: *$/, r = /^ *:-+: *$/, a = /^ *:-+ *$/, l = function(s) {
|
|
142
|
+
return e.test(s) ? "right" : r.test(s) ? "center" : a.test(s) ? "left" : null;
|
|
143
|
+
}, o = function(s, p, h, g) {
|
|
144
|
+
g && (s = s.replace(n, ""));
|
|
145
|
+
var S = s.trim().split("|");
|
|
146
|
+
return S.map(l);
|
|
147
|
+
}, i = function(s, p, h, g) {
|
|
148
|
+
var S = h.inTable;
|
|
149
|
+
h.inTable = !0;
|
|
150
|
+
var x = p(s.trim(), h);
|
|
151
|
+
h.inTable = S;
|
|
152
|
+
var y = [[]];
|
|
153
|
+
return x.forEach(function(E, b) {
|
|
154
|
+
E.type === "tableSeparator" ? (!g || b !== 0 && b !== x.length - 1) && y.push([]) : (E.type === "text" && (x[b + 1] == null || x[b + 1].type === "tableSeparator") && (E.content = E.content.replace(t, "")), y[y.length - 1].push(E));
|
|
155
|
+
}), y;
|
|
156
|
+
}, u = function(s, p, h, g) {
|
|
157
|
+
var S = s.trim().split(`
|
|
158
|
+
`);
|
|
159
|
+
return S.map(function(x) {
|
|
160
|
+
return i(x, p, h, g);
|
|
161
|
+
});
|
|
162
|
+
}, c = function(s) {
|
|
163
|
+
return function(p, h, g) {
|
|
164
|
+
g.inline = !0;
|
|
165
|
+
var S = i(p[1], h, g, s), x = o(p[2], h, g, s), y = u(p[3], h, g, s);
|
|
166
|
+
return g.inline = !1, {
|
|
167
|
+
type: "table",
|
|
168
|
+
header: S,
|
|
169
|
+
align: x,
|
|
170
|
+
cells: y
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
return {
|
|
175
|
+
parseTable: c(!0),
|
|
176
|
+
parseNpTable: c(!1),
|
|
177
|
+
TABLE_REGEX: /^ *(\|.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/,
|
|
178
|
+
NPTABLE_REGEX: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/
|
|
179
|
+
};
|
|
180
|
+
}(), C = "(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*", G = `\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*`, _t = /mailto:/i, X = function(t, e, r) {
|
|
181
|
+
var a = (t[2] || t[1]).replace(/\s+/g, " ").toLowerCase();
|
|
182
|
+
if (e._defs && e._defs[a]) {
|
|
183
|
+
var l = e._defs[a];
|
|
184
|
+
r.target = l.target, r.title = l.title;
|
|
185
|
+
}
|
|
186
|
+
return e._refs = e._refs || {}, e._refs[a] = e._refs[a] || [], e._refs[a].push(r), r;
|
|
187
|
+
}, m = 0, L = {
|
|
188
|
+
Array: {
|
|
189
|
+
react: function(t, e, r) {
|
|
190
|
+
for (var a = r.key, l = [], o = 0, i = 0; o < t.length; o++, i++) {
|
|
191
|
+
r.key = "" + o;
|
|
192
|
+
var u = t[o];
|
|
193
|
+
if (u.type === "text")
|
|
194
|
+
for (u = {
|
|
195
|
+
type: "text",
|
|
196
|
+
content: u.content
|
|
197
|
+
}; o + 1 < t.length && t[o + 1].type === "text"; o++)
|
|
198
|
+
u.content += t[o + 1].content;
|
|
199
|
+
l.push(e(u, r));
|
|
200
|
+
}
|
|
201
|
+
return r.key = a, l;
|
|
202
|
+
},
|
|
203
|
+
html: function(t, e, r) {
|
|
204
|
+
for (var a = "", l = 0; l < t.length; l++) {
|
|
205
|
+
var o = t[l];
|
|
206
|
+
if (o.type === "text")
|
|
207
|
+
for (o = {
|
|
208
|
+
type: "text",
|
|
209
|
+
content: o.content
|
|
210
|
+
}; l + 1 < t.length && t[l + 1].type === "text"; l++)
|
|
211
|
+
o.content += t[l + 1].content;
|
|
212
|
+
a += e(o, r);
|
|
213
|
+
}
|
|
214
|
+
return a;
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
heading: {
|
|
218
|
+
order: m++,
|
|
219
|
+
match: T(/^ *(#{1,6})([^\n]+?)#* *(?:\n *)+\n/),
|
|
220
|
+
parse: function(n) {
|
|
221
|
+
function t(e, r, a) {
|
|
222
|
+
return n.apply(this, arguments);
|
|
223
|
+
}
|
|
224
|
+
return t.toString = function() {
|
|
225
|
+
return n.toString();
|
|
226
|
+
}, t;
|
|
227
|
+
}(function(n, t, e) {
|
|
228
|
+
return {
|
|
229
|
+
level: n[1].length,
|
|
230
|
+
content: B(t, n[2].trim(), e)
|
|
231
|
+
};
|
|
232
|
+
}),
|
|
233
|
+
react: function(t, e, r) {
|
|
234
|
+
return v("h" + t.level, r.key, {
|
|
235
|
+
children: e(t.content, r)
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
html: function(t, e, r) {
|
|
239
|
+
return d("h" + t.level, e(t.content, r));
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
nptable: {
|
|
243
|
+
order: m++,
|
|
244
|
+
match: T(P.NPTABLE_REGEX),
|
|
245
|
+
parse: P.parseNpTable,
|
|
246
|
+
react: null,
|
|
247
|
+
html: null
|
|
248
|
+
},
|
|
249
|
+
lheading: {
|
|
250
|
+
order: m++,
|
|
251
|
+
match: T(/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/),
|
|
252
|
+
parse: function(n) {
|
|
253
|
+
function t(e, r, a) {
|
|
254
|
+
return n.apply(this, arguments);
|
|
255
|
+
}
|
|
256
|
+
return t.toString = function() {
|
|
257
|
+
return n.toString();
|
|
258
|
+
}, t;
|
|
259
|
+
}(function(n, t, e) {
|
|
260
|
+
return {
|
|
261
|
+
type: "heading",
|
|
262
|
+
level: n[2] === "=" ? 1 : 2,
|
|
263
|
+
content: B(t, n[1], e)
|
|
264
|
+
};
|
|
265
|
+
}),
|
|
266
|
+
react: null,
|
|
267
|
+
html: null
|
|
268
|
+
},
|
|
269
|
+
hr: {
|
|
270
|
+
order: m++,
|
|
271
|
+
match: T(/^( *[-*_]){3,} *(?:\n *)+\n/),
|
|
272
|
+
parse: F,
|
|
273
|
+
react: function(t, e, r) {
|
|
274
|
+
return v("hr", r.key, U);
|
|
275
|
+
},
|
|
276
|
+
html: function(t, e, r) {
|
|
277
|
+
return "<hr>";
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
codeBlock: {
|
|
281
|
+
order: m++,
|
|
282
|
+
match: T(/^(?: [^\n]+\n*)+(?:\n *)+\n/),
|
|
283
|
+
parse: function(n) {
|
|
284
|
+
function t(e, r, a) {
|
|
285
|
+
return n.apply(this, arguments);
|
|
286
|
+
}
|
|
287
|
+
return t.toString = function() {
|
|
288
|
+
return n.toString();
|
|
289
|
+
}, t;
|
|
290
|
+
}(function(n, t, e) {
|
|
291
|
+
var r = n[0].replace(/^ /gm, "").replace(/\n+$/, "");
|
|
292
|
+
return {
|
|
293
|
+
lang: void 0,
|
|
294
|
+
content: r
|
|
295
|
+
};
|
|
296
|
+
}),
|
|
297
|
+
react: function(t, e, r) {
|
|
298
|
+
var a = t.lang ? "markdown-code-" + t.lang : void 0;
|
|
299
|
+
return v("pre", r.key, {
|
|
300
|
+
children: v("code", null, {
|
|
301
|
+
className: a,
|
|
302
|
+
children: t.content
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
html: function(t, e, r) {
|
|
307
|
+
var a = t.lang ? "markdown-code-" + t.lang : void 0, l = d("code", R(t.content), {
|
|
308
|
+
class: a
|
|
309
|
+
});
|
|
310
|
+
return d("pre", l);
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
fence: {
|
|
314
|
+
order: m++,
|
|
315
|
+
match: T(/^ *(`{3,}|~{3,}) *(?:(\S+) *)?\n([\s\S]+?)\n?\1 *(?:\n *)+\n/),
|
|
316
|
+
parse: function(n) {
|
|
317
|
+
function t(e, r, a) {
|
|
318
|
+
return n.apply(this, arguments);
|
|
319
|
+
}
|
|
320
|
+
return t.toString = function() {
|
|
321
|
+
return n.toString();
|
|
322
|
+
}, t;
|
|
323
|
+
}(function(n, t, e) {
|
|
324
|
+
return {
|
|
325
|
+
type: "codeBlock",
|
|
326
|
+
lang: n[2] || void 0,
|
|
327
|
+
content: n[3]
|
|
328
|
+
};
|
|
329
|
+
}),
|
|
330
|
+
react: null,
|
|
331
|
+
html: null
|
|
332
|
+
},
|
|
333
|
+
blockQuote: {
|
|
334
|
+
order: m++,
|
|
335
|
+
match: T(/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/),
|
|
336
|
+
parse: function(n) {
|
|
337
|
+
function t(e, r, a) {
|
|
338
|
+
return n.apply(this, arguments);
|
|
339
|
+
}
|
|
340
|
+
return t.toString = function() {
|
|
341
|
+
return n.toString();
|
|
342
|
+
}, t;
|
|
343
|
+
}(function(n, t, e) {
|
|
344
|
+
var r = n[0].replace(/^ *> ?/gm, "");
|
|
345
|
+
return {
|
|
346
|
+
content: t(r, e)
|
|
347
|
+
};
|
|
348
|
+
}),
|
|
349
|
+
react: function(t, e, r) {
|
|
350
|
+
return v("blockquote", r.key, {
|
|
351
|
+
children: e(t.content, r)
|
|
352
|
+
});
|
|
353
|
+
},
|
|
354
|
+
html: function(t, e, r) {
|
|
355
|
+
return d("blockquote", e(t.content, r));
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
list: {
|
|
359
|
+
order: m++,
|
|
360
|
+
match: function(t, e) {
|
|
361
|
+
var r = e.prevCapture == null ? "" : e.prevCapture[0], a = xt.exec(r), l = e._list || !e.inline;
|
|
362
|
+
return a && l ? (t = a[1] + t, yt.exec(t)) : null;
|
|
363
|
+
},
|
|
364
|
+
parse: function(n) {
|
|
365
|
+
function t(e, r, a) {
|
|
366
|
+
return n.apply(this, arguments);
|
|
367
|
+
}
|
|
368
|
+
return t.toString = function() {
|
|
369
|
+
return n.toString();
|
|
370
|
+
}, t;
|
|
371
|
+
}(function(n, t, e) {
|
|
372
|
+
var r = n[2], a = r.length > 1, l = a ? +r : void 0, o = n[0].replace(dt, `
|
|
373
|
+
`).match(gt), i = !1, u = o.map(function(c, f) {
|
|
374
|
+
var s = K.exec(c), p = s ? s[0].length : 0, h = new RegExp("^ {1," + p + "}", "gm"), g = c.replace(h, "").replace(K, ""), S = f === o.length - 1, x = g.indexOf(`
|
|
375
|
+
|
|
376
|
+
`) !== -1, y = x || S && i;
|
|
377
|
+
i = y;
|
|
378
|
+
var E = e.inline, b = e._list;
|
|
379
|
+
e._list = !0;
|
|
380
|
+
var k;
|
|
381
|
+
y ? (e.inline = !1, k = g.replace(z, `
|
|
382
|
+
|
|
383
|
+
`)) : (e.inline = !0, k = g.replace(z, ""));
|
|
384
|
+
var A = t(k, e);
|
|
385
|
+
return e.inline = E, e._list = b, A;
|
|
386
|
+
});
|
|
387
|
+
return {
|
|
388
|
+
ordered: a,
|
|
389
|
+
start: l,
|
|
390
|
+
items: u
|
|
391
|
+
};
|
|
392
|
+
}),
|
|
393
|
+
react: function(t, e, r) {
|
|
394
|
+
var a = t.ordered ? "ol" : "ul";
|
|
395
|
+
return v(a, r.key, {
|
|
396
|
+
start: t.start,
|
|
397
|
+
children: t.items.map(function(l, o) {
|
|
398
|
+
return v("li", "" + o, {
|
|
399
|
+
children: e(l, r)
|
|
400
|
+
});
|
|
401
|
+
})
|
|
402
|
+
});
|
|
403
|
+
},
|
|
404
|
+
html: function(t, e, r) {
|
|
405
|
+
var a = t.items.map(function(i) {
|
|
406
|
+
return d("li", e(i, r));
|
|
407
|
+
}).join(""), l = t.ordered ? "ol" : "ul", o = {
|
|
408
|
+
start: t.start
|
|
409
|
+
};
|
|
410
|
+
return d(l, a, o);
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
def: {
|
|
414
|
+
order: m++,
|
|
415
|
+
match: T(/^ *\[([^\]]+)\]: *<?([^\s>]*)>?(?: +["(]([^\n]+)[")])? *\n(?: *\n)*/),
|
|
416
|
+
parse: function(n) {
|
|
417
|
+
function t(e, r, a) {
|
|
418
|
+
return n.apply(this, arguments);
|
|
419
|
+
}
|
|
420
|
+
return t.toString = function() {
|
|
421
|
+
return n.toString();
|
|
422
|
+
}, t;
|
|
423
|
+
}(function(n, t, e) {
|
|
424
|
+
var r = n[1].replace(/\s+/g, " ").toLowerCase(), a = n[2], l = n[3];
|
|
425
|
+
return e._refs && e._refs[r] && e._refs[r].forEach(function(o) {
|
|
426
|
+
o.target = a, o.title = l;
|
|
427
|
+
}), e._defs = e._defs || {}, e._defs[r] = {
|
|
428
|
+
target: a,
|
|
429
|
+
title: l
|
|
430
|
+
}, {
|
|
431
|
+
def: r,
|
|
432
|
+
target: a,
|
|
433
|
+
title: l
|
|
434
|
+
};
|
|
435
|
+
}),
|
|
436
|
+
react: function() {
|
|
437
|
+
return null;
|
|
438
|
+
},
|
|
439
|
+
html: function() {
|
|
440
|
+
return "";
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
table: {
|
|
444
|
+
order: m++,
|
|
445
|
+
match: T(P.TABLE_REGEX),
|
|
446
|
+
parse: P.parseTable,
|
|
447
|
+
react: function(t, e, r) {
|
|
448
|
+
var a = function(u) {
|
|
449
|
+
return t.align[u] == null ? {} : {
|
|
450
|
+
textAlign: t.align[u]
|
|
451
|
+
};
|
|
452
|
+
}, l = t.header.map(function(i, u) {
|
|
453
|
+
return v("th", "" + u, {
|
|
454
|
+
style: a(u),
|
|
455
|
+
scope: "col",
|
|
456
|
+
children: e(i, r)
|
|
457
|
+
});
|
|
458
|
+
}), o = t.cells.map(function(i, u) {
|
|
459
|
+
return v("tr", "" + u, {
|
|
460
|
+
children: i.map(function(c, f) {
|
|
461
|
+
return v("td", "" + f, {
|
|
462
|
+
style: a(f),
|
|
463
|
+
children: e(c, r)
|
|
464
|
+
});
|
|
465
|
+
})
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
return v("table", r.key, {
|
|
469
|
+
children: [v("thead", "thead", {
|
|
470
|
+
children: v("tr", null, {
|
|
471
|
+
children: l
|
|
472
|
+
})
|
|
473
|
+
}), v("tbody", "tbody", {
|
|
474
|
+
children: o
|
|
475
|
+
})]
|
|
476
|
+
});
|
|
477
|
+
},
|
|
478
|
+
html: function(t, e, r) {
|
|
479
|
+
var a = function(f) {
|
|
480
|
+
return t.align[f] == null ? "" : "text-align:" + t.align[f] + ";";
|
|
481
|
+
}, l = t.header.map(function(c, f) {
|
|
482
|
+
return d("th", e(c, r), {
|
|
483
|
+
style: a(f),
|
|
484
|
+
scope: "col"
|
|
485
|
+
});
|
|
486
|
+
}).join(""), o = t.cells.map(function(c) {
|
|
487
|
+
var f = c.map(function(s, p) {
|
|
488
|
+
return d("td", e(s, r), {
|
|
489
|
+
style: a(p)
|
|
490
|
+
});
|
|
491
|
+
}).join("");
|
|
492
|
+
return d("tr", f);
|
|
493
|
+
}).join(""), i = d("thead", d("tr", l)), u = d("tbody", o);
|
|
494
|
+
return d("table", i + u);
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
newline: {
|
|
498
|
+
order: m++,
|
|
499
|
+
match: T(/^(?:\n *)*\n/),
|
|
500
|
+
parse: F,
|
|
501
|
+
react: function(t, e, r) {
|
|
502
|
+
return `
|
|
503
|
+
`;
|
|
504
|
+
},
|
|
505
|
+
html: function(t, e, r) {
|
|
506
|
+
return `
|
|
507
|
+
`;
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
paragraph: {
|
|
511
|
+
order: m++,
|
|
512
|
+
match: T(/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/),
|
|
513
|
+
parse: O,
|
|
514
|
+
react: function(t, e, r) {
|
|
515
|
+
return v("div", r.key, {
|
|
516
|
+
className: "paragraph",
|
|
517
|
+
children: e(t.content, r)
|
|
518
|
+
});
|
|
519
|
+
},
|
|
520
|
+
html: function(t, e, r) {
|
|
521
|
+
var a = {
|
|
522
|
+
class: "paragraph"
|
|
523
|
+
};
|
|
524
|
+
return d("div", e(t.content, r), a);
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
escape: {
|
|
528
|
+
order: m++,
|
|
529
|
+
match: _(/^\\([^0-9A-Za-z\s])/),
|
|
530
|
+
parse: function(n) {
|
|
531
|
+
function t(e, r, a) {
|
|
532
|
+
return n.apply(this, arguments);
|
|
533
|
+
}
|
|
534
|
+
return t.toString = function() {
|
|
535
|
+
return n.toString();
|
|
536
|
+
}, t;
|
|
537
|
+
}(function(n, t, e) {
|
|
538
|
+
return {
|
|
539
|
+
type: "text",
|
|
540
|
+
content: n[1]
|
|
541
|
+
};
|
|
542
|
+
}),
|
|
543
|
+
react: null,
|
|
544
|
+
html: null
|
|
545
|
+
},
|
|
546
|
+
tableSeparator: {
|
|
547
|
+
order: m++,
|
|
548
|
+
match: function(t, e) {
|
|
549
|
+
return e.inTable ? /^ *\| */.exec(t) : null;
|
|
550
|
+
},
|
|
551
|
+
parse: function() {
|
|
552
|
+
return {
|
|
553
|
+
type: "tableSeparator"
|
|
554
|
+
};
|
|
555
|
+
},
|
|
556
|
+
react: function() {
|
|
557
|
+
return " | ";
|
|
558
|
+
},
|
|
559
|
+
html: function() {
|
|
560
|
+
return " | ";
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
autolink: {
|
|
564
|
+
order: m++,
|
|
565
|
+
match: _(/^<([^: >]+:\/[^ >]+)>/),
|
|
566
|
+
parse: function(n) {
|
|
567
|
+
function t(e, r, a) {
|
|
568
|
+
return n.apply(this, arguments);
|
|
569
|
+
}
|
|
570
|
+
return t.toString = function() {
|
|
571
|
+
return n.toString();
|
|
572
|
+
}, t;
|
|
573
|
+
}(function(n, t, e) {
|
|
574
|
+
return {
|
|
575
|
+
type: "link",
|
|
576
|
+
content: [{
|
|
577
|
+
type: "text",
|
|
578
|
+
content: n[1]
|
|
579
|
+
}],
|
|
580
|
+
target: n[1]
|
|
581
|
+
};
|
|
582
|
+
}),
|
|
583
|
+
react: null,
|
|
584
|
+
html: null
|
|
585
|
+
},
|
|
586
|
+
mailto: {
|
|
587
|
+
order: m++,
|
|
588
|
+
match: _(/^<([^ >]+@[^ >]+)>/),
|
|
589
|
+
parse: function(n) {
|
|
590
|
+
function t(e, r, a) {
|
|
591
|
+
return n.apply(this, arguments);
|
|
592
|
+
}
|
|
593
|
+
return t.toString = function() {
|
|
594
|
+
return n.toString();
|
|
595
|
+
}, t;
|
|
596
|
+
}(function(n, t, e) {
|
|
597
|
+
var r = n[1], a = n[1];
|
|
598
|
+
return _t.test(a) || (a = "mailto:" + a), {
|
|
599
|
+
type: "link",
|
|
600
|
+
content: [{
|
|
601
|
+
type: "text",
|
|
602
|
+
content: r
|
|
603
|
+
}],
|
|
604
|
+
target: a
|
|
605
|
+
};
|
|
606
|
+
}),
|
|
607
|
+
react: null,
|
|
608
|
+
html: null
|
|
609
|
+
},
|
|
610
|
+
url: {
|
|
611
|
+
order: m++,
|
|
612
|
+
match: _(/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/),
|
|
613
|
+
parse: function(n) {
|
|
614
|
+
function t(e, r, a) {
|
|
615
|
+
return n.apply(this, arguments);
|
|
616
|
+
}
|
|
617
|
+
return t.toString = function() {
|
|
618
|
+
return n.toString();
|
|
619
|
+
}, t;
|
|
620
|
+
}(function(n, t, e) {
|
|
621
|
+
return {
|
|
622
|
+
type: "link",
|
|
623
|
+
content: [{
|
|
624
|
+
type: "text",
|
|
625
|
+
content: n[1]
|
|
626
|
+
}],
|
|
627
|
+
target: n[1],
|
|
628
|
+
title: void 0
|
|
629
|
+
};
|
|
630
|
+
}),
|
|
631
|
+
react: null,
|
|
632
|
+
html: null
|
|
633
|
+
},
|
|
634
|
+
link: {
|
|
635
|
+
order: m++,
|
|
636
|
+
match: _(new RegExp("^\\[(" + C + ")\\]\\(" + G + "\\)")),
|
|
637
|
+
parse: function(n) {
|
|
638
|
+
function t(e, r, a) {
|
|
639
|
+
return n.apply(this, arguments);
|
|
640
|
+
}
|
|
641
|
+
return t.toString = function() {
|
|
642
|
+
return n.toString();
|
|
643
|
+
}, t;
|
|
644
|
+
}(function(n, t, e) {
|
|
645
|
+
var r = {
|
|
646
|
+
content: t(n[1], e),
|
|
647
|
+
target: M(n[2]),
|
|
648
|
+
title: n[3]
|
|
649
|
+
};
|
|
650
|
+
return r;
|
|
651
|
+
}),
|
|
652
|
+
react: function(t, e, r) {
|
|
653
|
+
return v("a", r.key, {
|
|
654
|
+
href: I(t.target),
|
|
655
|
+
title: t.title,
|
|
656
|
+
children: e(t.content, r)
|
|
657
|
+
});
|
|
658
|
+
},
|
|
659
|
+
html: function(t, e, r) {
|
|
660
|
+
var a = {
|
|
661
|
+
href: I(t.target),
|
|
662
|
+
title: t.title
|
|
663
|
+
};
|
|
664
|
+
return d("a", e(t.content, r), a);
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
image: {
|
|
668
|
+
order: m++,
|
|
669
|
+
match: _(new RegExp("^!\\[(" + C + ")\\]\\(" + G + "\\)")),
|
|
670
|
+
parse: function(n) {
|
|
671
|
+
function t(e, r, a) {
|
|
672
|
+
return n.apply(this, arguments);
|
|
673
|
+
}
|
|
674
|
+
return t.toString = function() {
|
|
675
|
+
return n.toString();
|
|
676
|
+
}, t;
|
|
677
|
+
}(function(n, t, e) {
|
|
678
|
+
var r = {
|
|
679
|
+
alt: n[1],
|
|
680
|
+
target: M(n[2]),
|
|
681
|
+
title: n[3]
|
|
682
|
+
};
|
|
683
|
+
return r;
|
|
684
|
+
}),
|
|
685
|
+
react: function(t, e, r) {
|
|
686
|
+
return v("img", r.key, {
|
|
687
|
+
src: I(t.target),
|
|
688
|
+
alt: t.alt,
|
|
689
|
+
title: t.title
|
|
690
|
+
});
|
|
691
|
+
},
|
|
692
|
+
html: function(t, e, r) {
|
|
693
|
+
var a = {
|
|
694
|
+
src: I(t.target),
|
|
695
|
+
alt: t.alt,
|
|
696
|
+
title: t.title
|
|
697
|
+
};
|
|
698
|
+
return d("img", "", a, !1);
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
reflink: {
|
|
702
|
+
order: m++,
|
|
703
|
+
match: _(new RegExp(
|
|
704
|
+
"^\\[(" + C + ")\\]\\s*\\[([^\\]]*)\\]"
|
|
705
|
+
)),
|
|
706
|
+
parse: function(n) {
|
|
707
|
+
function t(e, r, a) {
|
|
708
|
+
return n.apply(this, arguments);
|
|
709
|
+
}
|
|
710
|
+
return t.toString = function() {
|
|
711
|
+
return n.toString();
|
|
712
|
+
}, t;
|
|
713
|
+
}(function(n, t, e) {
|
|
714
|
+
return X(n, e, {
|
|
715
|
+
type: "link",
|
|
716
|
+
content: t(n[1], e)
|
|
717
|
+
});
|
|
718
|
+
}),
|
|
719
|
+
react: null,
|
|
720
|
+
html: null
|
|
721
|
+
},
|
|
722
|
+
refimage: {
|
|
723
|
+
order: m++,
|
|
724
|
+
match: _(new RegExp(
|
|
725
|
+
"^!\\[(" + C + ")\\]\\s*\\[([^\\]]*)\\]"
|
|
726
|
+
)),
|
|
727
|
+
parse: function(n) {
|
|
728
|
+
function t(e, r, a) {
|
|
729
|
+
return n.apply(this, arguments);
|
|
730
|
+
}
|
|
731
|
+
return t.toString = function() {
|
|
732
|
+
return n.toString();
|
|
733
|
+
}, t;
|
|
734
|
+
}(function(n, t, e) {
|
|
735
|
+
return X(n, e, {
|
|
736
|
+
type: "image",
|
|
737
|
+
alt: n[1]
|
|
738
|
+
});
|
|
739
|
+
}),
|
|
740
|
+
react: null,
|
|
741
|
+
html: null
|
|
742
|
+
},
|
|
743
|
+
em: {
|
|
744
|
+
order: m,
|
|
745
|
+
match: _(new RegExp(
|
|
746
|
+
"^\\b_((?:__|\\\\[\\s\\S]|[^\\\\_])+?)_\\b|^\\*(?=\\S)((?:\\*\\*|\\\\[\\s\\S]|\\s+(?:\\\\[\\s\\S]|[^\\s\\*\\\\]|\\*\\*)|[^\\s\\*\\\\])+?)\\*(?!\\*)"
|
|
747
|
+
)),
|
|
748
|
+
quality: function(t) {
|
|
749
|
+
return t[0].length + 0.2;
|
|
750
|
+
},
|
|
751
|
+
parse: function(n) {
|
|
752
|
+
function t(e, r, a) {
|
|
753
|
+
return n.apply(this, arguments);
|
|
754
|
+
}
|
|
755
|
+
return t.toString = function() {
|
|
756
|
+
return n.toString();
|
|
757
|
+
}, t;
|
|
758
|
+
}(function(n, t, e) {
|
|
759
|
+
return {
|
|
760
|
+
content: t(n[2] || n[1], e)
|
|
761
|
+
};
|
|
762
|
+
}),
|
|
763
|
+
react: function(t, e, r) {
|
|
764
|
+
return v("em", r.key, {
|
|
765
|
+
children: e(t.content, r)
|
|
766
|
+
});
|
|
767
|
+
},
|
|
768
|
+
html: function(t, e, r) {
|
|
769
|
+
return d("em", e(t.content, r));
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
strong: {
|
|
773
|
+
order: m,
|
|
774
|
+
match: _(/^\*\*((?:\\[\s\S]|[^\\])+?)\*\*(?!\*)/),
|
|
775
|
+
quality: function(t) {
|
|
776
|
+
return t[0].length + 0.1;
|
|
777
|
+
},
|
|
778
|
+
parse: O,
|
|
779
|
+
react: function(t, e, r) {
|
|
780
|
+
return v("strong", r.key, {
|
|
781
|
+
children: e(t.content, r)
|
|
782
|
+
});
|
|
783
|
+
},
|
|
784
|
+
html: function(t, e, r) {
|
|
785
|
+
return d("strong", e(t.content, r));
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
u: {
|
|
789
|
+
order: m++,
|
|
790
|
+
match: _(/^__((?:\\[\s\S]|[^\\])+?)__(?!_)/),
|
|
791
|
+
quality: function(t) {
|
|
792
|
+
return t[0].length;
|
|
793
|
+
},
|
|
794
|
+
parse: O,
|
|
795
|
+
react: function(t, e, r) {
|
|
796
|
+
return v("u", r.key, {
|
|
797
|
+
children: e(t.content, r)
|
|
798
|
+
});
|
|
799
|
+
},
|
|
800
|
+
html: function(t, e, r) {
|
|
801
|
+
return d("u", e(t.content, r));
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
del: {
|
|
805
|
+
order: m++,
|
|
806
|
+
match: _(/^~~(?=\S)((?:\\[\s\S]|~(?!~)|[^\s~\\]|\s(?!~~))+?)~~/),
|
|
807
|
+
parse: O,
|
|
808
|
+
react: function(t, e, r) {
|
|
809
|
+
return v("del", r.key, {
|
|
810
|
+
children: e(t.content, r)
|
|
811
|
+
});
|
|
812
|
+
},
|
|
813
|
+
html: function(t, e, r) {
|
|
814
|
+
return d("del", e(t.content, r));
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
inlineCode: {
|
|
818
|
+
order: m++,
|
|
819
|
+
match: _(/^(`+)([\s\S]*?[^`])\1(?!`)/),
|
|
820
|
+
parse: function(n) {
|
|
821
|
+
function t(e, r, a) {
|
|
822
|
+
return n.apply(this, arguments);
|
|
823
|
+
}
|
|
824
|
+
return t.toString = function() {
|
|
825
|
+
return n.toString();
|
|
826
|
+
}, t;
|
|
827
|
+
}(function(n, t, e) {
|
|
828
|
+
return {
|
|
829
|
+
content: n[2].replace(vt, "$1")
|
|
830
|
+
};
|
|
831
|
+
}),
|
|
832
|
+
react: function(t, e, r) {
|
|
833
|
+
return v("code", r.key, {
|
|
834
|
+
children: t.content
|
|
835
|
+
});
|
|
836
|
+
},
|
|
837
|
+
html: function(t, e, r) {
|
|
838
|
+
return d("code", R(t.content));
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
br: {
|
|
842
|
+
order: m++,
|
|
843
|
+
match: j(/^ {2,}\n/),
|
|
844
|
+
parse: F,
|
|
845
|
+
react: function(t, e, r) {
|
|
846
|
+
return v("br", r.key, U);
|
|
847
|
+
},
|
|
848
|
+
html: function(t, e, r) {
|
|
849
|
+
return "<br>";
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
text: {
|
|
853
|
+
order: m++,
|
|
854
|
+
match: j(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|$)/),
|
|
855
|
+
parse: function(n) {
|
|
856
|
+
function t(e, r, a) {
|
|
857
|
+
return n.apply(this, arguments);
|
|
858
|
+
}
|
|
859
|
+
return t.toString = function() {
|
|
860
|
+
return n.toString();
|
|
861
|
+
}, t;
|
|
862
|
+
}(function(n, t, e) {
|
|
863
|
+
return {
|
|
864
|
+
content: n[0]
|
|
865
|
+
};
|
|
866
|
+
}),
|
|
867
|
+
react: function(t, e, r) {
|
|
868
|
+
return t.content;
|
|
869
|
+
},
|
|
870
|
+
html: function(t, e, r) {
|
|
871
|
+
return R(t.content);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}, St = function(t, e) {
|
|
875
|
+
!e && typeof console != "undefined" && console.warn("simple-markdown ruleOutput should take 'react' or 'html' as the second argument.");
|
|
876
|
+
var r = function(l, o, i) {
|
|
877
|
+
return t[l.type][e](l, o, i);
|
|
878
|
+
};
|
|
879
|
+
return r;
|
|
880
|
+
}, Tt = function(t) {
|
|
881
|
+
var e = function r(a, l) {
|
|
882
|
+
if (l = l || {}, Array.isArray(a)) {
|
|
883
|
+
for (var o = l.key, i = [], u = null, c = 0; c < a.length; c++) {
|
|
884
|
+
l.key = "" + c;
|
|
885
|
+
var f = r(a[c], l);
|
|
886
|
+
typeof f == "string" && typeof u == "string" ? (u = u + f, i[i.length - 1] = u) : (i.push(f), u = f);
|
|
887
|
+
}
|
|
888
|
+
return l.key = o, i;
|
|
889
|
+
} else
|
|
890
|
+
return t(a, r, l);
|
|
891
|
+
};
|
|
892
|
+
return e;
|
|
893
|
+
}, Et = function(t) {
|
|
894
|
+
var e = function r(a, l) {
|
|
895
|
+
return l = l || {}, Array.isArray(a) ? a.map(function(o) {
|
|
896
|
+
return r(o, l);
|
|
897
|
+
}).join("") : t(a, r, l);
|
|
898
|
+
};
|
|
899
|
+
return e;
|
|
900
|
+
}, H = function(t, e) {
|
|
901
|
+
var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
902
|
+
if (!e)
|
|
903
|
+
throw new Error("simple-markdown: outputFor: `property` must be defined. if you just upgraded, you probably need to replace `outputFor` with `reactFor`");
|
|
904
|
+
var a, l = t.Array || L.Array, o = l[e];
|
|
905
|
+
if (!o)
|
|
906
|
+
throw new Error("simple-markdown: outputFor: to join nodes of type `" + e + "` you must provide an `Array:` joiner rule with that type, Please see the docs for details on specifying an Array rule.");
|
|
907
|
+
var i = o, u = function f(s, p) {
|
|
908
|
+
return p = p || a, a = p, Array.isArray(s) ? i(s, f, p) : t[s.type][e](s, f, p);
|
|
909
|
+
}, c = function(s, p) {
|
|
910
|
+
return a = Q(p, r), u(s, a);
|
|
911
|
+
};
|
|
912
|
+
return c;
|
|
913
|
+
}, $ = V(L), D = function(t, e) {
|
|
914
|
+
return e = e || {}, e.inline = !1, $(t, e);
|
|
915
|
+
}, bt = function(t, e) {
|
|
916
|
+
return e = e || {}, e.inline = !0, $(t, e);
|
|
917
|
+
}, W = function(t, e) {
|
|
918
|
+
var r = et.test(t);
|
|
919
|
+
return e = e || {}, e.inline = !r, $(t, e);
|
|
920
|
+
}, q = H(L, "react"), nt = H(L, "html"), rt = function(t, e) {
|
|
921
|
+
return q(D(t, e), e);
|
|
922
|
+
}, wt = function(t, e) {
|
|
923
|
+
return nt(D(t, e), e);
|
|
924
|
+
}, kt = function(t) {
|
|
925
|
+
var e = {};
|
|
926
|
+
for (var r in t)
|
|
927
|
+
r !== "source" && Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
|
|
928
|
+
return e.children = rt(t.source), v("div", null, e);
|
|
929
|
+
}, at = {
|
|
930
|
+
defaultRules: L,
|
|
931
|
+
parserFor: V,
|
|
932
|
+
outputFor: H,
|
|
933
|
+
inlineRegex: _,
|
|
934
|
+
blockRegex: T,
|
|
935
|
+
anyScopeRegex: j,
|
|
936
|
+
parseInline: B,
|
|
937
|
+
parseBlock: mt,
|
|
938
|
+
markdownToReact: rt,
|
|
939
|
+
markdownToHtml: wt,
|
|
940
|
+
ReactMarkdown: kt,
|
|
941
|
+
defaultBlockParse: D,
|
|
942
|
+
defaultInlineParse: bt,
|
|
943
|
+
defaultImplicitParse: W,
|
|
944
|
+
defaultReactOutput: q,
|
|
945
|
+
defaultHtmlOutput: nt,
|
|
946
|
+
preprocess: J,
|
|
947
|
+
sanitizeText: R,
|
|
948
|
+
sanitizeUrl: I,
|
|
949
|
+
unescapeUrl: M,
|
|
950
|
+
htmlTag: d,
|
|
951
|
+
reactElement: v,
|
|
952
|
+
defaultRawParse: $,
|
|
953
|
+
ruleOutput: St,
|
|
954
|
+
reactFor: Tt,
|
|
955
|
+
htmlFor: Et,
|
|
956
|
+
defaultParse: function() {
|
|
957
|
+
return typeof console != "undefined" && console.warn("defaultParse is deprecated, please use `defaultImplicitParse`"), W.apply(null, arguments);
|
|
958
|
+
},
|
|
959
|
+
defaultOutput: function() {
|
|
960
|
+
return typeof console != "undefined" && console.warn("defaultOutput is deprecated, please use `defaultReactOutput`"), q.apply(null, arguments);
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
function Rt(n) {
|
|
964
|
+
return n.replace(/\n{2,}/g, `
|
|
965
|
+
`).replace(/^\s+/gm, "");
|
|
966
|
+
}
|
|
967
|
+
function It(n) {
|
|
968
|
+
const t = Rt(n), e = at.defaultBlockParse, r = e(t);
|
|
969
|
+
let a = [[]], l = 0;
|
|
970
|
+
function o(i, u) {
|
|
971
|
+
i.type === "text" ? i.content.split(`
|
|
972
|
+
`).forEach((f, s) => {
|
|
973
|
+
s !== 0 && (l++, a.push([])), f.split(" ").forEach((p) => {
|
|
974
|
+
p && a[l].push({ content: p, type: u || "normal" });
|
|
975
|
+
});
|
|
976
|
+
}) : (i.type === "strong" || i.type === "em") && i.content.forEach((c) => {
|
|
977
|
+
o(c, i.type);
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
return r.forEach((i) => {
|
|
981
|
+
i.type === "paragraph" && i.content.forEach((u) => {
|
|
982
|
+
o(u);
|
|
983
|
+
});
|
|
984
|
+
}), a;
|
|
985
|
+
}
|
|
986
|
+
function Lt(n) {
|
|
987
|
+
const t = at.defaultBlockParse, e = t(n);
|
|
988
|
+
function r(a) {
|
|
989
|
+
return a.type === "text" ? a.content.replace(/\n/g, "<br/>") : a.type === "strong" ? `<strong>${a.content.map(r).join("")}</strong>` : a.type === "em" ? `<em>${a.content.map(r).join("")}</em>` : a.type === "paragraph" ? `<p>${a.content.map(r).join("")}</p>` : "";
|
|
990
|
+
}
|
|
991
|
+
return e.map(r).join("");
|
|
992
|
+
}
|
|
993
|
+
function At(n, t) {
|
|
994
|
+
t && n.attr("style", t);
|
|
995
|
+
}
|
|
996
|
+
function Ot(n, t, e, r) {
|
|
997
|
+
const a = n.append("foreignObject"), l = a.append("xhtml:div"), o = t.label, i = t.isNode ? "nodeLabel" : "edgeLabel";
|
|
998
|
+
l.html(
|
|
999
|
+
`<span class="${i} ${r}" ` + (t.labelStyle ? 'style="' + t.labelStyle + '"' : "") + ">" + o + "</span>"
|
|
1000
|
+
), At(l, t.labelStyle), l.style("display", "table-cell"), l.style("white-space", "nowrap"), l.style("max-width", e + "px"), l.attr("xmlns", "http://www.w3.org/1999/xhtml");
|
|
1001
|
+
let u = l.node().getBoundingClientRect();
|
|
1002
|
+
return u.width === e && (l.style("display", "table"), l.style("white-space", "break-spaces"), l.style("width", e + "px"), u = l.node().getBoundingClientRect()), a.style("width", u.width), a.style("height", u.height), a.node();
|
|
1003
|
+
}
|
|
1004
|
+
function Z(n, t, e) {
|
|
1005
|
+
return n.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", t * e - 0.1 + "em").attr("dy", e + "em");
|
|
1006
|
+
}
|
|
1007
|
+
function Pt(n, t, e, r = !1) {
|
|
1008
|
+
const l = t.append("g");
|
|
1009
|
+
let o = l.insert("rect").attr("class", "background");
|
|
1010
|
+
const i = l.append("text").attr("y", "-10.1");
|
|
1011
|
+
let u = -1;
|
|
1012
|
+
if (e.forEach((c) => {
|
|
1013
|
+
u++;
|
|
1014
|
+
let f = Z(i, u, 1.1), s = [...c].reverse(), p, h = [];
|
|
1015
|
+
for (; s.length; )
|
|
1016
|
+
p = s.pop(), h.push(p), Y(f, h), f.node().getComputedTextLength() > n && (h.pop(), s.push(p), Y(f, h), h = [], u++, f = Z(i, u, 1.1));
|
|
1017
|
+
}), r) {
|
|
1018
|
+
const c = i.node().getBBox(), f = 2;
|
|
1019
|
+
return o.attr("x", -f).attr("y", -f).attr("width", c.width + 2 * f).attr("height", c.height + 2 * f), l.node();
|
|
1020
|
+
} else
|
|
1021
|
+
return i.node();
|
|
1022
|
+
}
|
|
1023
|
+
function Y(n, t) {
|
|
1024
|
+
n.text(""), t.forEach((e, r) => {
|
|
1025
|
+
const a = n.append("tspan").attr("font-style", e.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", e.type === "strong" ? "bold" : "normal");
|
|
1026
|
+
r === 0 ? a.text(e.content) : a.text(" " + e.content);
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
const Bt = (n, t = "", {
|
|
1030
|
+
style: e = "",
|
|
1031
|
+
isTitle: r = !1,
|
|
1032
|
+
classes: a = "",
|
|
1033
|
+
useHtmlLabels: l = !0,
|
|
1034
|
+
isNode: o = !0,
|
|
1035
|
+
width: i,
|
|
1036
|
+
addSvgBackground: u = !1
|
|
1037
|
+
} = {}) => {
|
|
1038
|
+
if (lt.info("createText", t, e, r, a, l, o, u), l) {
|
|
1039
|
+
const c = Lt(t), f = {
|
|
1040
|
+
isNode: o,
|
|
1041
|
+
label: ut(c).replace(
|
|
1042
|
+
/fa[blrs]?:fa-[\w-]+/g,
|
|
1043
|
+
(p) => `<i class='${p.replace(":", " ")}'></i>`
|
|
1044
|
+
),
|
|
1045
|
+
labelStyle: e.replace("fill:", "color:")
|
|
1046
|
+
};
|
|
1047
|
+
return Ot(n, f, i, a);
|
|
1048
|
+
} else {
|
|
1049
|
+
const c = It(t), f = ['"', "'", ".", ",", ":", ";", "!", "?", "(", ")", "[", "]", "{", "}"];
|
|
1050
|
+
let s;
|
|
1051
|
+
return c.forEach((h) => {
|
|
1052
|
+
h.forEach((g) => {
|
|
1053
|
+
f.includes(g.content) && s && (s.content += g.content, g.content = ""), s = g;
|
|
1054
|
+
});
|
|
1055
|
+
}), Pt(i, n, c, u);
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
export {
|
|
1059
|
+
Bt as c
|
|
1060
|
+
};
|