mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-21 09:16:41 +02:00
Compare commits
1 Commits
@mermaid-j
...
sidv/useUn
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f85f4bb661 |
@@ -69,6 +69,7 @@
|
|||||||
"unicorn/no-abusive-eslint-disable": "error",
|
"unicorn/no-abusive-eslint-disable": "error",
|
||||||
"unicorn/no-array-push-push": "error",
|
"unicorn/no-array-push-push": "error",
|
||||||
"unicorn/no-for-loop": "error",
|
"unicorn/no-for-loop": "error",
|
||||||
|
"unicorn/no-null": "error",
|
||||||
"unicorn/no-instanceof-array": "error",
|
"unicorn/no-instanceof-array": "error",
|
||||||
"unicorn/no-typeof-undefined": "error",
|
"unicorn/no-typeof-undefined": "error",
|
||||||
"unicorn/no-unnecessary-await": "error",
|
"unicorn/no-unnecessary-await": "error",
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const warning = () => null;
|
const warning = () => undefined;
|
||||||
|
|
||||||
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
||||||
|
|
||||||
|
@@ -17,11 +17,11 @@ const getParent = function (level) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No parent found
|
// No parent found
|
||||||
return null;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMindmap = () => {
|
export const getMindmap = () => {
|
||||||
return nodes.length > 0 ? nodes[0] : null;
|
return nodes.length > 0 ? nodes[0] : undefined;
|
||||||
};
|
};
|
||||||
export const addNode = (level, id, descr, type) => {
|
export const addNode = (level, id, descr, type) => {
|
||||||
log.info('addNode', level, id, descr, type);
|
log.info('addNode', level, id, descr, type);
|
||||||
|
@@ -19,7 +19,7 @@ function wrap(text, width) {
|
|||||||
y = text.attr('y'),
|
y = text.attr('y'),
|
||||||
dy = parseFloat(text.attr('dy')),
|
dy = parseFloat(text.attr('dy')),
|
||||||
tspan = text
|
tspan = text
|
||||||
.text(null)
|
.text(undefined)
|
||||||
.append('tspan')
|
.append('tspan')
|
||||||
.attr('x', 0)
|
.attr('x', 0)
|
||||||
.attr('y', y)
|
.attr('y', y)
|
||||||
|
@@ -141,12 +141,12 @@ export const addDiagrams = () => {
|
|||||||
parse: () => {
|
parse: () => {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Diagrams beginning with --- are not valid. ' +
|
'Diagrams beginning with --- are not valid. ' +
|
||||||
'If you were trying to use a YAML front-matter, please ensure that ' +
|
'If you were trying to use a YAML front-matter, please ensure that ' +
|
||||||
"you've correctly opened and closed the YAML front-matter with unindented `---` blocks"
|
"you've correctly opened and closed the YAML front-matter with unindented `---` blocks"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
init: () => null, // no op
|
init: () => undefined, // no op
|
||||||
},
|
},
|
||||||
(text) => {
|
(text) => {
|
||||||
return text.toLowerCase().trimStart().startsWith('---');
|
return text.toLowerCase().trimStart().startsWith('---');
|
||||||
|
@@ -12,8 +12,8 @@ let boundarys = [
|
|||||||
alias: 'global',
|
alias: 'global',
|
||||||
label: { text: 'global' },
|
label: { text: 'global' },
|
||||||
type: { text: 'global' },
|
type: { text: 'global' },
|
||||||
tags: null,
|
tags: undefined,
|
||||||
link: null,
|
link: undefined,
|
||||||
parentBoundary: '',
|
parentBoundary: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -728,8 +728,8 @@ export const clear = function () {
|
|||||||
alias: 'global',
|
alias: 'global',
|
||||||
label: { text: 'global' },
|
label: { text: 'global' },
|
||||||
type: { text: 'global' },
|
type: { text: 'global' },
|
||||||
tags: null,
|
tags: undefined,
|
||||||
link: null,
|
link: undefined,
|
||||||
parentBoundary: '',
|
parentBoundary: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@@ -347,7 +347,7 @@ let getIntersectPoint = function (fromNode, endPoint) {
|
|||||||
|
|
||||||
let fromDYX = fromNode.height / fromNode.width;
|
let fromDYX = fromNode.height / fromNode.width;
|
||||||
|
|
||||||
let returnPoint = null;
|
let returnPoint = undefined;
|
||||||
|
|
||||||
if (y1 == y2 && x1 < x2) {
|
if (y1 == y2 && x1 < x2) {
|
||||||
returnPoint = new Point(x1 + fromNode.width, fromCenterY);
|
returnPoint = new Point(x1 + fromNode.width, fromCenterY);
|
||||||
@@ -599,7 +599,7 @@ export const draw = function (_text, id, _version, diagObj) {
|
|||||||
c4ShapeInRow = db.getC4ShapeInRow();
|
c4ShapeInRow = db.getC4ShapeInRow();
|
||||||
c4BoundaryInRow = db.getC4BoundaryInRow();
|
c4BoundaryInRow = db.getC4BoundaryInRow();
|
||||||
|
|
||||||
log.debug(`C:${JSON.stringify(conf, null, 2)}`);
|
log.debug(`C:${JSON.stringify(conf, undefined, 2)}`);
|
||||||
|
|
||||||
const diagram =
|
const diagram =
|
||||||
securityLevel === 'sandbox' ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
|
securityLevel === 'sandbox' ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
|
||||||
|
@@ -176,7 +176,7 @@ const checkTaskDates = function (task, dateFormat, excludes, includes) {
|
|||||||
|
|
||||||
const fixTaskDates = function (startTime, endTime, dateFormat, excludes, includes) {
|
const fixTaskDates = function (startTime, endTime, dateFormat, excludes, includes) {
|
||||||
let invalid = false;
|
let invalid = false;
|
||||||
let renderEndTime = null;
|
let renderEndTime = undefined;
|
||||||
while (startTime <= endTime) {
|
while (startTime <= endTime) {
|
||||||
if (!invalid) {
|
if (!invalid) {
|
||||||
renderEndTime = endTime.toDate();
|
renderEndTime = endTime.toDate();
|
||||||
@@ -199,7 +199,7 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
|||||||
|
|
||||||
if (afterStatement !== null) {
|
if (afterStatement !== null) {
|
||||||
// check all after ids and take the latest
|
// check all after ids and take the latest
|
||||||
let latestEndingTask = null;
|
let latestEndingTask = undefined;
|
||||||
afterStatement[1].split(' ').forEach(function (id) {
|
afterStatement[1].split(' ').forEach(function (id) {
|
||||||
let task = findTaskById(id);
|
let task = findTaskById(id);
|
||||||
if (task !== undefined) {
|
if (task !== undefined) {
|
||||||
@@ -419,7 +419,7 @@ export const addTask = function (descr, data) {
|
|||||||
type: currentSection,
|
type: currentSection,
|
||||||
processed: false,
|
processed: false,
|
||||||
manualEndTime: false,
|
manualEndTime: false,
|
||||||
renderEndTime: null,
|
renderEndTime: undefined,
|
||||||
raw: { data: data },
|
raw: { data: data },
|
||||||
task: descr,
|
task: descr,
|
||||||
classes: [],
|
classes: [],
|
||||||
|
@@ -191,7 +191,7 @@ describe('when using the ganttDb', function () {
|
|||||||
|
|
||||||
expect(tasks[3].startTime).toEqual(moment('2019-02-01', 'YYYY-MM-DD').toDate());
|
expect(tasks[3].startTime).toEqual(moment('2019-02-01', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[3].endTime).toEqual(moment('2019-02-20', 'YYYY-MM-DD').toDate());
|
expect(tasks[3].endTime).toEqual(moment('2019-02-20', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[3].renderEndTime).toBeNull(); // Fixed end
|
expect(tasks[3].renderEndTime).toBeUndefined(); // Fixed end
|
||||||
expect(tasks[3].id).toEqual('id4');
|
expect(tasks[3].id).toEqual('id4');
|
||||||
expect(tasks[3].task).toEqual('test4');
|
expect(tasks[3].task).toEqual('test4');
|
||||||
|
|
||||||
@@ -360,13 +360,13 @@ describe('when using the ganttDb', function () {
|
|||||||
|
|
||||||
expect(tasks[0].startTime).toEqual(moment('2019-09-30', 'YYYY-MM-DD').toDate());
|
expect(tasks[0].startTime).toEqual(moment('2019-09-30', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[0].endTime).toEqual(moment('2019-10-11', 'YYYY-MM-DD').toDate());
|
expect(tasks[0].endTime).toEqual(moment('2019-10-11', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[1].renderEndTime).toBeNull(); // Fixed end
|
expect(tasks[1].renderEndTime).toBeUndefined(); // Fixed end
|
||||||
expect(tasks[0].id).toEqual('id1');
|
expect(tasks[0].id).toEqual('id1');
|
||||||
expect(tasks[0].task).toEqual('test1');
|
expect(tasks[0].task).toEqual('test1');
|
||||||
|
|
||||||
expect(tasks[1].startTime).toEqual(moment('2019-10-11', 'YYYY-MM-DD').toDate());
|
expect(tasks[1].startTime).toEqual(moment('2019-10-11', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[1].endTime).toEqual(moment('2019-10-31', 'YYYY-MM-DD').toDate());
|
expect(tasks[1].endTime).toEqual(moment('2019-10-31', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[1].renderEndTime).toBeNull(); // Fixed end
|
expect(tasks[1].renderEndTime).toBeUndefined(); // Fixed end
|
||||||
expect(tasks[1].id).toEqual('id2');
|
expect(tasks[1].id).toEqual('id2');
|
||||||
expect(tasks[1].task).toEqual('test2');
|
expect(tasks[1].task).toEqual('test2');
|
||||||
});
|
});
|
||||||
@@ -387,7 +387,7 @@ describe('when using the ganttDb', function () {
|
|||||||
|
|
||||||
expect(tasks[1].startTime).toEqual(moment('2019-02-01', 'YYYY-MM-DD').toDate());
|
expect(tasks[1].startTime).toEqual(moment('2019-02-01', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[1].endTime).toEqual(moment('2019-02-04', 'YYYY-MM-DD').toDate());
|
expect(tasks[1].endTime).toEqual(moment('2019-02-04', 'YYYY-MM-DD').toDate());
|
||||||
expect(tasks[1].renderEndTime).toBeNull(); // Fixed end
|
expect(tasks[1].renderEndTime).toBeUndefined(); // Fixed end
|
||||||
expect(tasks[1].manualEndTime).toBeTruthy();
|
expect(tasks[1].manualEndTime).toBeTruthy();
|
||||||
expect(tasks[1].id).toEqual('id2');
|
expect(tasks[1].id).toEqual('id2');
|
||||||
expect(tasks[1].task).toEqual('test2');
|
expect(tasks[1].task).toEqual('test2');
|
||||||
|
@@ -434,7 +434,7 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const excludeRanges = [];
|
const excludeRanges = [];
|
||||||
let range = null;
|
let range = undefined;
|
||||||
let d = moment(minTime);
|
let d = moment(minTime);
|
||||||
while (d.valueOf() <= maxTime) {
|
while (d.valueOf() <= maxTime) {
|
||||||
if (diagObj.db.isInvalidDate(d, dateFormat, excludes, includes)) {
|
if (diagObj.db.isInvalidDate(d, dateFormat, excludes, includes)) {
|
||||||
@@ -449,7 +449,7 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
} else {
|
} else {
|
||||||
if (range) {
|
if (range) {
|
||||||
excludeRanges.push(range);
|
excludeRanges.push(range);
|
||||||
range = null;
|
range = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.add(1, 'd');
|
d.add(1, 'd');
|
||||||
|
@@ -125,6 +125,7 @@ describe('when parsing a gantt diagram it', function () {
|
|||||||
'click cl2 call ganttTestClick()\n';
|
'click cl2 call ganttTestClick()\n';
|
||||||
|
|
||||||
expect(parserFnConstructor(str)).not.toThrow();
|
expect(parserFnConstructor(str)).not.toThrow();
|
||||||
|
// eslint-disable-next-line unicorn/no-null
|
||||||
expect(ganttDb.setClickEvent).toHaveBeenCalledWith('cl2', 'ganttTestClick', null);
|
expect(ganttDb.setClickEvent).toHaveBeenCalledWith('cl2', 'ganttTestClick', null);
|
||||||
});
|
});
|
||||||
it('should parse callback specifier with arbitrary number of args', function () {
|
it('should parse callback specifier with arbitrary number of args', function () {
|
||||||
|
@@ -17,7 +17,7 @@ import {
|
|||||||
let mainBranchName = getConfig().gitGraph.mainBranchName;
|
let mainBranchName = getConfig().gitGraph.mainBranchName;
|
||||||
let mainBranchOrder = getConfig().gitGraph.mainBranchOrder;
|
let mainBranchOrder = getConfig().gitGraph.mainBranchOrder;
|
||||||
let commits = {};
|
let commits = {};
|
||||||
let head = null;
|
let head = undefined;
|
||||||
let branchesConfig = {};
|
let branchesConfig = {};
|
||||||
branchesConfig[mainBranchName] = { name: mainBranchName, order: mainBranchOrder };
|
branchesConfig[mainBranchName] = { name: mainBranchName, order: mainBranchOrder };
|
||||||
let branches = {};
|
let branches = {};
|
||||||
@@ -120,7 +120,7 @@ export const commit = function (msg, id, type, tag) {
|
|||||||
seq: seq++,
|
seq: seq++,
|
||||||
type: type ? type : commitType.NORMAL,
|
type: type ? type : commitType.NORMAL,
|
||||||
tag: tag ? tag : '',
|
tag: tag ? tag : '',
|
||||||
parents: head == null ? [] : [head.id],
|
parents: head == undefined ? [] : [head.id],
|
||||||
branch: curBranch,
|
branch: curBranch,
|
||||||
};
|
};
|
||||||
head = commit;
|
head = commit;
|
||||||
@@ -246,7 +246,7 @@ export const merge = function (otherBranch, custom_id, override_type, custom_tag
|
|||||||
id: custom_id ? custom_id : seq + '-' + getId(),
|
id: custom_id ? custom_id : seq + '-' + getId(),
|
||||||
message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
||||||
seq: seq++,
|
seq: seq++,
|
||||||
parents: [head == null ? null : head.id, branches[otherBranch]],
|
parents: [head?.id, branches[otherBranch]],
|
||||||
branch: curBranch,
|
branch: curBranch,
|
||||||
type: commitType.MERGE,
|
type: commitType.MERGE,
|
||||||
customType: override_type,
|
customType: override_type,
|
||||||
@@ -330,7 +330,7 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
|||||||
id: seq + '-' + getId(),
|
id: seq + '-' + getId(),
|
||||||
message: 'cherry-picked ' + sourceCommit + ' into ' + curBranch,
|
message: 'cherry-picked ' + sourceCommit + ' into ' + curBranch,
|
||||||
seq: seq++,
|
seq: seq++,
|
||||||
parents: [head == null ? null : head.id, sourceCommit.id],
|
parents: [head?.id, sourceCommit.id],
|
||||||
branch: curBranch,
|
branch: curBranch,
|
||||||
type: commitType.CHERRY_PICK,
|
type: commitType.CHERRY_PICK,
|
||||||
tag: tag ?? 'cherry-pick:' + sourceCommit.id,
|
tag: tag ?? 'cherry-pick:' + sourceCommit.id,
|
||||||
@@ -443,7 +443,7 @@ export const prettyPrint = function () {
|
|||||||
|
|
||||||
export const clear = function () {
|
export const clear = function () {
|
||||||
commits = {};
|
commits = {};
|
||||||
head = null;
|
head = undefined;
|
||||||
let mainBranch = getConfig().gitGraph.mainBranchName;
|
let mainBranch = getConfig().gitGraph.mainBranchName;
|
||||||
let mainBranchOrder = getConfig().gitGraph.mainBranchOrder;
|
let mainBranchOrder = getConfig().gitGraph.mainBranchOrder;
|
||||||
branches = {};
|
branches = {};
|
||||||
|
@@ -851,15 +851,9 @@ describe('when parsing a gitGraph', function () {
|
|||||||
merge test1
|
merge test1
|
||||||
`;
|
`;
|
||||||
|
|
||||||
try {
|
expect(() => parser.parse(str)).to.throw(
|
||||||
parser.parse(str);
|
'Incorrect usage of "merge". Branch to be merged (test1) has no commits'
|
||||||
// Fail test if above expression doesn't throw anything.
|
);
|
||||||
expect(true).toBe(false);
|
|
||||||
} catch (e) {
|
|
||||||
expect(e.message).toBe(
|
|
||||||
'Incorrect usage of "merge". Branch to be merged (test1) has no commits'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
describe('accessibility', () => {
|
describe('accessibility', () => {
|
||||||
it('should handle a title and a description (accDescr)', () => {
|
it('should handle a title and a description (accDescr)', () => {
|
||||||
|
@@ -6,10 +6,10 @@ export const getCommits = () => {
|
|||||||
seq: 1,
|
seq: 1,
|
||||||
message: '',
|
message: '',
|
||||||
branch: 'master',
|
branch: 'master',
|
||||||
parents: null,
|
parents: undefined,
|
||||||
tag: 'v0.1',
|
tag: 'v0.1',
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000002': {
|
'0000002': {
|
||||||
id: '0000002',
|
id: '0000002',
|
||||||
@@ -17,9 +17,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'develop',
|
branch: 'develop',
|
||||||
parents: ['0000001'],
|
parents: ['0000001'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000003': {
|
'0000003': {
|
||||||
id: '0000003',
|
id: '0000003',
|
||||||
@@ -27,9 +27,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'featureB',
|
branch: 'featureB',
|
||||||
parents: ['0000002'],
|
parents: ['0000002'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000004': {
|
'0000004': {
|
||||||
id: '0000004',
|
id: '0000004',
|
||||||
@@ -37,9 +37,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'hotfix',
|
branch: 'hotfix',
|
||||||
parents: ['0000001'],
|
parents: ['0000001'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000005': {
|
'0000005': {
|
||||||
id: '0000005',
|
id: '0000005',
|
||||||
@@ -47,9 +47,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'develop',
|
branch: 'develop',
|
||||||
parents: ['0000002'],
|
parents: ['0000002'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000006': {
|
'0000006': {
|
||||||
id: '0000006',
|
id: '0000006',
|
||||||
@@ -57,9 +57,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'featureB',
|
branch: 'featureB',
|
||||||
parents: ['0000003'],
|
parents: ['0000003'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000007': {
|
'0000007': {
|
||||||
id: '0000007',
|
id: '0000007',
|
||||||
@@ -69,7 +69,7 @@ export const getCommits = () => {
|
|||||||
parents: ['0000004'],
|
parents: ['0000004'],
|
||||||
tag: 'v0.2',
|
tag: 'v0.2',
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000008': {
|
'0000008': {
|
||||||
id: '0000008',
|
id: '0000008',
|
||||||
@@ -77,9 +77,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'featureB',
|
branch: 'featureB',
|
||||||
parents: ['0000006'],
|
parents: ['0000006'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000009': {
|
'0000009': {
|
||||||
id: '0000009',
|
id: '0000009',
|
||||||
@@ -87,9 +87,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'featureA',
|
branch: 'featureA',
|
||||||
parents: ['0000005'],
|
parents: ['0000005'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000010': {
|
'0000010': {
|
||||||
id: '0000010',
|
id: '0000010',
|
||||||
@@ -97,9 +97,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'develop',
|
branch: 'develop',
|
||||||
parents: ['0000004', '0000005'],
|
parents: ['0000004', '0000005'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000011': {
|
'0000011': {
|
||||||
id: '0000011',
|
id: '0000011',
|
||||||
@@ -107,7 +107,7 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'featureA',
|
branch: 'featureA',
|
||||||
parents: ['0000009'],
|
parents: ['0000009'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: '',
|
note: '',
|
||||||
},
|
},
|
||||||
@@ -117,9 +117,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'featureB',
|
branch: 'featureB',
|
||||||
parents: ['0000008'],
|
parents: ['0000008'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000013': {
|
'0000013': {
|
||||||
id: '0000013',
|
id: '0000013',
|
||||||
@@ -127,9 +127,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'develop',
|
branch: 'develop',
|
||||||
parents: ['0000010', '0000011'],
|
parents: ['0000010', '0000011'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000014': {
|
'0000014': {
|
||||||
id: '0000014',
|
id: '0000014',
|
||||||
@@ -137,9 +137,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'release',
|
branch: 'release',
|
||||||
parents: ['0000013'],
|
parents: ['0000013'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000015': {
|
'0000015': {
|
||||||
id: '0000015',
|
id: '0000015',
|
||||||
@@ -147,9 +147,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'master',
|
branch: 'master',
|
||||||
parents: ['0000007'],
|
parents: ['0000007'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000016': {
|
'0000016': {
|
||||||
id: '0000016',
|
id: '0000016',
|
||||||
@@ -159,7 +159,7 @@ export const getCommits = () => {
|
|||||||
parents: ['0000014', '0000015'],
|
parents: ['0000014', '0000015'],
|
||||||
tag: 'v1.0',
|
tag: 'v1.0',
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
'0000017': {
|
'0000017': {
|
||||||
id: '0000017',
|
id: '0000017',
|
||||||
@@ -167,9 +167,9 @@ export const getCommits = () => {
|
|||||||
message: '',
|
message: '',
|
||||||
branch: 'develop',
|
branch: 'develop',
|
||||||
parents: ['0000013', '0000016'],
|
parents: ['0000013', '0000016'],
|
||||||
tag: null,
|
tag: undefined,
|
||||||
commitType: 'normal',
|
commitType: 'normal',
|
||||||
note: null,
|
note: undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -26,16 +26,16 @@ export const parseDirective = function (statement, context, type) {
|
|||||||
export const addActor = function (id, name, description, type) {
|
export const addActor = function (id, name, description, type) {
|
||||||
// Don't allow description nulling
|
// Don't allow description nulling
|
||||||
const old = actors[id];
|
const old = actors[id];
|
||||||
if (old && name === old.name && description == null) {
|
if (old && name === old.name && description == undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow null descriptions, either
|
// Don't allow null descriptions, either
|
||||||
if (description == null || description.text == null) {
|
if (description == undefined || description.text == undefined) {
|
||||||
description = { text: name, wrap: null, type };
|
description = { text: name, wrap: undefined, type };
|
||||||
}
|
}
|
||||||
if (type == null || description.text == null) {
|
if (type == undefined || description.text == undefined) {
|
||||||
description = { text: name, wrap: null, type };
|
description = { text: name, wrap: undefined, type };
|
||||||
}
|
}
|
||||||
|
|
||||||
actors[id] = {
|
actors[id] = {
|
||||||
@@ -45,8 +45,8 @@ export const addActor = function (id, name, description, type) {
|
|||||||
prevActor: prevActor,
|
prevActor: prevActor,
|
||||||
links: {},
|
links: {},
|
||||||
properties: {},
|
properties: {},
|
||||||
actorCnt: null,
|
actorCnt: undefined,
|
||||||
rectData: null,
|
rectData: undefined,
|
||||||
type: type || 'participant',
|
type: type || 'participant',
|
||||||
};
|
};
|
||||||
if (prevActor && actors[prevActor]) {
|
if (prevActor && actors[prevActor]) {
|
||||||
@@ -274,13 +274,10 @@ export const addALink = function (actorId, text) {
|
|||||||
* @param {any} links
|
* @param {any} links
|
||||||
*/
|
*/
|
||||||
function insertLinks(actor, links) {
|
function insertLinks(actor, links) {
|
||||||
if (actor.links == null) {
|
actor.links = {
|
||||||
actor.links = links;
|
...actor.links,
|
||||||
} else {
|
...links,
|
||||||
for (let key in links) {
|
};
|
||||||
actor.links[key] = links[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const addProperties = function (actorId, text) {
|
export const addProperties = function (actorId, text) {
|
||||||
@@ -302,7 +299,7 @@ export const addProperties = function (actorId, text) {
|
|||||||
* @param {any} properties
|
* @param {any} properties
|
||||||
*/
|
*/
|
||||||
function insertProperties(actor, properties) {
|
function insertProperties(actor, properties) {
|
||||||
if (actor.properties == null) {
|
if (actor.properties == undefined) {
|
||||||
actor.properties = properties;
|
actor.properties = properties;
|
||||||
} else {
|
} else {
|
||||||
for (let key in properties) {
|
for (let key in properties) {
|
||||||
|
@@ -27,7 +27,7 @@ export const bounds = {
|
|||||||
getHeight: function () {
|
getHeight: function () {
|
||||||
return (
|
return (
|
||||||
Math.max.apply(
|
Math.max.apply(
|
||||||
null,
|
undefined,
|
||||||
this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
|
this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
|
||||||
) +
|
) +
|
||||||
(this.loops.length === 0
|
(this.loops.length === 0
|
||||||
@@ -370,8 +370,7 @@ const drawMessage = function (diagram, msgModel, lineStartY: number, diagObj: Di
|
|||||||
.append('path')
|
.append('path')
|
||||||
.attr(
|
.attr(
|
||||||
'd',
|
'd',
|
||||||
`M ${startx},${lineStartY} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${
|
`M ${startx},${lineStartY} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${lineStartY + 25
|
||||||
lineStartY + 25
|
|
||||||
} H ${startx}`
|
} H ${startx}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -380,21 +379,21 @@ const drawMessage = function (diagram, msgModel, lineStartY: number, diagObj: Di
|
|||||||
.attr(
|
.attr(
|
||||||
'd',
|
'd',
|
||||||
'M ' +
|
'M ' +
|
||||||
startx +
|
startx +
|
||||||
',' +
|
',' +
|
||||||
lineStartY +
|
lineStartY +
|
||||||
' C ' +
|
' C ' +
|
||||||
(startx + 60) +
|
(startx + 60) +
|
||||||
',' +
|
',' +
|
||||||
(lineStartY - 10) +
|
(lineStartY - 10) +
|
||||||
' ' +
|
' ' +
|
||||||
(startx + 60) +
|
(startx + 60) +
|
||||||
',' +
|
',' +
|
||||||
(lineStartY + 30) +
|
(lineStartY + 30) +
|
||||||
' ' +
|
' ' +
|
||||||
startx +
|
startx +
|
||||||
',' +
|
',' +
|
||||||
(lineStartY + 20)
|
(lineStartY + 20)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -894,13 +893,13 @@ export const draw = function (_text: string, id: string, _version: string, diagO
|
|||||||
diagram.attr(
|
diagram.attr(
|
||||||
'viewBox',
|
'viewBox',
|
||||||
box.startx -
|
box.startx -
|
||||||
conf.diagramMarginX +
|
conf.diagramMarginX +
|
||||||
' -' +
|
' -' +
|
||||||
(conf.diagramMarginY + extraVertForTitle) +
|
(conf.diagramMarginY + extraVertForTitle) +
|
||||||
' ' +
|
' ' +
|
||||||
width +
|
width +
|
||||||
' ' +
|
' ' +
|
||||||
(height + extraVertForTitle)
|
(height + extraVertForTitle)
|
||||||
);
|
);
|
||||||
|
|
||||||
log.debug(`models:`, bounds.models);
|
log.debug(`models:`, bounds.models);
|
||||||
@@ -1110,17 +1109,17 @@ const buildNoteModel = function (msg, actors, diagObj) {
|
|||||||
noteModel.width = shouldWrap
|
noteModel.width = shouldWrap
|
||||||
? Math.max(conf.width, textDimensions.width)
|
? Math.max(conf.width, textDimensions.width)
|
||||||
: Math.max(
|
: Math.max(
|
||||||
actors[msg.from].width / 2 + actors[msg.to].width / 2,
|
actors[msg.from].width / 2 + actors[msg.to].width / 2,
|
||||||
textDimensions.width + 2 * conf.noteMargin
|
textDimensions.width + 2 * conf.noteMargin
|
||||||
);
|
);
|
||||||
noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
|
noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
|
||||||
} else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
|
} else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
|
||||||
noteModel.width = shouldWrap
|
noteModel.width = shouldWrap
|
||||||
? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin)
|
? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin)
|
||||||
: Math.max(
|
: Math.max(
|
||||||
actors[msg.from].width / 2 + actors[msg.to].width / 2,
|
actors[msg.from].width / 2 + actors[msg.to].width / 2,
|
||||||
textDimensions.width + 2 * conf.noteMargin
|
textDimensions.width + 2 * conf.noteMargin
|
||||||
);
|
);
|
||||||
noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
|
noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
|
||||||
} else if (msg.to === msg.from) {
|
} else if (msg.to === msg.from) {
|
||||||
textDimensions = utils.calculateTextDimensions(
|
textDimensions = utils.calculateTextDimensions(
|
||||||
@@ -1203,8 +1202,8 @@ const buildMessageModel = function (msg, actors, diagObj) {
|
|||||||
message: msg.message,
|
message: msg.message,
|
||||||
type: msg.type,
|
type: msg.type,
|
||||||
wrap: msg.wrap,
|
wrap: msg.wrap,
|
||||||
fromBounds: Math.min.apply(null, allBounds),
|
fromBounds: Math.min.apply(undefined, allBounds),
|
||||||
toBounds: Math.max.apply(null, allBounds),
|
toBounds: Math.max.apply(undefined, allBounds),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ export const drawPopup = function (elem, actor, minMenuWidth, textAttrs, forceMe
|
|||||||
rectElem.attr('height', rectData.height);
|
rectElem.attr('height', rectData.height);
|
||||||
rectElem.attr('rx', rectData.rx);
|
rectElem.attr('rx', rectData.rx);
|
||||||
rectElem.attr('ry', rectData.ry);
|
rectElem.attr('ry', rectData.ry);
|
||||||
if (links != null) {
|
if (links != undefined) {
|
||||||
var linkY = 20;
|
var linkY = 20;
|
||||||
for (let key in links) {
|
for (let key in links) {
|
||||||
var linkElem = g.append('a');
|
var linkElem = g.append('a');
|
||||||
@@ -140,14 +140,14 @@ export const popdownMenu = function (popid) {
|
|||||||
|
|
||||||
const popupMenuUpFunc = function (popupId) {
|
const popupMenuUpFunc = function (popupId) {
|
||||||
var pu = document.getElementById(popupId);
|
var pu = document.getElementById(popupId);
|
||||||
if (pu != null) {
|
if (pu !== null) {
|
||||||
pu.style.display = 'block';
|
pu.style.display = 'block';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const popupMenuDownFunc = function (popupId) {
|
const popupMenuDownFunc = function (popupId) {
|
||||||
var pu = document.getElementById(popupId);
|
var pu = document.getElementById(popupId);
|
||||||
if (pu != null) {
|
if (pu !== null) {
|
||||||
pu.style.display = 'none';
|
pu.style.display = 'none';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -360,7 +360,7 @@ const drawActorTypeParticipant = function (elem, actor, conf) {
|
|||||||
g = boxpluslineGroup.append('g');
|
g = boxpluslineGroup.append('g');
|
||||||
actor.actorCnt = actorCnt;
|
actor.actorCnt = actorCnt;
|
||||||
|
|
||||||
if (actor.links != null) {
|
if (actor.links != undefined) {
|
||||||
g.attr('id', 'root-' + actorCnt);
|
g.attr('id', 'root-' + actorCnt);
|
||||||
addPopupInteraction('#root-' + actorCnt, actorCnt);
|
addPopupInteraction('#root-' + actorCnt, actorCnt);
|
||||||
}
|
}
|
||||||
@@ -368,8 +368,8 @@ const drawActorTypeParticipant = function (elem, actor, conf) {
|
|||||||
|
|
||||||
const rect = getNoteRect();
|
const rect = getNoteRect();
|
||||||
var cssclass = 'actor';
|
var cssclass = 'actor';
|
||||||
if (actor.properties != null && actor.properties['class']) {
|
if (actor?.properties?.class) {
|
||||||
cssclass = actor.properties['class'];
|
cssclass = actor.properties.class;
|
||||||
} else {
|
} else {
|
||||||
rect.fill = '#eaeaea';
|
rect.fill = '#eaeaea';
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ const drawActorTypeParticipant = function (elem, actor, conf) {
|
|||||||
const rectElem = drawRect(g, rect);
|
const rectElem = drawRect(g, rect);
|
||||||
actor.rectData = rect;
|
actor.rectData = rect;
|
||||||
|
|
||||||
if (actor.properties != null && actor.properties['icon']) {
|
if (actor.properties?.icon) {
|
||||||
const iconSrc = actor.properties['icon'].trim();
|
const iconSrc = actor.properties['icon'].trim();
|
||||||
if (iconSrc.charAt(0) === '@') {
|
if (iconSrc.charAt(0) === '@') {
|
||||||
drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
|
drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
|
||||||
|
@@ -196,24 +196,24 @@ const extract = (_doc) => {
|
|||||||
/**
|
/**
|
||||||
* Function called by parser when a node definition has been found.
|
* Function called by parser when a node definition has been found.
|
||||||
*
|
*
|
||||||
* @param {null | string} id
|
* @param {undefined | string} id
|
||||||
* @param {null | string} type
|
* @param {undefined | string} type
|
||||||
* @param {null | string} doc
|
* @param {undefined | string} doc
|
||||||
* @param {null | string | string[]} descr - description for the state. Can be a string or a list or strings
|
* @param {undefined | string | string[]} descr - description for the state. Can be a string or a list or strings
|
||||||
* @param {null | string} note
|
* @param {undefined | string} note
|
||||||
* @param {null | string | string[]} classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
|
* @param {undefined | string | string[]} classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
|
||||||
* @param {null | string | string[]} styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
|
* @param {undefined | string | string[]} styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
|
||||||
* @param {null | string | string[]} textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
|
* @param {undefined | string | string[]} textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
|
||||||
*/
|
*/
|
||||||
export const addState = function (
|
export const addState = function (
|
||||||
id,
|
id,
|
||||||
type = DEFAULT_STATE_TYPE,
|
type = DEFAULT_STATE_TYPE,
|
||||||
doc = null,
|
doc = undefined,
|
||||||
descr = null,
|
descr = undefined,
|
||||||
note = null,
|
note = undefined,
|
||||||
classes = null,
|
classes = undefined,
|
||||||
styles = null,
|
styles = undefined,
|
||||||
textStyles = null
|
textStyles = undefined
|
||||||
) {
|
) {
|
||||||
// add the state if needed
|
// add the state if needed
|
||||||
if (currentDocument.states[id] === undefined) {
|
if (currentDocument.states[id] === undefined) {
|
||||||
|
@@ -123,8 +123,8 @@ describe('mermaidAPI', function () {
|
|||||||
const result = encodeEntities(text);
|
const result = encodeEntities(text);
|
||||||
expect(result).toEqual(
|
expect(result).toEqual(
|
||||||
'style this; is ; everything :something#not-nothing; and this too \n' +
|
'style this; is ; everything :something#not-nothing; and this too \n' +
|
||||||
'classDef this; is ; everything :something#not-nothing; and this too \n' +
|
'classDef this; is ; everything :something#not-nothing; and this too \n' +
|
||||||
'Hello fl°there¶ß fl°andHere¶ßfl°°77653¶ß'
|
'Hello fl°there¶ß fl°andHere¶ßfl°°77653¶ß'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -287,7 +287,7 @@ describe('mermaidAPI', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
it('gets the cssStyles from the theme', () => {
|
it('gets the cssStyles from the theme', () => {
|
||||||
const styles = createCssStyles(mocked_config_with_htmlLabels, 'graphType', null);
|
const styles = createCssStyles(mocked_config_with_htmlLabels, 'graphType', undefined);
|
||||||
expect(styles).toMatch(/^\ndefault(.*)/);
|
expect(styles).toMatch(/^\ndefault(.*)/);
|
||||||
});
|
});
|
||||||
it('gets the fontFamily from the config', () => {
|
it('gets the fontFamily from the config', () => {
|
||||||
@@ -663,8 +663,8 @@ describe('mermaidAPI', function () {
|
|||||||
`)
|
`)
|
||||||
).toThrow(
|
).toThrow(
|
||||||
'Diagrams beginning with --- are not valid. ' +
|
'Diagrams beginning with --- are not valid. ' +
|
||||||
'If you were trying to use a YAML front-matter, please ensure that ' +
|
'If you were trying to use a YAML front-matter, please ensure that ' +
|
||||||
"you've correctly opened and closed the YAML front-matter with unindented `---` blocks"
|
"you've correctly opened and closed the YAML front-matter with unindented `---` blocks"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('does not throw for a valid definition', function () {
|
it('does not throw for a valid definition', function () {
|
||||||
|
@@ -166,7 +166,7 @@ export const cssImportantStyles = (
|
|||||||
export const createCssStyles = (
|
export const createCssStyles = (
|
||||||
config: MermaidConfig,
|
config: MermaidConfig,
|
||||||
graphType: string,
|
graphType: string,
|
||||||
classDefs: Record<string, DiagramStyleClassDef> | null | undefined = {}
|
classDefs: Record<string, DiagramStyleClassDef> | undefined = {}
|
||||||
): string => {
|
): string => {
|
||||||
let cssStyles = '';
|
let cssStyles = '';
|
||||||
|
|
||||||
|
@@ -123,13 +123,13 @@ export const detectInit = function (text: string, config?: MermaidConfig): Merma
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param text - The text defining the graph
|
* @param text - The text defining the graph
|
||||||
* @param type - The directive to return (default: `null`)
|
* @param type - The directive to return (default: `undefined`)
|
||||||
* @returns An object or Array representing the directive(s) matched by the input type.
|
* @returns An object or Array representing the directive(s) matched by the input type.
|
||||||
* If a single directive was found, that directive object will be returned.
|
* If a single directive was found, that directive object will be returned.
|
||||||
*/
|
*/
|
||||||
export const detectDirective = function (
|
export const detectDirective = function (
|
||||||
text: string,
|
text: string,
|
||||||
type: string | RegExp = null
|
type: string | RegExp = undefined
|
||||||
): { type?: string; args?: any } | { type?: string; args?: any }[] {
|
): { type?: string; args?: any } | { type?: string; args?: any }[] {
|
||||||
try {
|
try {
|
||||||
const commentWithoutDirectives = new RegExp(
|
const commentWithoutDirectives = new RegExp(
|
||||||
@@ -153,12 +153,12 @@ export const detectDirective = function (
|
|||||||
(type && match[2] && match[2].match(type))
|
(type && match[2] && match[2].match(type))
|
||||||
) {
|
) {
|
||||||
const type = match[1] ? match[1] : match[2];
|
const type = match[1] ? match[1] : match[2];
|
||||||
const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
|
const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : undefined;
|
||||||
result.push({ type, args });
|
result.push({ type, args });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result.length === 0) {
|
if (result.length === 0) {
|
||||||
result.push({ type: text, args: null });
|
result.push({ type: text, args: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.length === 1 ? result[0] : result;
|
return result.length === 1 ? result[0] : result;
|
||||||
@@ -167,7 +167,7 @@ export const detectDirective = function (
|
|||||||
`ERROR: ${error.message} - Unable to parse directive
|
`ERROR: ${error.message} - Unable to parse directive
|
||||||
${type !== null ? ' type:' + type : ''} based on the text:${text}`
|
${type !== null ? ' type:' + type : ''} based on the text:${text}`
|
||||||
);
|
);
|
||||||
return { type: null, args: null };
|
return { type: undefined, args: undefined };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -762,11 +762,11 @@ export const calculateTextDimensions: (
|
|||||||
|
|
||||||
const index =
|
const index =
|
||||||
isNaN(dims[1].height) ||
|
isNaN(dims[1].height) ||
|
||||||
isNaN(dims[1].width) ||
|
isNaN(dims[1].width) ||
|
||||||
isNaN(dims[1].lineHeight) ||
|
isNaN(dims[1].lineHeight) ||
|
||||||
(dims[0].height > dims[1].height &&
|
(dims[0].height > dims[1].height &&
|
||||||
dims[0].width > dims[1].width &&
|
dims[0].width > dims[1].width &&
|
||||||
dims[0].lineHeight > dims[1].lineHeight)
|
dims[0].lineHeight > dims[1].lineHeight)
|
||||||
? 0
|
? 0
|
||||||
: 1;
|
: 1;
|
||||||
return dims[index];
|
return dims[index];
|
||||||
|
Reference in New Issue
Block a user