Compare commits

..

1 Commits

Author SHA1 Message Date
renovate[bot]
a1ecc6f677 fix(deps): update dependency dompurify to ^3.2.7 2025-10-17 03:10:05 +00:00
4 changed files with 16 additions and 174 deletions

View File

@@ -78,7 +78,7 @@
"d3-sankey": "^0.12.3",
"dagre-d3-es": "7.0.11",
"dayjs": "^1.11.18",
"dompurify": "^3.2.5",
"dompurify": "^3.2.7",
"katex": "^0.16.22",
"khroma": "^2.1.0",
"lodash-es": "^4.17.21",

View File

@@ -266,156 +266,4 @@ describe('[Arrows] when parsing', () => {
});
});
});
describe('Issue #2492: Node names starting with o/x should not be consumed by arrow markers', () => {
it('should handle node names starting with "o" after plain arrows', function () {
const res = flow.parser.parse('graph TD;\ndev---ops;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('dev').id).toBe('dev');
expect(vert.get('ops').id).toBe('ops');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('dev');
expect(edges[0].end).toBe('ops');
expect(edges[0].type).toBe('arrow_open');
expect(edges[0].stroke).toBe('normal');
});
it('should handle node names starting with "x" after plain arrows', function () {
const res = flow.parser.parse('graph TD;\ndev---xerxes;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('dev').id).toBe('dev');
expect(vert.get('xerxes').id).toBe('xerxes');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('dev');
expect(edges[0].end).toBe('xerxes');
expect(edges[0].type).toBe('arrow_open');
expect(edges[0].stroke).toBe('normal');
});
it('should still support circle arrows with spaces', function () {
const res = flow.parser.parse('graph TD;\nA --o B;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('A').id).toBe('A');
expect(vert.get('B').id).toBe('B');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('A');
expect(edges[0].end).toBe('B');
expect(edges[0].type).toBe('arrow_circle');
expect(edges[0].stroke).toBe('normal');
});
it('should still support cross arrows with spaces', function () {
const res = flow.parser.parse('graph TD;\nC --x D;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('C').id).toBe('C');
expect(vert.get('D').id).toBe('D');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('C');
expect(edges[0].end).toBe('D');
expect(edges[0].type).toBe('arrow_cross');
expect(edges[0].stroke).toBe('normal');
});
it('should support circle arrows to uppercase nodes without spaces', function () {
const res = flow.parser.parse('graph TD;\nA--oB;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('A').id).toBe('A');
expect(vert.get('B').id).toBe('B');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('A');
expect(edges[0].end).toBe('B');
expect(edges[0].type).toBe('arrow_circle');
expect(edges[0].stroke).toBe('normal');
});
it('should support cross arrows to uppercase nodes without spaces', function () {
const res = flow.parser.parse('graph TD;\nA--xBar;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('A').id).toBe('A');
expect(vert.get('Bar').id).toBe('Bar');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('A');
expect(edges[0].end).toBe('Bar');
expect(edges[0].type).toBe('arrow_cross');
expect(edges[0].stroke).toBe('normal');
});
it('should handle thick arrows with lowercase node names starting with "o"', function () {
const res = flow.parser.parse('graph TD;\nalpha===omega;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('alpha').id).toBe('alpha');
expect(vert.get('omega').id).toBe('omega');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('alpha');
expect(edges[0].end).toBe('omega');
expect(edges[0].type).toBe('arrow_open');
expect(edges[0].stroke).toBe('thick');
});
it('should handle dotted arrows with lowercase node names starting with "o"', function () {
const res = flow.parser.parse('graph TD;\nfoo-.-opus;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('foo').id).toBe('foo');
expect(vert.get('opus').id).toBe('opus');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('foo');
expect(edges[0].end).toBe('opus');
expect(edges[0].type).toBe('arrow_open');
expect(edges[0].stroke).toBe('dotted');
});
it('should still support dotted circle arrows with spaces', function () {
const res = flow.parser.parse('graph TD;\nB -.-o C;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('B').id).toBe('B');
expect(vert.get('C').id).toBe('C');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('B');
expect(edges[0].end).toBe('C');
expect(edges[0].type).toBe('arrow_circle');
expect(edges[0].stroke).toBe('dotted');
});
it('should still support thick cross arrows with spaces', function () {
const res = flow.parser.parse('graph TD;\nC ==x D;');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert.get('C').id).toBe('C');
expect(vert.get('D').id).toBe('D');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('C');
expect(edges[0].end).toBe('D');
expect(edges[0].type).toBe('arrow_cross');
expect(edges[0].stroke).toBe('thick');
});
});
});

View File

@@ -152,23 +152,17 @@ that id.
"," return 'COMMA';
"*" return 'MULT';
<INITIAL,edgeText>\s*[xo<]?\-\-+[xo>]\s+ { this.popState(); return 'LINK'; }
<INITIAL,edgeText>\s*[xo<]?\-\-+[xo>](?=[A-Z]) { this.popState(); return 'LINK'; }
<INITIAL,edgeText>\s*[xo<]?\-\-+[-]\s* { this.popState(); return 'LINK'; }
<INITIAL>\s*[xo<]?\-\-\s* { this.pushState("edgeText"); return 'START_LINK'; }
<edgeText>[^-]|\-(?!\-)+ return 'EDGE_TEXT';
<INITIAL,edgeText>\s*[xo<]?\-\-+[-xo>]\s* { this.popState(); return 'LINK'; }
<INITIAL>\s*[xo<]?\-\-\s* { this.pushState("edgeText"); return 'START_LINK'; }
<edgeText>[^-]|\-(?!\-)+ return 'EDGE_TEXT';
<INITIAL,thickEdgeText>\s*[xo<]?\=\=+[xo>]\s+ { this.popState(); return 'LINK'; }
<INITIAL,thickEdgeText>\s*[xo<]?\=\=+[xo>](?=[A-Z]) { this.popState(); return 'LINK'; }
<INITIAL,thickEdgeText>\s*[xo<]?\=\=+[=]\s* { this.popState(); return 'LINK'; }
<INITIAL>\s*[xo<]?\=\=\s* { this.pushState("thickEdgeText"); return 'START_LINK'; }
<thickEdgeText>[^=]|\=(?!=) return 'EDGE_TEXT';
<INITIAL,thickEdgeText>\s*[xo<]?\=\=+[=xo>]\s* { this.popState(); return 'LINK'; }
<INITIAL>\s*[xo<]?\=\=\s* { this.pushState("thickEdgeText"); return 'START_LINK'; }
<thickEdgeText>[^=]|\=(?!=) return 'EDGE_TEXT';
<INITIAL,dottedEdgeText>\s*[xo<]?\-?\.+\-[xo>]\s+ { this.popState(); return 'LINK'; }
<INITIAL,dottedEdgeText>\s*[xo<]?\-?\.+\-[xo>](?=[A-Z]) { this.popState(); return 'LINK'; }
<INITIAL,dottedEdgeText>\s*[xo<]?\-?\.+\-\s* { this.popState(); return 'LINK'; }
<INITIAL>\s*[xo<]?\-\.\s* { this.pushState("dottedEdgeText"); return 'START_LINK'; }
<dottedEdgeText>[^\.]|\.(?!-) return 'EDGE_TEXT';
<INITIAL,dottedEdgeText>\s*[xo<]?\-?\.+\-[xo>]?\s* { this.popState(); return 'LINK'; }
<INITIAL>\s*[xo<]?\-\.\s* { this.pushState("dottedEdgeText"); return 'START_LINK'; }
<dottedEdgeText>[^\.]|\.(?!-) return 'EDGE_TEXT';
<*>\s*\~\~[\~]+\s* return 'LINK';

12
pnpm-lock.yaml generated
View File

@@ -257,8 +257,8 @@ importers:
specifier: ^1.11.18
version: 1.11.18
dompurify:
specifier: ^3.2.5
version: 3.2.6
specifier: ^3.2.7
version: 3.3.0
katex:
specifier: ^0.16.22
version: 0.16.22
@@ -5166,8 +5166,8 @@ packages:
resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
engines: {node: '>= 4'}
dompurify@3.2.6:
resolution: {integrity: sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==}
dompurify@3.3.0:
resolution: {integrity: sha512-r+f6MYR1gGN1eJv0TVQbhA7if/U7P87cdPl3HN5rikqaBSBxLiCb/b9O+2eG0cxz0ghyU+mU1QkbsOwERMYlWQ==}
domutils@3.2.2:
resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
@@ -13803,7 +13803,7 @@ snapshots:
class-variance-authority: 0.7.1
clsx: 2.1.1
color-string: 2.1.2
dompurify: 3.2.6
dompurify: 3.3.0
highlight.js: 10.7.3
html-to-image: 1.11.13
immer: 10.1.3
@@ -15416,7 +15416,7 @@ snapshots:
dependencies:
domelementtype: 2.3.0
dompurify@3.2.6:
dompurify@3.3.0:
optionalDependencies:
'@types/trusted-types': 2.0.7