flowchart-sequence-designer 1.2.1 → 1.2.2
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 +27 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -15
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +29 -17
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +29 -17
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -528,7 +528,7 @@ function nextId(prefix, existing) {
|
|
|
528
528
|
let max = 0;
|
|
529
529
|
for (const item of existing) {
|
|
530
530
|
const match = re.exec(item.id);
|
|
531
|
-
if (match) {
|
|
531
|
+
if (match?.[1]) {
|
|
532
532
|
const n = parseInt(match[1], 10);
|
|
533
533
|
if (n > max) max = n;
|
|
534
534
|
}
|
|
@@ -1352,7 +1352,7 @@ function estimateW(text, pxPerChar = 7) {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
function SequenceCanvas(props) {
|
|
1354
1354
|
const {
|
|
1355
|
-
model,
|
|
1355
|
+
model: _model,
|
|
1356
1356
|
actors,
|
|
1357
1357
|
messages,
|
|
1358
1358
|
t,
|
|
@@ -1956,9 +1956,15 @@ function escapeXML(s2) {
|
|
|
1956
1956
|
}
|
|
1957
1957
|
function sanitizeForSVG(s2) {
|
|
1958
1958
|
let clean = s2;
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1959
|
+
while (/<[a-zA-Z/][^>]{0,500}>/g.test(clean)) {
|
|
1960
|
+
clean = clean.replace(/<[a-zA-Z/][^>]{0,500}>/g, "");
|
|
1961
|
+
}
|
|
1962
|
+
while (/\b(?:javascript|data|vbscript)\s*:/gi.test(clean)) {
|
|
1963
|
+
clean = clean.replace(/\b(?:javascript|data|vbscript)\s*:/gi, "");
|
|
1964
|
+
}
|
|
1965
|
+
while (/\bon[a-z]+\s*=/gi.test(clean)) {
|
|
1966
|
+
clean = clean.replace(/\bon[a-z]+\s*=/gi, "");
|
|
1967
|
+
}
|
|
1962
1968
|
clean = clean.replace(/\x00/g, "");
|
|
1963
1969
|
return escapeXML(clean);
|
|
1964
1970
|
}
|
|
@@ -2378,9 +2384,15 @@ var MAX_IMPORT_LENGTH = 2 * 1024 * 1024;
|
|
|
2378
2384
|
function sanitizeLabel(raw) {
|
|
2379
2385
|
let s2 = raw;
|
|
2380
2386
|
s2 = s2.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "");
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2387
|
+
while (/<[a-zA-Z/][^>]{0,500}>/g.test(s2)) {
|
|
2388
|
+
s2 = s2.replace(/<[a-zA-Z/][^>]{0,500}>/g, "");
|
|
2389
|
+
}
|
|
2390
|
+
while (/\b(?:javascript|data|vbscript)\s*:/gi.test(s2)) {
|
|
2391
|
+
s2 = s2.replace(/\b(?:javascript|data|vbscript)\s*:/gi, "");
|
|
2392
|
+
}
|
|
2393
|
+
while (/\bon[a-z]+\s*=/gi.test(s2)) {
|
|
2394
|
+
s2 = s2.replace(/\bon[a-z]+\s*=/gi, "");
|
|
2395
|
+
}
|
|
2384
2396
|
if (s2.length > MAX_LABEL_LENGTH) {
|
|
2385
2397
|
s2 = s2.slice(0, MAX_LABEL_LENGTH);
|
|
2386
2398
|
}
|
|
@@ -2390,11 +2402,11 @@ function sanitizeLabel(raw) {
|
|
|
2390
2402
|
// src/importers/mermaid.ts
|
|
2391
2403
|
function parseNodeDecl(raw) {
|
|
2392
2404
|
const patterns = [
|
|
2393
|
-
[/^(\w+)\{\{?"?(
|
|
2394
|
-
[/^(\w+)\(\("?(
|
|
2395
|
-
[/^(\w+)\[\/(
|
|
2396
|
-
[/^(\w+)\[["']?(
|
|
2397
|
-
[/^(\w+)\("?(
|
|
2405
|
+
[/^(\w+)\{\{?"?([^}"]+)"?\}?\}$/, "diamond"],
|
|
2406
|
+
[/^(\w+)\(\("?([^)"]+)"?\)\)$/, "circle"],
|
|
2407
|
+
[/^(\w+)\[\/([^/\]]+)\/\]$/, "parallelogram"],
|
|
2408
|
+
[/^(\w+)\[["']?([^\]"']+)["']?\]$/, "rectangle"],
|
|
2409
|
+
[/^(\w+)\("?([^)"]+)"?\)$/, "rectangle"]
|
|
2398
2410
|
];
|
|
2399
2411
|
for (const [re, shape] of patterns) {
|
|
2400
2412
|
const m = raw.match(re);
|
|
@@ -2402,7 +2414,7 @@ function parseNodeDecl(raw) {
|
|
|
2402
2414
|
}
|
|
2403
2415
|
return null;
|
|
2404
2416
|
}
|
|
2405
|
-
var EDGE_RE = /^(
|
|
2417
|
+
var EDGE_RE = /^(\S+)\s*(-\.->|-\.-|-->|---)(?:\|([^|]+)\|)?\s*(.+)$/;
|
|
2406
2418
|
function detectStyle(connector) {
|
|
2407
2419
|
return connector.startsWith("-.") ? "dashed" : "solid";
|
|
2408
2420
|
}
|
|
@@ -2520,7 +2532,7 @@ function parseSequence(lines, title) {
|
|
|
2520
2532
|
safeAddActor(actorMatch[1].trim());
|
|
2521
2533
|
continue;
|
|
2522
2534
|
}
|
|
2523
|
-
const msgMatch = trimmed.match(/^(
|
|
2535
|
+
const msgMatch = trimmed.match(/^(\w+)\s*(-->>|->>|-->|->)\s*(\w+):\s*(.+)$/);
|
|
2524
2536
|
if (msgMatch) {
|
|
2525
2537
|
const from = safeAddActor(msgMatch[1].trim());
|
|
2526
2538
|
const arrow = msgMatch[2];
|
|
@@ -2545,7 +2557,7 @@ function fromMermaid(mermaid) {
|
|
|
2545
2557
|
if (mermaid.length > MAX_IMPORT_LENGTH) {
|
|
2546
2558
|
throw new Error(`Import aborted: input exceeds the maximum of ${MAX_IMPORT_LENGTH} characters`);
|
|
2547
2559
|
}
|
|
2548
|
-
const cleaned = mermaid.replace(/mermaid\.initialize\([
|
|
2560
|
+
const cleaned = mermaid.replace(/mermaid\.initialize\([^)]*\)\s*;?/g, "");
|
|
2549
2561
|
const rawLines = cleaned.split("\n");
|
|
2550
2562
|
let startIdx = 0;
|
|
2551
2563
|
let title;
|
|
@@ -4775,7 +4787,7 @@ function DiagramCanvas(props) {
|
|
|
4775
4787
|
acc,
|
|
4776
4788
|
transform,
|
|
4777
4789
|
setTransform,
|
|
4778
|
-
selected,
|
|
4790
|
+
selected: _selected,
|
|
4779
4791
|
selectedSet,
|
|
4780
4792
|
hoveredId,
|
|
4781
4793
|
setHoveredId,
|